khanhdu

▼ Yanfly Engine Ace - Ace Shop Options v1.01

Dec 3rd, 2017
637
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 52.22 KB | None | 0 0
  1. #==============================================================================
  2. #
  3. # ▼ Yanfly Engine Ace - Ace Shop Options v1.01
  4. # -- Last Updated: 2012.01.05
  5. # -- Level: Normal, Hard
  6. # -- Requires: n/a
  7. #
  8. #==============================================================================
  9.  
  10. $imported = {} if $imported.nil?
  11. $imported["YEA-ShopOptions"] = true
  12.  
  13. #==============================================================================
  14. # ▼ Updates
  15. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  16. # 2012.01.05 - Compatibility Update: Equip Dynamic Stats
  17. # 2012.01.03 - Started Script and Finished.
  18. #
  19. #==============================================================================
  20. # ▼ Introduction
  21. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  22. # The RPG Maker VX Ace shop scene is relatively basic. It provides adequate
  23. # information, but not really enough to let the player know what they're
  24. # actually buying or even selling. This script enables shops to show more than
  25. # just the basic information displayed in RPG Maker VX Ace and even allow for
  26. # custom commands to be inserted.
  27. #
  28. #==============================================================================
  29. # ▼ Instructions
  30. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  31. # To install this script, open up your script editor and copy/paste this script
  32. # to an open slot below ▼ Materials/素材 but above ▼ Main. Remember to save.
  33. #
  34. # -----------------------------------------------------------------------------
  35. # Item Notetags - These notetags go in the item notebox in the database.
  36. # -----------------------------------------------------------------------------
  37. # <image: string>
  38. # Uses a picture from Graphics\Pictures\ of your RPG Maker VX Ace Project's
  39. # directory with the filename of "string" (without the extension) as the image
  40. # picture shown in the Ace Shop Options.
  41. #
  42. # -----------------------------------------------------------------------------
  43. # Weapon Notetags - These notetags go in the weapon notebox in the database.
  44. # -----------------------------------------------------------------------------
  45. # <image: string>
  46. # Uses a picture from Graphics\Pictures\ of your RPG Maker VX Ace Project's
  47. # directory with the filename of "string" (without the extension) as the image
  48. # picture shown in the Ace Shop Options.
  49. #
  50. # -----------------------------------------------------------------------------
  51. # Armour Notetags - These notetags go in the armour notebox in the database.
  52. # -----------------------------------------------------------------------------
  53. # <image: string>
  54. # Uses a picture from Graphics\Pictures\ of your RPG Maker VX Ace Project's
  55. # directory with the filename of "string" (without the extension) as the image
  56. # picture shown in the Ace Shop Options.
  57. #
  58. #==============================================================================
  59. # ▼ Compatibility
  60. # =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
  61. # This script is made strictly for RPG Maker VX Ace. It is highly unlikely that
  62. # it will run with RPG Maker VX without adjusting.
  63. #
  64. #==============================================================================
  65.  
  66. module YEA
  67.   module SHOP
  68.    
  69.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  70.     # - Shop Command Window Settings -
  71.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  72.     # Here, you can adjust the order at which the commands appear (or even
  73.     # remove commands as you see fit). Here's a list of which does what:
  74.     #
  75.     # -------------------------------------------------------------------------
  76.     # :command         Description
  77.     # -------------------------------------------------------------------------
  78.     # :buy             Buys items from the shop. Default.
  79.     # :sell            Sells items top the shop. Default.
  80.     # :cancel          Leaves the shop. Default.
  81.     #
  82.     # :equip           Allows the player to change equipment inside the shop.
  83.     #
  84.     # :totorishop      Requires Kread-EX's Synthesis Shop.
  85.     #
  86.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  87.     COMMANDS =[
  88.       :buy,          # Buys items from the shop. Default.
  89.       :sell,         # Sells items top the shop. Default.
  90.       :equip,        # Allows the player to change equipment inside the shop.
  91.       :totorishop,   # Requires Kread-EX's Synthesis Shop.
  92.       :cancel,       # Leaves the shop. Default.
  93.     # :custom1,      # Custom Command 1.
  94.     # :custom2,      # Custom Command 2.
  95.     ] # Do not remove this.
  96.    
  97.     #--------------------------------------------------------------------------
  98.     # - Shop Custom Commands -
  99.     # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  100.     # For those who use scripts to that may produce unique effects for their
  101.     # shops, use this hash to manage the custom commands for the Shop Command
  102.     # Window. You can disable certain commands or prevent them from appearing
  103.     # by using switches. If you don't wish to bind them to a switch, set the
  104.     # proper switch to 0 for it to have no impact.
  105.     #--------------------------------------------------------------------------
  106.     CUSTOM_SHOP_COMMANDS ={
  107.     # :command => ["Display Name", EnableSwitch, ShowSwitch, Handler Method],
  108.       :equip   => [       "Equip",            0,          0, :command_equip],
  109.       :totorishop => [ "Synthesis",           0,      0, :command_synthshop],
  110.       :custom1 => [ "Custom Name",            0,          0, :command_name1],
  111.       :custom2 => [ "Custom Text",           13,          0, :command_name2],
  112.     } # Do not remove this.
  113.    
  114.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  115.     # - Shop Data Settings -
  116.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  117.     # The shop data window displays information about the item in detail.
  118.     # Adjust the settings below to change the way the data window appears.
  119.     #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
  120.     STATUS_FONT_SIZE = 20       # Font size used for data window.
  121.     MAX_ICONS_DRAWN  = 10       # Maximum number of icons drawn for states.
  122.    
  123.     # The following adjusts the vocabulary used for the data window. Each
  124.     # of the vocabulary settings are self explanatory.
  125.     VOCAB_STATUS ={
  126.       :empty      => "---",          # Text used when nothing is shown.
  127.       :hp_recover => "HP Heal",      # Text used for HP Recovery.
  128.       :mp_recover => "MP Heal",      # Text used for MP Recovery.
  129.       :tp_recover => "TP Heal",      # Text used for TP Recovery.
  130.       :tp_gain    => "TP Gain",      # Text used for TP Gain.
  131.       :applies    => "Applies",      # Text used for applied states and buffs.
  132.       :removes    => "Removes",      # Text used for removed states and buffs.
  133.     } # Do not remove this.
  134.    
  135.   end # SHOP
  136. end # YEA
  137.  
  138. #==============================================================================
  139. # ▼ Editting anything past this point may potentially result in causing
  140. # computer damage, incontinence, explosion of user's head, coma, death, and/or
  141. # halitosis so edit at your own risk.
  142. #==============================================================================
  143.  
  144. module YEA
  145.   module REGEXP
  146.   module BASEITEM
  147.    
  148.     IMAGE    = /<(?:IMAGE|image):[ ](.*)>/i
  149.    
  150.   end # BASEITEM
  151.   end # REGEXP
  152. end # YEA
  153.  
  154. #==============================================================================
  155. # ■ Numeric
  156. #==============================================================================
  157.  
  158. class Numeric
  159.  
  160.   #--------------------------------------------------------------------------
  161.   # new method: group_digits
  162.   #--------------------------------------------------------------------------
  163.   unless $imported["YEA-CoreEngine"]
  164.   def group; return self.to_s; end
  165.   end # $imported["YEA-CoreEngine"]
  166.    
  167. end # Numeric
  168.  
  169. #==============================================================================
  170. # ■ Vocab
  171. #==============================================================================
  172.  
  173. module Vocab
  174.  
  175.   #--------------------------------------------------------------------------
  176.   # new method: self.item_status
  177.   #--------------------------------------------------------------------------
  178.   def self.item_status(type)
  179.     return YEA::SHOP::VOCAB_STATUS[type]
  180.   end
  181.  
  182. end # Vocab
  183.  
  184. #==============================================================================
  185. # ■ DataManager
  186. #==============================================================================
  187.  
  188. module DataManager
  189.  
  190.   #--------------------------------------------------------------------------
  191.   # alias method: load_database
  192.   #--------------------------------------------------------------------------
  193.   class <<self; alias load_database_aso load_database; end
  194.   def self.load_database
  195.     load_database_aso
  196.     load_notetags_aso
  197.   end
  198.  
  199.   #--------------------------------------------------------------------------
  200.   # new method: load_notetags_aso
  201.   #--------------------------------------------------------------------------
  202.   def self.load_notetags_aso
  203.     groups = [$data_items, $data_weapons, $data_armors]
  204.     for group in groups
  205.       for obj in group
  206.         next if obj.nil?
  207.         obj.load_notetags_aso
  208.       end
  209.     end
  210.   end
  211.  
  212. end # DataManager
  213.  
  214. #==============================================================================
  215. # ■ RPG::BaseItem
  216. #==============================================================================
  217.  
  218. class RPG::BaseItem
  219.  
  220.   #--------------------------------------------------------------------------
  221.   # public instance variables
  222.   #--------------------------------------------------------------------------
  223.   attr_accessor :image
  224.  
  225.   #--------------------------------------------------------------------------
  226.   # common cache: load_notetags_aso
  227.   #--------------------------------------------------------------------------
  228.   def load_notetags_aso
  229.     #---
  230.     self.note.split(/[\r\n]+/).each { |line|
  231.       case line
  232.       #---
  233.       when YEA::REGEXP::BASEITEM::IMAGE
  234.         @image = $1.to_s
  235.       end
  236.     } # self.note.split
  237.     #---
  238.   end
  239.  
  240. end # RPG::BaseItem
  241.  
  242. #==============================================================================
  243. # ■ Game_Temp
  244. #==============================================================================
  245.  
  246. class Game_Temp
  247.  
  248.   #--------------------------------------------------------------------------
  249.   # public instance variables
  250.   #--------------------------------------------------------------------------
  251.   attr_accessor :scene_shop_index
  252.   attr_accessor :scene_shop_oy
  253.  
  254. end # Game_Temp
  255.  
  256. #==============================================================================
  257. # ■ Window_ShopCommand
  258. #==============================================================================
  259.  
  260. class Window_ShopCommand < Window_HorzCommand
  261.  
  262.   #--------------------------------------------------------------------------
  263.   # alias method: make_command_list
  264.   #--------------------------------------------------------------------------
  265.   alias window_shopcommand_make_command_list_aso make_command_list
  266.   def make_command_list
  267.     unless SceneManager.scene_is?(Scene_Shop)
  268.       window_shopcommand_make_command_list_aso
  269.       return
  270.     end
  271.     for command in YEA::SHOP::COMMANDS
  272.       case command
  273.       #--- Default Commands ---
  274.       when :buy
  275.         add_command(Vocab::ShopBuy, :buy)
  276.       when :sell
  277.         add_command(Vocab::ShopSell, :sell, !@purchase_only)
  278.       when :cancel
  279.         add_command(Vocab::ShopCancel, :cancel)
  280.       #--- Imported Commands ---
  281.       when :totorishop
  282.         next unless $imported["KRX-SynthesisShop"]
  283.         process_custom_command(command)
  284.       #--- Custom Commands ---
  285.       else
  286.         process_custom_command(command)
  287.       end
  288.     end
  289.   end
  290.  
  291.   #--------------------------------------------------------------------------
  292.   # new method: process_custom_command
  293.   #--------------------------------------------------------------------------
  294.   def process_custom_command(command)
  295.     return unless YEA::SHOP::CUSTOM_SHOP_COMMANDS.include?(command)
  296.     show = YEA::SHOP::CUSTOM_SHOP_COMMANDS[command][2]
  297.     continue = show <= 0 ? true : $game_switches[show]
  298.     return unless continue
  299.     text = YEA::SHOP::CUSTOM_SHOP_COMMANDS[command][0]
  300.     switch = YEA::SHOP::CUSTOM_SHOP_COMMANDS[command][1]
  301.     enabled = switch <= 0 ? true : $game_switches[switch]
  302.     add_command(text, command, enabled)
  303.   end
  304.  
  305.   #--------------------------------------------------------------------------
  306.   # overwrite method: process_ok
  307.   #--------------------------------------------------------------------------
  308.   def process_ok
  309.     $game_temp.scene_shop_index = index
  310.     $game_temp.scene_shop_oy = self.oy
  311.     super
  312.   end
  313.  
  314.   #--------------------------------------------------------------------------
  315.   # overwrite method: window_width
  316.   #--------------------------------------------------------------------------
  317.   def window_width; return 160; end
  318.  
  319.   #--------------------------------------------------------------------------
  320.   # overwrite method: contents_width
  321.   #--------------------------------------------------------------------------
  322.   def contents_width; return width - standard_padding * 2; end
  323.  
  324.   #--------------------------------------------------------------------------
  325.   # overwrite method: contents_height
  326.   #--------------------------------------------------------------------------
  327.   def contents_height
  328.     ch = height - standard_padding * 2
  329.     return [ch - ch % item_height, row_max * item_height].max
  330.   end
  331.  
  332.   #--------------------------------------------------------------------------
  333.   # overwrite method: visible_line_number
  334.   #--------------------------------------------------------------------------
  335.   def visible_line_number; return 4; end
  336.  
  337.   #--------------------------------------------------------------------------
  338.   # overwrite method: col_max
  339.   #--------------------------------------------------------------------------
  340.   def col_max; return 1; end
  341.    
  342.   #--------------------------------------------------------------------------
  343.   # overwrite method: item_rect
  344.   #--------------------------------------------------------------------------
  345.   def item_rect(index)
  346.     rect = Rect.new
  347.     rect.width = item_width
  348.     rect.height = item_height
  349.     rect.x = index % col_max * (item_width + spacing)
  350.     rect.y = index / col_max * item_height
  351.     rect
  352.   end
  353.  
  354.   #--------------------------------------------------------------------------
  355.   # overwrite method: ensure_cursor_visible
  356.   #--------------------------------------------------------------------------
  357.   def ensure_cursor_visible
  358.     self.top_row = row if row < top_row
  359.     self.bottom_row = row if row > bottom_row
  360.   end
  361.    
  362.   #--------------------------------------------------------------------------
  363.   # overwrite method: cursor_down
  364.   #--------------------------------------------------------------------------
  365.   def cursor_down(wrap = false)
  366.     if index < item_max - col_max || (wrap && col_max == 1)
  367.       select((index + col_max) % item_max)
  368.     end
  369.   end
  370.  
  371.   #--------------------------------------------------------------------------
  372.   # overwrite method: cursor_up
  373.   #--------------------------------------------------------------------------
  374.   def cursor_up(wrap = false)
  375.     if index >= col_max || (wrap && col_max == 1)
  376.       select((index - col_max + item_max) % item_max)
  377.     end
  378.   end
  379.  
  380.   #--------------------------------------------------------------------------
  381.   # overwrite method: process_pageup
  382.   #--------------------------------------------------------------------------
  383.   def process_pageup
  384.     Sound.play_cursor
  385.     Input.update
  386.     deactivate
  387.     call_handler(:pageup)
  388.   end
  389.  
  390.   #--------------------------------------------------------------------------
  391.   # overwrite method: process_pagedown
  392.   #--------------------------------------------------------------------------
  393.   def process_pagedown
  394.     Sound.play_cursor
  395.     Input.update
  396.     deactivate
  397.     call_handler(:pagedown)
  398.   end
  399.  
  400. end # Window_ShopCommand
  401.  
  402. #==============================================================================
  403. # ■ Window_ShopCategory
  404. #==============================================================================
  405.  
  406. class Window_ShopCategory < Window_Command
  407.  
  408.   #--------------------------------------------------------------------------
  409.   # public instance variables
  410.   #--------------------------------------------------------------------------
  411.   attr_reader   :item_window
  412.  
  413.   #--------------------------------------------------------------------------
  414.   # initialize
  415.   #--------------------------------------------------------------------------
  416.   def initialize
  417.     super(0, 0)
  418.   end
  419.  
  420.   #--------------------------------------------------------------------------
  421.   # window_width
  422.   #--------------------------------------------------------------------------
  423.   def window_width; return 160; end
  424.  
  425.   #--------------------------------------------------------------------------
  426.   # visible_line_number
  427.   #--------------------------------------------------------------------------
  428.   def visible_line_number; return 4; end
  429.  
  430.   #--------------------------------------------------------------------------
  431.   # update
  432.   #--------------------------------------------------------------------------
  433.   def update
  434.     super
  435.     @item_window.category = current_symbol if @item_window
  436.   end
  437.  
  438.   #--------------------------------------------------------------------------
  439.   # make_command_list
  440.   #--------------------------------------------------------------------------
  441.   def make_command_list
  442.     add_command(Vocab::item,     :item)
  443.     add_command(Vocab::weapon,   :weapon)
  444.     add_command(Vocab::armor,    :armor)
  445.     add_command(Vocab::key_item, :key_item)
  446.   end
  447.  
  448.   #--------------------------------------------------------------------------
  449.   # item_window=
  450.   #--------------------------------------------------------------------------
  451.   def item_window=(item_window)
  452.     @item_window = item_window
  453.     update
  454.   end
  455.  
  456. end# Window_ShopCategory
  457.  
  458. #==============================================================================
  459. # ■ Window_ShopBuy
  460. #==============================================================================
  461.  
  462. class Window_ShopBuy < Window_Selectable
  463.  
  464.   #--------------------------------------------------------------------------
  465.   # overwrite method: item
  466.   #--------------------------------------------------------------------------
  467.   def item
  468.     return index < 0 ? nil : @data[index]
  469.   end
  470.  
  471.   #--------------------------------------------------------------------------
  472.   # overwrite method: window_width
  473.   #--------------------------------------------------------------------------
  474.   def window_width
  475.     return Graphics.width - (Graphics.width * 2 / 5)
  476.   end
  477.  
  478.   #--------------------------------------------------------------------------
  479.   # overwrite method: draw_item
  480.   #--------------------------------------------------------------------------
  481.   def draw_item(index)
  482.     item = @data[index]
  483.     return if item.nil?
  484.     rect = item_rect(index)
  485.     draw_item_name(item, rect.x, rect.y, enable?(item), rect.width-24)
  486.     rect.width -= 4
  487.     contents.font.size = YEA::LIMIT::SHOP_FONT if $imported["YEA-AdjustLimits"]
  488.     draw_text(rect, price(item).group, 2)
  489.     reset_font_settings
  490.   end
  491.  
  492. end # Window_ShopBuy
  493.  
  494. #==============================================================================
  495. # ■ Window_ShopSell
  496. #==============================================================================
  497.  
  498. class Window_ShopSell < Window_ItemList
  499.  
  500.   #--------------------------------------------------------------------------
  501.   # overwrite method: initialize
  502.   #--------------------------------------------------------------------------
  503.   def initialize(dx, dy, dw, dh)
  504.     dw = Graphics.width - (Graphics.width * 2 / 5)
  505.     super(dx, dy, dw, dh)
  506.   end
  507.  
  508.   #--------------------------------------------------------------------------
  509.   # overwrite method: col_max
  510.   #--------------------------------------------------------------------------
  511.   def col_max; return 1; end
  512.  
  513.   #--------------------------------------------------------------------------
  514.   # new method: status_window=
  515.   #--------------------------------------------------------------------------
  516.   def status_window= (window)
  517.     @status_window = window
  518.     call_update_help
  519.   end
  520.  
  521.   #--------------------------------------------------------------------------
  522.   # new method: update_help
  523.   #--------------------------------------------------------------------------
  524.   def update_help
  525.     super
  526.     @status_window.item = item if @status_window
  527.   end
  528.  
  529. end # Window_ShopSell
  530.  
  531. #==============================================================================
  532. # ■ Window_ShopStatus
  533. #==============================================================================
  534.  
  535. class Window_ShopStatus < Window_Base
  536.  
  537.   #--------------------------------------------------------------------------
  538.   # alias method: initialize
  539.   #--------------------------------------------------------------------------
  540.   alias window_shopstatus_initialize_aso initialize
  541.   def initialize(dx, dy, dw, dh)
  542.     dh = Graphics.height - SceneManager.scene.command_window.y
  543.     dh -= SceneManager.scene.command_window.height + fitting_height(1)
  544.     dy += fitting_height(1)
  545.     window_shopstatus_initialize_aso(dx, dy, dw, dh)
  546.   end
  547.  
  548.   #--------------------------------------------------------------------------
  549.   # overwrite method: page_size
  550.   #--------------------------------------------------------------------------
  551.   def page_size
  552.     n = contents.height - line_height
  553.     n /= line_height
  554.     return n
  555.   end
  556.  
  557.   #--------------------------------------------------------------------------
  558.   # overwrite method: update_page
  559.   #--------------------------------------------------------------------------
  560.   def update_page
  561.     return unless visible
  562.     return if @item.nil?
  563.     return if @item.is_a?(RPG::Item)
  564.     return unless Input.trigger?(:A)
  565.     return unless page_max > 1
  566.     Sound.play_cursor
  567.     @page_index = (@page_index + 1) % page_max
  568.     refresh
  569.   end
  570.  
  571.   #--------------------------------------------------------------------------
  572.   # overwrite method: draw_equip_info
  573.   #--------------------------------------------------------------------------
  574.   def draw_equip_info(dx, dy)
  575.     dy -= line_height
  576.     status_members.each_with_index do |actor, i|
  577.       draw_actor_equip_info(dx, dy + line_height * i, actor)
  578.     end
  579.   end
  580.  
  581.   #--------------------------------------------------------------------------
  582.   # overwrite method: draw_actor_equip_info
  583.   #--------------------------------------------------------------------------
  584.   def draw_actor_equip_info(dx, dy, actor)
  585.     enabled = actor.equippable?(@item)
  586.     change_color(normal_color, enabled)
  587.     draw_text(dx, dy, contents.width, line_height, actor.name)
  588.     item1 = current_equipped_item(actor, @item.etype_id)
  589.     draw_actor_param_change(dx, dy, actor, item1) if enabled
  590.   end
  591.  
  592. end # Window_ShopStatus
  593.  
  594. #==============================================================================
  595. # ■ Window_ShopNumber
  596. #==============================================================================
  597.  
  598. class Window_ShopNumber < Window_Selectable
  599.  
  600.   #--------------------------------------------------------------------------
  601.   # alias method: initialize
  602.   #--------------------------------------------------------------------------
  603.   alias window_shopnumber_initialize_aso initialize
  604.   def initialize(dx, dy, dh)
  605.     dh = Graphics.height - SceneManager.scene.command_window.y
  606.     dh -= SceneManager.scene.command_window.height
  607.     window_shopnumber_initialize_aso(dx, dy, dh)
  608.   end
  609.  
  610.   #--------------------------------------------------------------------------
  611.   # overwrite method: window_width
  612.   #--------------------------------------------------------------------------
  613.   def window_width
  614.     return Graphics.width - (Graphics.width * 2 / 5)
  615.   end
  616.  
  617.   #--------------------------------------------------------------------------
  618.   # overwrite method: figures
  619.   #--------------------------------------------------------------------------
  620.   def figures
  621.     maximum = @max.nil? ? 2 : @max.group.size
  622.     return maximum
  623.   end
  624.  
  625.   #--------------------------------------------------------------------------
  626.   # overwrite method: refresh
  627.   #--------------------------------------------------------------------------
  628.   def refresh
  629.     contents.clear
  630.     reset_font_settings
  631.     draw_item_name(@item, 0, item_y, true, contents.width - 24)
  632.     draw_number
  633.     draw_total_price
  634.   end
  635.  
  636.   #--------------------------------------------------------------------------
  637.   # overwrite method: item_y
  638.   #--------------------------------------------------------------------------
  639.   def item_y
  640.     return contents_height / 2 - line_height * 5 / 2
  641.   end
  642.  
  643.   #--------------------------------------------------------------------------
  644.   # overwrite method: price_y
  645.   #--------------------------------------------------------------------------
  646.   def price_y
  647.     return item_y + line_height * 2
  648.   end
  649.  
  650.   #--------------------------------------------------------------------------
  651.   # overwrite method: draw_total_price
  652.   #--------------------------------------------------------------------------
  653.   def draw_total_price
  654.     dw = contents_width - 8
  655.     dy = price_y
  656.     draw_currency_value($game_party.gold, @currency_unit, 4, dy, dw)
  657.     dy += line_height
  658.     draw_horz_line(dy)
  659.     value = @price * @number
  660.     value *= -1 if buy?
  661.     draw_currency_value(value, @currency_unit, 4, dy, dw)
  662.     dy += line_height
  663.     value = $game_party.gold + value
  664.     value = [[value, 0].max, $game_party.max_gold].min
  665.     draw_currency_value(value, @currency_unit, 4, dy, dw)
  666.   end
  667.  
  668.   #--------------------------------------------------------------------------
  669.   # new method: buy?
  670.   #--------------------------------------------------------------------------
  671.   def buy?
  672.     return SceneManager.scene.command_window.current_symbol == :buy
  673.   end
  674.  
  675.   #--------------------------------------------------------------------------
  676.   # new method: sell?
  677.   #--------------------------------------------------------------------------
  678.   def sell?
  679.     return SceneManager.scene.command_window.current_symbol == :sell
  680.   end
  681.  
  682.   #--------------------------------------------------------------------------
  683.   # new method: draw_horz_line
  684.   #--------------------------------------------------------------------------
  685.   def draw_horz_line(dy)
  686.     line_y = dy + line_height - 4
  687.     contents.fill_rect(4, line_y, contents_width-8, 3, Font.default_out_color)
  688.     contents.fill_rect(5, line_y+1, contents_width-10, 1, normal_color)
  689.   end
  690.  
  691.   #--------------------------------------------------------------------------
  692.   # alias method: update_number
  693.   #--------------------------------------------------------------------------
  694.   alias window_shopnumber_update_number_aso update_number
  695.   def update_number
  696.     window_shopnumber_update_number_aso
  697.     change_number(-@max) if Input.repeat?(:L)
  698.     change_number(@max)  if Input.repeat?(:R)
  699.   end
  700.  
  701. end # Window_ShopNumber
  702.  
  703. #==============================================================================
  704. # ■ Window_ShopData
  705. #==============================================================================
  706.  
  707. class Window_ShopData < Window_Base
  708.  
  709.   #--------------------------------------------------------------------------
  710.   # initialize
  711.   #--------------------------------------------------------------------------
  712.   def initialize(dx, dy, item_window)
  713.     super(dx, dy, Graphics.width - dx, fitting_height(4))
  714.     @item_window = item_window
  715.     @item = nil
  716.     refresh
  717.   end
  718.  
  719.   #--------------------------------------------------------------------------
  720.   # item_window=
  721.   #--------------------------------------------------------------------------
  722.   def item_window= (window)
  723.     @item_window = window
  724.     update_item(@item_window.item)
  725.   end
  726.  
  727.   #--------------------------------------------------------------------------
  728.   # update
  729.   #--------------------------------------------------------------------------
  730.   def update
  731.     super
  732.     update_item(@item_window.item)
  733.   end
  734.  
  735.   #--------------------------------------------------------------------------
  736.   # update_item
  737.   #--------------------------------------------------------------------------
  738.   def update_item(item)
  739.     return if @item == item
  740.     @item = item
  741.     refresh
  742.   end
  743.  
  744.   #--------------------------------------------------------------------------
  745.   # refresh
  746.   #--------------------------------------------------------------------------
  747.   def refresh
  748.     contents.clear
  749.     reset_font_settings
  750.     return draw_empty if @item.nil?
  751.     contents.font.size = YEA::SHOP::STATUS_FONT_SIZE
  752.     draw_item_image
  753.     draw_item_stats
  754.     draw_item_effects
  755.   end
  756.  
  757.   #--------------------------------------------------------------------------
  758.   # draw_empty
  759.   #--------------------------------------------------------------------------
  760.   def draw_empty
  761.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  762.     rect = Rect.new(1, 1, 94, 94)
  763.     contents.fill_rect(rect, colour)
  764.     dx = 96; dy = 0
  765.     dw = (contents.width - 96) / 2
  766.     for i in 0...8
  767.       draw_background_box(dx, dy, dw)
  768.       dx = dx >= 96 + dw ? 96 : 96 + dw
  769.       dy += line_height if dx == 96
  770.     end
  771.   end
  772.  
  773.   #--------------------------------------------------------------------------
  774.   # draw_background_box
  775.   #--------------------------------------------------------------------------
  776.   def draw_background_box(dx, dy, dw)
  777.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  778.     rect = Rect.new(dx+1, dy+1, dw-2, line_height-2)
  779.     contents.fill_rect(rect, colour)
  780.   end
  781.  
  782.   #--------------------------------------------------------------------------
  783.   # draw_item_image
  784.   #--------------------------------------------------------------------------
  785.   def draw_item_image
  786.     colour = Color.new(0, 0, 0, translucent_alpha/2)
  787.     rect = Rect.new(1, 1, 94, 94)
  788.     contents.fill_rect(rect, colour)
  789.     if @item.image.nil?
  790.       icon_index = @item.icon_index
  791.       bitmap = Cache.system("Iconset")
  792.       rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)
  793.       target = Rect.new(0, 0, 96, 96)
  794.       contents.stretch_blt(target, bitmap, rect)
  795.     else
  796.       bitmap = Cache.picture(@item.image)
  797.       contents.blt(0, 0, bitmap, bitmap.rect, 255)
  798.     end
  799.   end
  800.  
  801.   #--------------------------------------------------------------------------
  802.   # draw_item_stats
  803.   #--------------------------------------------------------------------------
  804.   def draw_item_stats
  805.     return unless @item.is_a?(RPG::Weapon) || @item.is_a?(RPG::Armor)
  806.     dx = 96; dy = 0
  807.     dw = (contents.width - 96) / 2
  808.     for i in 0...8
  809.       draw_equip_param(i, dx, dy, dw)
  810.       dx = dx >= 96 + dw ? 96 : 96 + dw
  811.       dy += line_height if dx == 96
  812.     end
  813.   end
  814.  
  815.   #--------------------------------------------------------------------------
  816.   # draw_equip_param
  817.   #--------------------------------------------------------------------------
  818.   def draw_equip_param(param_id, dx, dy, dw)
  819.     draw_background_box(dx, dy, dw)
  820.     change_color(system_color)
  821.     draw_text(dx+4, dy, dw-8, line_height, Vocab::param(param_id))
  822.     if $imported["YEA-EquipDynamicStats"]
  823.       draw_percentage_param(param_id, dx, dy, dw)
  824.     else
  825.       draw_set_param(param_id, dx, dy, dw)
  826.     end
  827.   end
  828.  
  829.   #--------------------------------------------------------------------------
  830.   # draw_percentage_param
  831.   #--------------------------------------------------------------------------
  832.   def draw_percentage_param(param_id, dx, dy, dw)
  833.     if @item.per_params[param_id] != 0 && @item.params[param_id] != 0
  834.       text = draw_set_param(param_id, dx, dy, dw)
  835.       dw -= text_size(text).width
  836.       draw_percent_param(param_id, dx, dy, dw)
  837.     elsif @item.per_params[param_id] != 0 && @item.params[param_id] == 0
  838.       draw_percent_param(param_id, dx, dy, dw)
  839.     else
  840.       draw_set_param(param_id, dx, dy, dw)
  841.     end
  842.   end
  843.  
  844.   #--------------------------------------------------------------------------
  845.   # draw_set_param
  846.   #--------------------------------------------------------------------------
  847.   def draw_set_param(param_id, dx, dy, dw)
  848.     value = @item.params[param_id]
  849.     if $imported["YEA-EquipDynamicStats"] && @item.var_params[param_id] > 0
  850.       value += $game_variables[@item.var_params[param_id]] rescue 0
  851.     end
  852.     change_color(param_change_color(value), value != 0)
  853.     text = value.group
  854.     text = "+" + text if value > 0
  855.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  856.     return text
  857.   end
  858.  
  859.   #--------------------------------------------------------------------------
  860.   # draw_percent_param
  861.   #--------------------------------------------------------------------------
  862.   def draw_percent_param(param_id, dx, dy, dw)
  863.     value = @item.per_params[param_id]
  864.     change_color(param_change_color(value))
  865.     text = (@item.per_params[param_id] * 100).to_i.group + "%"
  866.     text = "+" + text if @item.per_params[param_id] > 0
  867.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  868.     return text
  869.   end
  870.  
  871.   #--------------------------------------------------------------------------
  872.   # draw_item_effects
  873.   #--------------------------------------------------------------------------
  874.   def draw_item_effects
  875.     return unless @item.is_a?(RPG::Item)
  876.     dx = 96; dy = 0
  877.     dw = (contents.width - 96) / 2
  878.     draw_hp_recover(dx, dy + line_height * 0, dw)
  879.     draw_mp_recover(dx, dy + line_height * 1, dw)
  880.     draw_tp_recover(dx + dw, dy + line_height * 0, dw)
  881.     draw_tp_gain(dx + dw, dy + line_height * 1, dw)
  882.     dw = contents.width - 96
  883.     draw_applies(dx, dy + line_height * 2, dw)
  884.     draw_removes(dx, dy + line_height * 3, dw)
  885.   end
  886.  
  887.   #--------------------------------------------------------------------------
  888.   # draw_hp_recover
  889.   #--------------------------------------------------------------------------
  890.   def draw_hp_recover(dx, dy, dw)
  891.     draw_background_box(dx, dy, dw)
  892.     change_color(system_color)
  893.     draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:hp_recover))
  894.     per = 0
  895.     set = 0
  896.     for effect in @item.effects
  897.       next unless effect.code == 11
  898.       per += (effect.value1 * 100).to_i
  899.       set += effect.value2.to_i
  900.     end
  901.     if per != 0 && set != 0
  902.       change_color(param_change_color(set))
  903.       text = set > 0 ? sprintf("+%s", set.group) : set.group
  904.       draw_text(dx+4, dy, dw-8, line_height, text, 2)
  905.       dw -= text_size(text).width
  906.       change_color(param_change_color(per))
  907.       text = per > 0 ? sprintf("+%s%%", per.group) : sprintf("%s%%", per.group)
  908.       draw_text(dx+4, dy, dw-8, line_height, text, 2)
  909.       return
  910.     elsif per != 0
  911.       change_color(param_change_color(per))
  912.       text = per > 0 ? sprintf("+%s%%", per.group) : sprintf("%s%%", per.group)
  913.     elsif set != 0
  914.       change_color(param_change_color(set))
  915.       text = set > 0 ? sprintf("+%s", set.group) : set.group
  916.     else
  917.       change_color(normal_color, false)
  918.       text = Vocab::item_status(:empty)
  919.     end
  920.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  921.   end
  922.  
  923.   #--------------------------------------------------------------------------
  924.   # draw_mp_recover
  925.   #--------------------------------------------------------------------------
  926.   def draw_mp_recover(dx, dy, dw)
  927.     draw_background_box(dx, dy, dw)
  928.     change_color(system_color)
  929.     draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:mp_recover))
  930.     per = 0
  931.     set = 0
  932.     for effect in @item.effects
  933.       next unless effect.code == 12
  934.       per += (effect.value1 * 100).to_i
  935.       set += effect.value2.to_i
  936.     end
  937.     if per != 0 && set != 0
  938.       change_color(param_change_color(set))
  939.       text = set > 0 ? sprintf("+%s", set.group) : set.group
  940.       draw_text(dx+4, dy, dw-8, line_height, text, 2)
  941.       dw -= text_size(text).width
  942.       change_color(param_change_color(per))
  943.       text = per > 0 ? sprintf("+%s%%", per.group) : sprintf("%s%%", per.group)
  944.       draw_text(dx+4, dy, dw-8, line_height, text, 2)
  945.       return
  946.     elsif per != 0
  947.       change_color(param_change_color(per))
  948.       text = per > 0 ? sprintf("+%s%%", per.group) : sprintf("%s%%", per.group)
  949.     elsif set != 0
  950.       change_color(param_change_color(set))
  951.       text = set > 0 ? sprintf("+%s", set.group) : set.group
  952.     else
  953.       change_color(normal_color, false)
  954.       text = Vocab::item_status(:empty)
  955.     end
  956.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  957.   end
  958.  
  959.   #--------------------------------------------------------------------------
  960.   # draw_tp_recover
  961.   #--------------------------------------------------------------------------
  962.   def draw_tp_recover(dx, dy, dw)
  963.     draw_background_box(dx, dy, dw)
  964.     change_color(system_color)
  965.     draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:tp_recover))
  966.     set = 0
  967.     for effect in @item.effects
  968.       next unless effect.code == 13
  969.       set += effect.value1.to_i
  970.     end
  971.     if set != 0
  972.       change_color(param_change_color(set))
  973.       text = set > 0 ? sprintf("+%s", set.group) : set.group
  974.     else
  975.       change_color(normal_color, false)
  976.       text = Vocab::item_status(:empty)
  977.     end
  978.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  979.   end
  980.  
  981.   #--------------------------------------------------------------------------
  982.   # draw_tp_gain
  983.   #--------------------------------------------------------------------------
  984.   def draw_tp_gain(dx, dy, dw)
  985.     draw_background_box(dx, dy, dw)
  986.     change_color(system_color)
  987.     draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:tp_gain))
  988.     set = @item.tp_gain
  989.     if set != 0
  990.       change_color(param_change_color(set))
  991.       text = set > 0 ? sprintf("+%s", set.group) : set.group
  992.     else
  993.       change_color(normal_color, false)
  994.       text = Vocab::item_status(:empty)
  995.     end
  996.     draw_text(dx+4, dy, dw-8, line_height, text, 2)
  997.   end
  998.  
  999.   #--------------------------------------------------------------------------
  1000.   # draw_applies
  1001.   #--------------------------------------------------------------------------
  1002.   def draw_applies(dx, dy, dw)
  1003.     draw_background_box(dx, dy, dw)
  1004.     change_color(system_color)
  1005.     draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:applies))
  1006.     icons = []
  1007.     for effect in @item.effects
  1008.       case effect.code
  1009.       when 21
  1010.         next unless effect.value1 > 0
  1011.         next if $data_states[effect.value1].nil?
  1012.         icons.push($data_states[effect.data_id].icon_index)
  1013.       when 31
  1014.         icons.push($game_actors[1].buff_icon_index(1, effect.data_id))
  1015.       when 32
  1016.         icons.push($game_actors[1].buff_icon_index(-1, effect.data_id))
  1017.       end
  1018.       icons.delete(0)
  1019.       break if icons.size >= YEA::SHOP::MAX_ICONS_DRAWN
  1020.     end
  1021.     draw_icons(dx, dy, dw, icons)
  1022.   end
  1023.  
  1024.   #--------------------------------------------------------------------------
  1025.   # draw_removes
  1026.   #--------------------------------------------------------------------------
  1027.   def draw_removes(dx, dy, dw)
  1028.     draw_background_box(dx, dy, dw)
  1029.     change_color(system_color)
  1030.     draw_text(dx+4, dy, dw-8, line_height, Vocab::item_status(:removes))
  1031.     icons = []
  1032.     for effect in @item.effects
  1033.       case effect.code
  1034.       when 22
  1035.         next unless effect.value1 > 0
  1036.         next if $data_states[effect.value1].nil?
  1037.         icons.push($data_states[effect.data_id].icon_index)
  1038.       when 33
  1039.         icons.push($game_actors[1].buff_icon_index(1, effect.data_id))
  1040.       when 34
  1041.         icons.push($game_actors[1].buff_icon_index(-1, effect.data_id))
  1042.       end
  1043.       icons.delete(0)
  1044.       break if icons.size >= YEA::SHOP::MAX_ICONS_DRAWN
  1045.     end
  1046.     draw_icons(dx, dy, dw, icons)
  1047.   end
  1048.  
  1049.   #--------------------------------------------------------------------------
  1050.   # draw_icons
  1051.   #--------------------------------------------------------------------------
  1052.   def draw_icons(dx, dy, dw, icons)
  1053.     dx += dw - 4
  1054.     dx -= icons.size * 24
  1055.     for icon_id in icons
  1056.       draw_icon(icon_id, dx, dy)
  1057.       dx += 24
  1058.     end
  1059.     if icons.size == 0
  1060.       change_color(normal_color, false)
  1061.       text = Vocab::item_status(:empty)
  1062.       draw_text(4, dy, contents.width-8, line_height, text, 2)
  1063.     end
  1064.   end
  1065.  
  1066. end # Window_ShopData
  1067.  
  1068. #==============================================================================
  1069. # ■ Scene_Shop
  1070. #==============================================================================
  1071.  
  1072. class Scene_Shop < Scene_MenuBase
  1073.  
  1074.   #--------------------------------------------------------------------------
  1075.   # public instance variables
  1076.   #--------------------------------------------------------------------------
  1077.   attr_accessor :command_window
  1078.  
  1079.   #--------------------------------------------------------------------------
  1080.   # alias method: start
  1081.   #--------------------------------------------------------------------------
  1082.   alias scene_shop_start_aso start
  1083.   def start
  1084.     scene_shop_start_aso
  1085.     create_actor_window
  1086.     create_data_window
  1087.     clean_up_settings
  1088.     relocate_windows
  1089.   end
  1090.  
  1091.   #--------------------------------------------------------------------------
  1092.   # overwrite method: return_scene
  1093.   #--------------------------------------------------------------------------
  1094.   def return_scene
  1095.     $game_temp.scene_shop_index = nil
  1096.     $game_temp.scene_shop_oy = nil
  1097.     super
  1098.   end
  1099.  
  1100.   #--------------------------------------------------------------------------
  1101.   # alias method: create_gold_window
  1102.   #--------------------------------------------------------------------------
  1103.   alias scene_shop_create_gold_window_aso create_gold_window
  1104.   def create_gold_window
  1105.     scene_shop_create_gold_window_aso
  1106.     @gold_window.width = Graphics.width * 2 / 5
  1107.     @gold_window.create_contents
  1108.     @gold_window.refresh
  1109.     @gold_window.x = Graphics.width - @gold_window.width
  1110.   end
  1111.  
  1112.   #--------------------------------------------------------------------------
  1113.   # alias method: create_command_window
  1114.   #--------------------------------------------------------------------------
  1115.   alias scene_shop_create_command_window_aso create_command_window
  1116.   def create_command_window
  1117.     scene_shop_create_command_window_aso
  1118.     return unless SceneManager.scene_is?(Scene_Shop)
  1119.     if !$game_temp.scene_shop_index.nil?
  1120.       @command_window.select($game_temp.scene_shop_index)
  1121.       @command_window.oy = $game_temp.scene_shop_oy
  1122.     end
  1123.     $game_temp.scene_shop_index = nil
  1124.     $game_temp.scene_shop_oy = nil
  1125.     @command_window.set_handler(:equip, method(:command_equip))
  1126.     process_custom_shop_commands
  1127.   end
  1128.  
  1129.   #--------------------------------------------------------------------------
  1130.   # new method: process_custom_shop_commands
  1131.   #--------------------------------------------------------------------------
  1132.   def process_custom_shop_commands
  1133.     for command in YEA::SHOP::COMMANDS
  1134.       next unless YEA::SHOP::CUSTOM_SHOP_COMMANDS.include?(command)
  1135.       called_method = YEA::SHOP::CUSTOM_SHOP_COMMANDS[command][3]
  1136.       @command_window.set_handler(command, method(called_method))
  1137.     end
  1138.   end
  1139.  
  1140.   #--------------------------------------------------------------------------
  1141.   # alias method: create_dummy_window
  1142.   #--------------------------------------------------------------------------
  1143.   alias scene_shop_create_dummy_window_aso create_dummy_window
  1144.   def create_dummy_window
  1145.     scene_shop_create_dummy_window_aso
  1146.     @gold_window.y = @dummy_window.y
  1147.     @dummy_window.opacity = 0
  1148.   end
  1149.  
  1150.   #--------------------------------------------------------------------------
  1151.   # overwrite method: create_category_window
  1152.   #--------------------------------------------------------------------------
  1153.   def create_category_window
  1154.     @category_window = Window_ShopCategory.new
  1155.     @category_window.viewport = @viewport
  1156.     @category_window.help_window = @help_window
  1157.     @category_window.y = @command_window.y
  1158.     @category_window.deactivate
  1159.     @category_window.x = Graphics.width
  1160.     @category_window.set_handler(:ok,     method(:on_category_ok))
  1161.     @category_window.set_handler(:cancel, method(:on_category_cancel))
  1162.   end
  1163.  
  1164.   #--------------------------------------------------------------------------
  1165.   # new method: create_actor_window
  1166.   #--------------------------------------------------------------------------
  1167.   def create_actor_window
  1168.     @actor_window = Window_MenuActor.new
  1169.     @actor_window.set_handler(:ok,     method(:on_actor_ok))
  1170.     @actor_window.set_handler(:cancel, method(:on_actor_cancel))
  1171.   end
  1172.  
  1173.   #--------------------------------------------------------------------------
  1174.   # new method: create_data_window
  1175.   #--------------------------------------------------------------------------
  1176.   def create_data_window
  1177.     wx = @command_window.width
  1178.     wy = @command_window.y
  1179.     @data_window = Window_ShopData.new(wx, wy, @buy_window)
  1180.     @data_window.viewport = @viewport
  1181.   end
  1182.  
  1183.   #--------------------------------------------------------------------------
  1184.   # new method: clean_up_settings
  1185.   #--------------------------------------------------------------------------
  1186.   def clean_up_settings
  1187.     @dummy_window.create_contents
  1188.     @buy_window.show
  1189.     @buy_window.unselect
  1190.     @buy_window.money = money
  1191.     @last_buy_index = 0
  1192.     @status_window.show
  1193.     @sell_window.show
  1194.     @sell_window.x = Graphics.width
  1195.     @sell_window.status_window = @status_window
  1196.   end
  1197.  
  1198.   #--------------------------------------------------------------------------
  1199.   # new method: relocate_windows
  1200.   #--------------------------------------------------------------------------
  1201.   def relocate_windows
  1202.     return unless $imported["YEA-AceMenuEngine"]
  1203.     case Menu.help_window_location
  1204.     when 0 # Top
  1205.       @help_window.y = 0
  1206.       @command_window.y = @help_window.height
  1207.       @buy_window.y = @command_window.y + @command_window.height
  1208.     when 1 # Middle
  1209.       @command_window.y = 0
  1210.       @help_window.y = @command_window.height
  1211.       @buy_window.y = @help_window.y + @help_window.height
  1212.     else # Bottom
  1213.       @command_window.y = 0
  1214.       @buy_window.y = @command_window.height
  1215.       @help_window.y = @buy_window.y + @buy_window.height
  1216.     end
  1217.     @category_window.y = @command_window.y
  1218.     @data_window.y = @command_window.y
  1219.     @gold_window.y = @buy_window.y
  1220.     @sell_window.y = @buy_window.y
  1221.     @number_window.y = @buy_window.y
  1222.     @status_window.y = @gold_window.y + @gold_window.height
  1223.   end
  1224.  
  1225.   #--------------------------------------------------------------------------
  1226.   # new method: show_sub_window
  1227.   #--------------------------------------------------------------------------
  1228.   def show_sub_window(window)
  1229.     width_remain = Graphics.width - window.width
  1230.     window.x = width_remain
  1231.     @viewport.rect.x = @viewport.ox = 0
  1232.     @viewport.rect.width = width_remain
  1233.     window.show.activate
  1234.   end
  1235.  
  1236.   #--------------------------------------------------------------------------
  1237.   # new method: hide_sub_window
  1238.   #--------------------------------------------------------------------------
  1239.   def hide_sub_window(window)
  1240.     @viewport.rect.x = @viewport.ox = 0
  1241.     @viewport.rect.width = Graphics.width
  1242.     window.hide.deactivate
  1243.     @command_window.activate
  1244.   end
  1245.  
  1246.   #--------------------------------------------------------------------------
  1247.   # new method: on_actor_ok
  1248.   #--------------------------------------------------------------------------
  1249.   def on_actor_ok
  1250.     case @command_window.current_symbol
  1251.     when :equip
  1252.       Sound.play_ok
  1253.       $game_party.menu_actor = $game_party.members[@actor_window.index]
  1254.       SceneManager.call(Scene_Equip)
  1255.     end
  1256.   end
  1257.  
  1258.   #--------------------------------------------------------------------------
  1259.   # new method: on_actor_cancel
  1260.   #--------------------------------------------------------------------------
  1261.   def on_actor_cancel
  1262.     hide_sub_window(@actor_window)
  1263.   end
  1264.  
  1265.   #--------------------------------------------------------------------------
  1266.   # alias method: activate_sell_window
  1267.   #--------------------------------------------------------------------------
  1268.   alias scene_shop_activate_sell_window_aso activate_sell_window
  1269.   def activate_sell_window
  1270.     scene_shop_activate_sell_window_aso
  1271.     @status_window.show
  1272.   end
  1273.  
  1274.   #--------------------------------------------------------------------------
  1275.   # alias method: command_buy
  1276.   #--------------------------------------------------------------------------
  1277.   alias scene_shop_command_buy_aso command_buy
  1278.   def command_buy
  1279.     scene_shop_command_buy_aso
  1280.     @buy_window.select(@last_buy_index)
  1281.     @data_window.item_window = @buy_window
  1282.   end
  1283.  
  1284.   #--------------------------------------------------------------------------
  1285.   # overwrite method: command_sell
  1286.   #--------------------------------------------------------------------------
  1287.   def command_sell
  1288.     @dummy_window.hide
  1289.     @category_window.activate
  1290.     @category_window.x = 0
  1291.     @command_window.x = Graphics.width
  1292.     @sell_window.x = 0
  1293.     @buy_window.x = Graphics.width
  1294.     @sell_window.unselect
  1295.     @sell_window.refresh
  1296.     @data_window.item_window = @sell_window
  1297.   end
  1298.  
  1299.   #--------------------------------------------------------------------------
  1300.   # alias method: on_buy_cancel
  1301.   #--------------------------------------------------------------------------
  1302.   alias scene_shop_on_buy_cancel_aso on_buy_cancel
  1303.   def on_buy_cancel
  1304.     @last_buy_index = @buy_window.index
  1305.     @buy_window.unselect
  1306.     scene_shop_on_buy_cancel_aso
  1307.     @buy_window.show
  1308.     @status_window.show
  1309.   end
  1310.  
  1311.   #--------------------------------------------------------------------------
  1312.   # alias method: on_sell_ok
  1313.   #--------------------------------------------------------------------------
  1314.   alias scene_shop_on_sell_ok_aso on_sell_ok
  1315.   def on_sell_ok
  1316.     scene_shop_on_sell_ok_aso
  1317.     @category_window.show
  1318.   end
  1319.  
  1320.   #--------------------------------------------------------------------------
  1321.   # overwrite method: on_category_cancel
  1322.   #--------------------------------------------------------------------------
  1323.   def on_category_cancel
  1324.     @command_window.activate
  1325.     @dummy_window.show
  1326.     @category_window.x = Graphics.width
  1327.     @command_window.x = 0
  1328.     @sell_window.x = Graphics.width
  1329.     @buy_window.money = money
  1330.     @buy_window.x = 0
  1331.   end
  1332.  
  1333.   #--------------------------------------------------------------------------
  1334.   # new method: current_command_window_symbol
  1335.   #--------------------------------------------------------------------------
  1336.   def current_command_window_symbol
  1337.     return @command_window.current_symbol
  1338.   end
  1339.  
  1340.   #--------------------------------------------------------------------------
  1341.   # new method: current_command_window_y
  1342.   #--------------------------------------------------------------------------
  1343.   def current_command_window
  1344.     return @command_window
  1345.   end
  1346.  
  1347.   #--------------------------------------------------------------------------
  1348.   # new method: command_equip
  1349.   #--------------------------------------------------------------------------
  1350.   def command_equip
  1351.     show_sub_window(@actor_window)
  1352.     @actor_window.select_last
  1353.   end
  1354.  
  1355.   #--------------------------------------------------------------------------
  1356.   # new method: command_synthshop
  1357.   #--------------------------------------------------------------------------
  1358.   def command_synthshop
  1359.     SceneManager.call(Scene_SynthesisShop)
  1360.   end
  1361.  
  1362.   #--------------------------------------------------------------------------
  1363.   # new method: command_name1
  1364.   #--------------------------------------------------------------------------
  1365.   def command_name1
  1366.     # Do nothing.
  1367.   end
  1368.  
  1369.   #--------------------------------------------------------------------------
  1370.   # new method: command_name2
  1371.   #--------------------------------------------------------------------------
  1372.   def command_name2
  1373.     # Do nothing.
  1374.   end
  1375.  
  1376. end # Scene_Shop
  1377.  
  1378. #==============================================================================
  1379. #
  1380. # ▼ End of File
  1381. #
  1382. #==============================================================================
Advertisement
Add Comment
Please, Sign In to add comment