Advertisement
roninator2

Shop Item Name Scroll Text

Nov 17th, 2024 (edited)
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 27.25 KB | Source Code | 0 0
  1. # ╔═══════════════════════════════════════════════╦════════════════════╗
  2. # ║ Title: Shop Item Name Scroll Text             ║ Version: 1.05      ║
  3. # ║ Author: Roninator2                            ║                    ║
  4. # ╠═══════════════════════════════════════════════╬════════════════════╣
  5. # ║ Function:                                     ║ Date Created       ║
  6. # ║                                               ╠════════════════════╣
  7. # ║ Scroll the text when too long to fit          ║ 17 Sep 2023        ║
  8. # ╚═══════════════════════════════════════════════╩════════════════════╝
  9. # ╔════════════════════════════════════════════════════════════════════╗
  10. # ║ Requires: nil                                                      ║
  11. # ║ TsukiHime Instance Items                                           ║
  12. # ║ Intended to assist with Item Affixes                               ║
  13. # ║                                                                    ║
  14. # ╚════════════════════════════════════════════════════════════════════╝
  15. # ╔════════════════════════════════════════════════════════════════════╗
  16. # ║ Brief Description:                                                 ║
  17. # ║ Scroll Item names in Shop                                          ║
  18. # ╚════════════════════════════════════════════════════════════════════╝
  19. # ╔════════════════════════════════════════════════════════════════════╗
  20. # ║ Instructions:                                                      ║
  21. # ║                                                                    ║
  22. # ║ Plug and play                                                      ║
  23. # ║ Change the speed number if you like                                ║
  24. # ║                                                                    ║
  25. # ║ Designed for the default system and settings                       ║
  26. # ║ Modifications may need to be done if not using defaults            ║
  27. # ║                                                                    ║
  28. # ╚════════════════════════════════════════════════════════════════════╝
  29. # ╔════════════════════════════════════════════════════════════════════╗
  30. # ║ Updates:                                                           ║
  31. # ║ 1.04 - 17 Sep 2023 - Script finished                               ║
  32. # ║ 1.05 - added support for item rarity script                        ║
  33. # ║                                                                    ║
  34. # ╚════════════════════════════════════════════════════════════════════╝
  35. # ╔════════════════════════════════════════════════════════════════════╗
  36. # ║ Credits and Thanks:                                                ║
  37. # ║ RPG Maker Source                                                   ║
  38. # ║ Roninator2                                                         ║
  39. # ║                                                                    ║
  40. # ╚════════════════════════════════════════════════════════════════════╝
  41. # ╔════════════════════════════════════════════════════════════════════╗
  42. # ║ Terms of use:                                                      ║
  43. # ║ Follow the original Authors terms of use where applicable          ║
  44. # ║ - When not made by me (Roninator2)                                 ║
  45. # ║ Free for all uses in RPG Maker except nudity                       ║
  46. # ║ Anyone using this script in their project before these terms       ║
  47. # ║ were changed are allowed to use this script even if it conflicts   ║
  48. # ║ with these new terms. New terms effective 03 Apr 2024              ║
  49. # ║ No part of this code can be used with AI programs or tools         ║
  50. # ║ Credit must be given                                               ║
  51. # ╚════════════════════════════════════════════════════════════════════╝
  52.  
  53.  
  54. module R2_Shop_Scroll_Name
  55.   Shop_Speed = 0.8 # anything from 0.4 to 1.2 is ok
  56.   Shop_length = 16
  57. end
  58.  
  59. #==============================================================================
  60. # ** Window_ShopBuy
  61. #==============================================================================
  62.  
  63. class Window_ShopBuy < Window_Selectable
  64.  
  65.   #--------------------------------------------------------------------------
  66.   # * Object Initialization
  67.   #--------------------------------------------------------------------------
  68.   alias r2_shopbuy_text_scroll_init initialize
  69.   def initialize(x, y, height, shop_goods)
  70.     @r2_scrolling_shop_buy_text_line ||= {}
  71.     r2_shopbuy_text_scroll_init(x, y, height, shop_goods)
  72.   end
  73.   #--------------------------------------------------------------------------
  74.   # * Draw Item Name
  75.   # enabled : Enabled flag. When false, draw semi-transparently.
  76.   #--------------------------------------------------------------------------
  77.   def draw_item_name(item, x, y, enabled = true, width = 175)
  78.     return unless item
  79.     draw_icon(item.icon_index, x, y, enabled)
  80.     if $imported[:TH_ItemRarity]
  81.       change_color(item.rarity_colour, enabled)
  82.     else
  83.       change_color(normal_color, enabled)
  84.     end
  85.     cw = contents.text_size(item.name).width
  86.     if (cw < width)
  87.       draw_text(x + 24, y, width, line_height, item.name)
  88.     else
  89.       set_text(item.id, x, y, item.name, width, cw)
  90.     end
  91.   end
  92.   #=============================================================================
  93.   #--------------------------------------------------------------------------
  94.   # * Update. [MOD]
  95.   #--------------------------------------------------------------------------
  96.   alias r2_update_equip_text_scroll update
  97.   def update
  98.     # Original method.
  99.     r2_update_equip_text_scroll
  100.     # data -> key = id -> 0 = text, 1 = speed, 2 = width, 3 = bitmap,
  101.     # 4 - position {x,y}, 5 - text width, 6 - placement, 7 - direction <- ->
  102.     # 8 - viewport, 9 - type
  103.     dispose_shopbuy_list if !self.active
  104.     return if !self.active
  105.     buyitem = @Data[@index].nil? ? -1 : @Data[@index].id
  106.     @r2_scrolling_shop_buy_text_line.each do |id, data|
  107.       next if buyitem != id
  108.       data[3].visible = visible
  109.       # Advance the image position
  110.       # Change the offset X to scroll.
  111.       if (data[7] == 0)
  112.         data[6] += (1.0 * data[1]).to_f
  113.         data[3].ox = data[6]
  114.       elsif (data[7] == 1)
  115.         data[6] -= (1.0 * data[1]).to_f
  116.         data[3].ox = data[6]
  117.       end
  118.       if data[6] >= (data[5] - (data[2] / 5 * 3) - 30)
  119.         data[7] = 1
  120.       elsif data[6] <= 10
  121.         data[7] = 0
  122.       end
  123.     end
  124.   end
  125.   #--------------------------------------------------------------------------
  126.   # * Set Text. [REP]
  127.   #--------------------------------------------------------------------------
  128.   def set_text(id, x, y, text, width, cw)
  129.     # New text?
  130.     # data -> key = id -> 0 = text, 1 = speed, 2 = width, 3 = bitmap,
  131.     # 4 - position, 5 - text width, 6 - placement, 7 - direction,
  132.     # 8 - viewport
  133.     @r2_scrolling_shop_buy_text_line ||= {}
  134.     if @r2_scrolling_shop_buy_text_line.empty? || @r2_scrolling_shop_buy_text_line[id].nil? ||
  135.       text != @r2_scrolling_shop_buy_text_line[id][1]
  136.       # Dispose the Scrolling Help objects if needed.
  137.       r2_scrolling_text_dispose(id) if @r2_scrolling_shop_buy_text_line[id] != nil
  138.       speed = R2_Shop_Scroll_Name::Shop_Speed
  139.       x = x + self.x
  140.       if cw > width
  141.         # draw the line as a scrolling line.
  142.         @r2_scrolling_shop_buy_text_line[id] = [text, speed, width, nil, [x, y], cw,
  143.         x, 0, nil]
  144.         r2_shop_scrolling_text_create(id, x, y, text, width)
  145.       end
  146.     end
  147.   end
  148.   #--------------------------------------------------------------------------
  149.   # * Scrolling Help Create. [NEW]
  150.   #--------------------------------------------------------------------------
  151.   def r2_shop_scrolling_text_create(id, x, y, text, width)
  152.     # draw normal text if not at index position
  153.     buyitem = @Data[@index].nil? ? -1 : @Data[@index].id
  154.     if buyitem != id
  155.       text = text[0..(R2_Shop_Scroll_Name::Shop_length - 1)] + "..."
  156.       draw_text(x + 24, y, width, line_height, text)
  157.       return
  158.     end
  159.     # Create a Bitmap instance to draw the text into it.
  160.     line_bitmap = Bitmap.new(@r2_scrolling_shop_buy_text_line[id][5] + 24, calc_line_height(text))
  161.     # Save current Window's Bitmap.
  162.     original_contents = contents
  163.     # Set the recently created Bitmap as the Window's Bitmap.
  164.     self.contents = line_bitmap
  165.     # Use the default method to draw the text into it.
  166.     draw_text_ex(24, 0, text)
  167.     # Reset back the Window's Bitmap to the original one.
  168.     self.contents = original_contents
  169.     # Viewport for the Scrolling Line.
  170.     @r2_scrolling_shop_buy_text_line[id][8] = Viewport.new(
  171.     x + standard_padding + 24,
  172.     self.y + (@index - self.top_row) * 24 + standard_padding,
  173.     width, line_bitmap.height )
  174.     # Put the recently created Viewport on top of this Window.
  175.     @r2_scrolling_shop_buy_text_line[id][8].z = viewport ? viewport.z + 1 : z + 1
  176.     # Create a Plane instance for the scrolling effect.
  177.     @r2_scrolling_shop_buy_text_line[id][3] = Plane.new(@r2_scrolling_shop_buy_text_line[id][8])
  178.     # Assign the recently created Bitmap (where the line is drawn) to it.
  179.     @r2_scrolling_shop_buy_text_line[id][3].bitmap = line_bitmap
  180.   end
  181.   #--------------------------------------------------------------------------
  182.   # * Scrolling Help Dispose. [NEW]
  183.   #--------------------------------------------------------------------------
  184.   def r2_shop_scrolling_text_dispose(id)
  185.     # Disposes Bitmap, Plane and Viewport.
  186.     if !@r2_scrolling_shop_buy_text_line[id][3].nil?
  187.       @r2_scrolling_shop_buy_text_line[id][3].bitmap.dispose
  188.       @r2_scrolling_shop_buy_text_line[id][3].dispose
  189.     end
  190.     # Prevents executing this method when the Plane (or Viewport) is disposed.
  191.     @r2_scrolling_shop_buy_text_line[id][3] = nil
  192.   end
  193.   #--------------------------------------------------------------------------
  194.   # * Dispose All values. [NEW]
  195.   #--------------------------------------------------------------------------
  196.   def dispose_shopbuy_list
  197.     if @r2_scrolling_shop_buy_text_line != {}
  198.       @r2_scrolling_shop_buy_text_line.each do |key, entry|
  199.         r2_shop_scrolling_text_dispose(key)
  200.       end
  201.     end
  202.     @r2_scrolling_shop_buy_text_line = {}
  203.   end
  204.   #--------------------------------------------------------------------------
  205.   # * Dispose. [MOD]
  206.   #--------------------------------------------------------------------------
  207.   def dispose
  208.     # Dispose Scrolling Help objects if needed.
  209.     if @r2_scrolling_shop_buy_text_line != {}
  210.       dispose_shopbuy_list
  211.     end
  212.     @r2_scrolling_shop_buy_text_line = {}
  213.     # Original method.
  214.     super
  215.   end
  216.   #--------------------------------------------------------------------------
  217.   # * Refresh
  218.   #--------------------------------------------------------------------------
  219.   alias r2_refresh_dispose_scroll_text refresh
  220.   def refresh
  221.     if @r2_scrolling_shop_buy_text_line != {}
  222.       dispose_shopbuy_list
  223.     end
  224.     @r2_scrolling_shop_buy_text_line = {}
  225.     r2_refresh_dispose_scroll_text
  226.   end
  227.   #--------------------------------------------------------------------------
  228.   # * Cursor Movement Processing
  229.   #--------------------------------------------------------------------------
  230.   alias r2_cursor_index_move_refresh_draw process_cursor_move
  231.   def process_cursor_move
  232.     last_index = @index
  233.     r2_cursor_index_move_refresh_draw
  234.     refresh if @index != last_index
  235.   end
  236. end
  237.  
  238. #==============================================================================
  239. # ** Window_ShopNumber
  240. #==============================================================================
  241.  
  242. class Window_ShopNumber < Window_Selectable
  243.  
  244.   #--------------------------------------------------------------------------
  245.   # * Object Initialization
  246.   #--------------------------------------------------------------------------
  247.   alias r2_shopnumber_text_scroll_init initialize
  248.   def initialize(x, y, height)
  249.     @r2_scrolling_shop_number_text_line ||= {}
  250.     r2_shopnumber_text_scroll_init(x, y, height)
  251.   end
  252.   #--------------------------------------------------------------------------
  253.   # * Draw Item Name
  254.   # enabled : Enabled flag. When false, draw semi-transparently.
  255.   #--------------------------------------------------------------------------
  256.   def draw_item_name(item, x, y, enabled = true, width = 175)
  257.     return unless item
  258.     draw_icon(item.icon_index, x, y, enabled)
  259.     change_color(normal_color, enabled)
  260.     dispose_number_buy
  261.     cw = contents.text_size(item.name).width
  262.     if cw < width
  263.       draw_text(x + 24, y, width, line_height, item.name)
  264.     else
  265.       set_text(item.id, x, y, item.name, width)
  266.     end
  267.   end
  268.   #=============================================================================
  269.   #--------------------------------------------------------------------------
  270.   # * Update. [MOD]
  271.   #--------------------------------------------------------------------------
  272.   alias r2_update_shopnumber_text_scroll update
  273.   def update
  274.     # Original method.
  275.     r2_update_shopnumber_text_scroll
  276.     # data -> key = id -> 0 = text, 1 = speed, 2 = width, 3 = bitmap,
  277.     # 4 - position {x,y}, 5 - text width, 6 - placement, 7 - direction <- ->
  278.     # 8 - viewport, 9 - type
  279.     return if @r2_scrolling_shop_number_text_line == {}
  280.     @r2_scrolling_shop_number_text_line.each do |id, data|
  281.       next if data[3].nil?
  282.       data[3].visible = visible
  283.       # Advance the image position
  284.       # Change the offset X to scroll.
  285.       if (data[7] == 0)
  286.         data[6] += (1.0 * data[1]).to_f
  287.         data[3].ox = data[6]
  288.       elsif (data[7] == 1)
  289.         data[6] -= (1.0 * data[1]).to_f
  290.         data[3].ox = data[6]
  291.       end
  292.       if data[6] >= (data[5] - (data[2] / 5 * 3) - 30)
  293.         data[7] = 1
  294.       elsif data[6] <= 10
  295.         data[7] = 0
  296.       end
  297.     end
  298.   end
  299.   #--------------------------------------------------------------------------
  300.   # * Set Text. [REP]
  301.   #--------------------------------------------------------------------------
  302.   def set_text(id, x, y, text, width)
  303.     # New text?
  304.     # data -> key = id -> 0 = text, 1 = speed, 2 = width, 3 = bitmap,
  305.     # 4 - position, 5 - text width, 6 - placement, 7 - direction,
  306.     # 8 - viewport
  307.     cw = contents.text_size(text).width
  308.     if @r2_scrolling_shop_number_text_line.empty? || @r2_scrolling_shop_number_text_line[id].nil? ||
  309.       text != @r2_scrolling_shop_buy_text_line[id][1]
  310.       # Dispose the Scrolling Help objects if needed.
  311.       r2_scrolling_text_dispose(id) if @r2_scrolling_shop_number_text_line[id] != nil
  312.       speed = R2_Shop_Scroll_Name::Shop_Speed
  313.       x = x + self.x
  314.       if cw > width
  315.         # draw the line as a scrolling line.
  316.         @r2_scrolling_shop_number_text_line[id] = [text, speed, width, nil, [x, y], cw,
  317.         x, 0, nil]
  318.         r2_scrolling_text_create(id, x, y, text, width)
  319.       end
  320.     end
  321.   end
  322.   #--------------------------------------------------------------------------
  323.   # * Scrolling Help Create. [NEW]
  324.   #--------------------------------------------------------------------------
  325.   def r2_scrolling_text_create(id, x, y, text, width)
  326.     # Create a Bitmap instance to draw the text into it.
  327.     line_bitmap = Bitmap.new(@r2_scrolling_shop_number_text_line[id][5] + 24, calc_line_height(text))
  328.     # Save current Window's Bitmap.
  329.     original_contents = contents
  330.     # Set the recently created Bitmap as the Window's Bitmap.
  331.     self.contents = line_bitmap
  332.     # Use the default method to draw the text into it.
  333.     draw_text_ex(24, 0, text)
  334.     # Reset back the Window's Bitmap to the original one.
  335.     self.contents = original_contents
  336.     # Viewport for the Scrolling Line.
  337.     @r2_scrolling_shop_number_text_line[id][8] = Viewport.new(
  338.     x + standard_padding + 24,
  339.     self.y + y + standard_padding,
  340.     width,
  341.     line_bitmap.height
  342.     )
  343.     # Put the recently created Viewport on top of this Window.
  344.     @r2_scrolling_shop_number_text_line[id][8].z = viewport ? viewport.z + 1 : z + 1
  345.     # Create a Plane instance for the scrolling effect.
  346.     @r2_scrolling_shop_number_text_line[id][3] = Plane.new(@r2_scrolling_shop_number_text_line[id][8])
  347.     # Assign the recently created Bitmap (where the line is drawn) to it.
  348.     @r2_scrolling_shop_number_text_line[id][3].bitmap = line_bitmap
  349.     @r2_scrolling_shop_number_text_line[id][3].visible = !visible
  350.   end
  351.   #--------------------------------------------------------------------------
  352.   # * Dispose All values. [NEW]
  353.   #--------------------------------------------------------------------------
  354.   def dispose_number_buy
  355.     if !@r2_scrolling_shop_number_text_line.empty?
  356.       @r2_scrolling_shop_number_text_line.each do |key, entry|
  357.         # Disposes Bitmap, Plane and Viewport.
  358.         @r2_scrolling_shop_number_text_line[key][3].bitmap.dispose
  359.         @r2_scrolling_shop_number_text_line[key][3].dispose
  360.         # Prevents executing this method when the Plane (or Viewport) is disposed.
  361.         @r2_scrolling_shop_number_text_line[key] = nil
  362.       end
  363.     end
  364.     @r2_scrolling_shop_number_text_line = {}
  365.   end
  366.   #--------------------------------------------------------------------------
  367.   # * Dispose. [MOD]
  368.   #--------------------------------------------------------------------------
  369.   def dispose
  370.     # Dispose Scrolling Help objects if needed.
  371.     dispose_number_buy
  372.     @r2_scrolling_shop_number_text_line = {}
  373.     # Original method.
  374.     super
  375.   end
  376. end
  377.  
  378. #==============================================================================
  379. # ** Window_ShopStatus
  380. #==============================================================================
  381.  
  382. class Window_ShopStatus < Window_Base
  383.   #--------------------------------------------------------------------------
  384.   # * Object Initialization
  385.   #--------------------------------------------------------------------------
  386.   alias r2_shop_status_text_scroll_init initialize
  387.   def initialize(x, y, width, height)
  388.     @r2_scrolling_shop_status_text_line ||= {}
  389.     r2_shop_status_text_scroll_init(x, y, width, height)
  390.   end
  391.   #--------------------------------------------------------------------------
  392.   # * Draw Item Name
  393.   # enabled : Enabled flag. When false, draw semi-transparently.
  394.   #--------------------------------------------------------------------------
  395.   def draw_item_name(item, x, y, enabled = true, width = 175)
  396.     return unless item
  397.     draw_icon(item.icon_index, x, y, enabled)
  398.     change_color(normal_color, enabled)
  399.     cw = contents.text_size(item.name).width
  400.     if cw < width
  401.       draw_text(x + 24, y, width, line_height, item.name)
  402.     else
  403.       if TH::Instance_Items::Enable_Armors
  404.         set_text(item.id, x, y, item.name, width)
  405.       else
  406.         id = @r2_scrolling_shop_status_text_line.size
  407.         set_text(id, x, y, item.name, width)
  408.       end
  409.     end
  410.   end
  411.   #=============================================================================
  412.   #--------------------------------------------------------------------------
  413.   # * Update. [MOD]
  414.   #--------------------------------------------------------------------------
  415.   alias r2_update_shop_status_text_scroll update
  416.   def update
  417.     # Original method.
  418.     r2_update_shop_status_text_scroll
  419.     # data -> key = id -> 0 = text, 1 = speed, 2 = width, 3 = bitmap,
  420.     # 4 - position {x,y}, 5 - text width, 6 - placement, 7 - direction <- ->
  421.     # 8 - viewport
  422.     return if @r2_scrolling_shop_status_text_line.nil? || @r2_scrolling_shop_status_text_line.empty?
  423.     @r2_scrolling_shop_status_text_line.each do |id, data|
  424.       data[3].visible = visible
  425.       # Advance the image position
  426.       # Change the offset X to scroll.
  427.       if (data[7] == 0)
  428.         data[6] += (1.0 * data[1]).to_f
  429.         data[3].ox = data[6] - data[2] - 25
  430.       elsif (data[7] == 1)
  431.         data[6] -= (1.0 * data[1]).to_f
  432.         data[3].ox = data[6] - data[2] - 25
  433.       end
  434.       if (data[6] >= (data[5] + (data[2] / 5 * 2) ))
  435.         data[7] = 1
  436.       elsif (data[6] <= (data[5] - (data[2] / 5 * 3) - 10))
  437.         data[7] = 0
  438.       end
  439.     end
  440.   end
  441.   #--------------------------------------------------------------------------
  442.   # * Set Text. [REP]
  443.   #--------------------------------------------------------------------------
  444.   def set_text(id, x, y, text, width)
  445.     # New text?
  446.     # data -> key = id -> 0 = text, 1 = speed, 2 = width, 3 = bitmap,
  447.     # 4 - position, 5 - text width, 6 - placement, 7 - direction,
  448.     # 8 - viewport
  449.     @r2_scrolling_shop_status_text_line ||= {}
  450.     cw = contents.text_size(text).width
  451.     if @r2_scrolling_shop_status_text_line.empty? || @r2_scrolling_shop_status_text_line[id].nil? ||
  452.       text != @r2_scrolling_shop_status_text_line[id][1]
  453.       # Dispose the Scrolling Help objects if needed.
  454.       r2_shop_status_text_dispose(id) if @r2_scrolling_shop_status_text_line[id] != nil
  455.       speed = R2_Shop_Scroll_Name::Shop_Speed
  456.       x = x + self.x
  457.       if cw > width
  458.         # draw the line as a scrolling line.
  459.         @r2_scrolling_shop_status_text_line[id] = [text, speed, width, nil, [x, y], cw,
  460.         x, 0, nil]
  461.         r2_shop_status_scrolling_text_create(id, x, y, text, width)
  462.       end
  463.     end
  464.   end
  465.   #--------------------------------------------------------------------------
  466.   # * Scrolling Help Create. [NEW]
  467.   #--------------------------------------------------------------------------
  468.   def r2_shop_status_scrolling_text_create(id, x, y, text, width)
  469.     # Create a Bitmap instance to draw the text into it.
  470.     line_bitmap = Bitmap.new(@r2_scrolling_shop_status_text_line[id][5] + 24, calc_line_height(text))
  471.     # Save current Window's Bitmap.
  472.     original_contents = contents
  473.     # Set the recently created Bitmap as the Window's Bitmap.
  474.     self.contents = line_bitmap
  475.     # Use the default method to draw the text into it.
  476.     draw_text_ex(24, 0, text)
  477.     # Reset back the Window's Bitmap to the original one.
  478.     self.contents = original_contents
  479.     # Viewport for the Scrolling Line.
  480.     @r2_scrolling_shop_status_text_line[id][8] = Viewport.new(
  481.     x + standard_padding + 24,
  482.     self.y + y + standard_padding,
  483.     width,
  484.     line_bitmap.height
  485.     )
  486.     # Put the recently created Viewport on top of this Window.
  487.     @r2_scrolling_shop_status_text_line[id][8].z = viewport ? viewport.z + 1 : z + 1
  488.     # Create a Plane instance for the scrolling effect.
  489.     @r2_scrolling_shop_status_text_line[id][3] = Plane.new(@r2_scrolling_shop_status_text_line[id][8])
  490.     # Assign the recently created Bitmap (where the line is drawn) to it.
  491.     @r2_scrolling_shop_status_text_line[id][3].bitmap = line_bitmap
  492.     @r2_scrolling_shop_status_text_line[id][3].visible = !visible
  493.   end
  494.   #--------------------------------------------------------------------------
  495.   # * Dispose. [MOD]
  496.   #--------------------------------------------------------------------------
  497.   def dispose
  498.     # Dispose Scrolling Help objects if needed.
  499.     if @r2_scrolling_shop_status_text_line != {}
  500.       @r2_scrolling_shop_status_text_line.each do |key, entry|
  501.         # Disposes Bitmap, Plane and Viewport.
  502.         @r2_scrolling_shop_status_text_line[key][3].bitmap.dispose
  503.         @r2_scrolling_shop_status_text_line[key][3].dispose
  504.         # Prevents executing this method when the Plane (or Viewport) is disposed.
  505.         @r2_scrolling_shop_status_text_line[key][3] = nil
  506.       end
  507.     end
  508.     @r2_scrolling_shop_status_text_line = {}
  509.     # Original method.
  510.     super
  511.   end
  512.   #--------------------------------------------------------------------------
  513.   # * Scrolling Help Dispose. [NEW]
  514.   #--------------------------------------------------------------------------
  515.   def r2_shop_status_text_dispose(id)
  516.     # Disposes Bitmap, Plane and Viewport.
  517.     if !@r2_scrolling_shop_status_text_line[id][3].nil?
  518.       @r2_scrolling_shop_status_text_line[id][3].bitmap.dispose
  519.       @r2_scrolling_shop_status_text_line[id][3].dispose
  520.     end
  521.     # Prevents executing this method when the Plane (or Viewport) is disposed.
  522.     @r2_scrolling_shop_status_text_line[id][3] = nil
  523.   end
  524.   #--------------------------------------------------------------------------
  525.   # * Dispose All values. [NEW]
  526.   #--------------------------------------------------------------------------
  527.   def dispose_shopstatus_list
  528.     if @r2_scrolling_shop_status_text_line != {}
  529.       @r2_scrolling_shop_status_text_line.each do |key, entry|
  530.         r2_shop_status_text_dispose(key)
  531.       end
  532.     end
  533.     @r2_scrolling_shop_status_text_line = {}
  534.   end
  535.   #--------------------------------------------------------------------------
  536.   # * Refresh
  537.   #--------------------------------------------------------------------------
  538.   alias r2_refresh_dispose_scroll_text refresh
  539.   def refresh
  540.     dispose_shopstatus_list
  541.     r2_refresh_dispose_scroll_text
  542.   end
  543. end
  544.  
  545. #==============================================================================
  546. # ** Scene_Shop
  547. #==============================================================================
  548.  
  549. class Scene_Shop < Scene_MenuBase
  550.   #--------------------------------------------------------------------------
  551.   # * Sell [Cancel]
  552.   #--------------------------------------------------------------------------
  553.   alias r2_shop_sell_refresh_cancel on_sell_cancel
  554.   def on_sell_cancel
  555.     r2_shop_sell_refresh_cancel
  556.     @sell_window.refresh
  557.   end
  558. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement