查看: 1359|回复: 1

[已经解决] 如果可以的话 还是把这个功能去掉把!

[复制链接]
梦石
0
星屑
199
在线时间
248 小时
注册时间
2012-4-29
回帖
313
发表于 2013-11-21 21:35:22 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 Sion 于 2013-12-6 18:44 编辑

如果可以的话  还是麻烦下   帮忙把这个功能去掉下!
X[N)XSRNJ$N651JNDIJUVUN.jpg

  1. #==============================================================================
  2. # ■ VXAce-RGSS3-30 マルチカテゴリショップ [Ver.1.0.0]       by Claimh
  3. #------------------------------------------------------------------------------
  4. # カテゴリ分類を細分化できるショップです。
  5. #<機能概要>
  6. #?購入?売却リストをカテゴリ分類する
  7. #?武器タイプ?防具タイプで分類する
  8. #?アクターが装備可能な武器?防具で分類する
  9. #?ショップ画面からの装備変更
  10. #?購入した装備品をすぐに装備する
  11. #?購入?売却不可のアイテムを設定できる
  12. #?購入?売却の価格レートの変更
  13. #------------------------------------------------------------------------------
  14. # <操作>
  15. # Cボタン      : 購入/売買
  16. # ←/→ボタン  : アクター情報切り替え
  17. # ↑/↓ボタン  : 購入/売却数 ±10
  18. # L/Rボタン    : カテゴリ切り替え
  19. #------------------------------------------------------------------------------
  20. # <メモ欄設定>
  21. # ?売却不可 : <not_sell>
  22. #------------------------------------------------------------------------------
  23. #<売買不可設定>
  24. # ?購入不可アイテム追加
  25. #    $game_system.shop.buy.add_ng_item(type, id)
  26. #      type : 種別(0:アイテム, 1:武器, 2:防具)
  27. #      id   : ID
  28. # ?購入不可アイテム解除
  29. #    $game_system.shop.buy.del_ng_item(type, id)
  30. # ?売却不可アイテム追加
  31. #    $game_system.shop.sell.add_ng_item(type, id)
  32. # ?売却不可アイテム解除
  33. #    $game_system.shop.sell.del_ng_item(type, id)
  34. #------------------------------------------------------------------------------
  35. # <全体売買レート変更>
  36. #?購入レート
  37. #  $game_system.shop.buy.rate   = レート(%)
  38. #?売却レート
  39. #  $game_system.shop.sell.rate  = レート(%)
  40. #------------------------------------------------------------------------------
  41. # <個別売買レート変更>
  42. #※全体レートよりも個別レートが優先されます。(全体×個別というレート計算はしません)
  43. #?個別購入レート
  44. #  $game_system.shop.buy.item_rate(type, id, rate)
  45. #      type : 種別(0:アイテム, 1:武器, 2:防具)
  46. #      id   : ID
  47. #      rate : レート(%)
  48. #?個別売却レート
  49. #  $game_system.shop.sell.item_rate(type, id, rate)
  50. #?個別購入レート情報削除
  51. #  $game_system.shop.buy.del_item_rate(type, id)
  52. #?個別売却レート情報削除
  53. #  $game_system.shop.sell.del_item_rate(type, id)
  54. #------------------------------------------------------------------------------
  55. # <合計金額取得>
  56. #?購入合計:  $game_system.shop.buy.gold
  57. #?売却合計:  $game_system.shop.sell.gold
  58. #------------------------------------------------------------------------------
  59. # <購入不可判定について>
  60. # 以下のいずれかに当てはまる場合は購入不可
  61. #   ?お金が足りない
  62. #   ?アイテムの最大数超過($game_party.item_max?)
  63. #   ?購入不可アイテムの対象($game_system.shop.buy.add_ng_item)
  64. #------------------------------------------------------------------------------
  65. # <売却不可判定について>
  66. # 以下のいずれかに当てはまる場合は売却不可
  67. #   ?データベース上の値段が0 (※レート計算で値段が0になる場合は除く)
  68. #   ?メモ欄に <not_sell>指定がある
  69. #   ?売却不可アイテムの対象($game_system.shop.sell.add_ng_item)
  70. #------------------------------------------------------------------------------
  71. # <アクターが装備可能な武器?防具で分類>
  72. # BUY_CTにACTORを入れた時の動作
  73. #   ?カテゴリ切り替えでACTORカテゴリに変わった時にアクターステータスも切り替え
  74. #   ?アイコンはキャラクターを表示
  75. #------------------------------------------------------------------------------
  76. # <購入した装備品をすぐに装備する>
  77. # アクターステータスウィンドウに表示されているアクターが装備できる武器?防具を
  78. # 購入したときに装備するか否かの選択が表示されます。
  79. #==============================================================================

  80. module ExShop
  81.   ALL=0;ITEM=1;WEAPON=2;ARMOR=3;KEY=4;ACTOR=5
  82.   #----------------------------------------------------------------------------
  83.   # レート設定
  84.   #----------------------------------------------------------------------------
  85.   # 初期購入レート(%)
  86.   BUY_RATE  = 100.0
  87.   # 初期売却レート(%)
  88.   SELL_RATE = 60.0

  89.   # 値段指定あり時も購入レートを適応する
  90.   USE_P_RATE = true

  91.   #----------------------------------------------------------------------------
  92.   # 分類設定
  93.   #----------------------------------------------------------------------------
  94.   # 購入分類設定
  95.   #   ALL     : すべて
  96.   #   ITEM    : アイテム
  97.   #   WEAPON  : 武器
  98.   #   ARMOR   : 防具
  99.   #   ACTOR   : アクターが装備できる武器?防具
  100.   BUY_CT = [ALL, ITEM, WEAPON, ARMOR]
  101.   #BUY_CT = [ALL, ITEM, ACTOR]  # アクター装備別の例

  102.   # 売却分類設定
  103.   #   ALL     : すべて
  104.   #   ITEM    : アイテム
  105.   #   WEAPON  : 武器
  106.   #   ARMOR   : 防具
  107.   #   KEY     : 大事なもの
  108.   SELL_CT = [ALL, ITEM, WEAPON, ARMOR, KEY]


  109.   # 武器をさらに分類する
  110.   # (分類設定のWEAPONを武器タイプで分類します)
  111.   USE_W_TYPE =  false
  112.   # 防具をさらに分類する
  113.   # (分類設定のARMORを防具タイプ/防具種別で分類します)
  114.   #   0 : 分類しない
  115.   #   1 : 防具タイプで分類
  116.   #   2 : 装備タイプ(盾/頭/身体/装飾品)で分類
  117.   USE_A_TYPE = 0


  118.   # アイコン設定
  119.   #         [ALL用, ITEM用, WEAPON用, ARMOR用, KEY用]
  120.   CT_ICON = [  4608,    4609,      4610,     4611,   4612]
  121.   # 武器タイプ アイコン設定
  122.   #           [0, 武器タイプ1, 武器タイプ2, …]
  123.   CT_W_ICON = [0, 4634, 4633, 146, 147, 148, 149, 150, 151, 152, 153]
  124.   # 防具タイプ アイコン設定
  125.   #           [0, 防具タイプ1, 防具タイプ2, …]
  126.   CT_A_ICON = [0, 4632, 4631, 169, 170, 160, 161]
  127.   # 防具種別 アイコン設定
  128.   #           [0,  盾, 頭, 身体, 装飾品]
  129.   CT_E_ICON = [0, 4630, 4629,  169,    176]


  130.   #----------------------------------------------------------------------------
  131.   # 表示設定
  132.   #----------------------------------------------------------------------------
  133.   # 購入不可アイテムの値段表示(""の時は値段を表示)
  134.   V_N_BUY = "售价"

  135.   #----------------------------------------------------------------------------
  136.   # レイアウト設定
  137.   #----------------------------------------------------------------------------
  138.   # 所持金ウィンドウを左下に配置する
  139.   #   true  : 左下に配置(カテゴリ多用)
  140.   #   false : 右上に配置(カテゴリ小用)
  141.   GOLD_LD = false
  142. end



  143. module ExShop
  144.   #--------------------------------------------------------------------------
  145.   # ● 購入レート変換(購入価格計算)
  146.   #--------------------------------------------------------------------------
  147.   def self.buy_price(item, price, fix=false)
  148.     return price if fix and !USE_P_RATE
  149.     $game_system.shop.buy.price(item_type(item), item.id, price)
  150.   end
  151.   #--------------------------------------------------------------------------
  152.   # ● 売却レート変換(売却価格計算)
  153.   #--------------------------------------------------------------------------
  154.   def self.sell_price(item, price)
  155.     $game_system.shop.sell.price(item_type(item), item.id, price)
  156.   end
  157.   #--------------------------------------------------------------------------
  158.   # ● atype => symbol
  159.   #--------------------------------------------------------------------------
  160.   def self.actor_sym
  161.     $game_party.members.collect {|a| a.id.to_s.to_sym }
  162.   end
  163.   #--------------------------------------------------------------------------
  164.   # ● CT設定 => symbol
  165.   #--------------------------------------------------------------------------
  166.   def self.ct_sym(ct)
  167.     ct.inject([]) do |r, c|
  168.       case c
  169.       when WEAPON;  r += wtype_sym
  170.       when ARMOR;   r += atype_sym
  171.       when ACTOR;   r += actor_sym
  172.       else;         r.push([:all, :item, :weapon, :armor, :key_item][c])
  173.       end
  174.     end
  175.   end
  176.   #--------------------------------------------------------------------------
  177.   # ● wtype => symbol
  178.   #--------------------------------------------------------------------------
  179.   def self.wtype_sym
  180.     return [:weapon] unless ExShop::USE_W_TYPE
  181.     $data_system.weapon_types[1, $data_system.weapon_types.size].collect {|a| a.to_sym}
  182.   end
  183.   #--------------------------------------------------------------------------
  184.   # ● atype => symbol
  185.   #--------------------------------------------------------------------------
  186.   def self.atype_sym
  187.     case ExShop::USE_A_TYPE
  188.     when 1  # 防具タイプ
  189.       $data_system.armor_types[1, $data_system.armor_types.size].collect {|a| a.to_sym}
  190.     when 2  # 装備タイプ
  191.       [:shield, :helmet, :clothes, :accessory]
  192.     else
  193.       [:armor]
  194.     end
  195.   end
  196.   #--------------------------------------------------------------------------
  197.   # ● symbol => wtype or atype
  198.   #--------------------------------------------------------------------------
  199.   def self.sym_type(sym)
  200.     str = sym.id2name
  201.     return WEAPON if $data_system.weapon_types.include?(str)
  202.     return ARMOR  if $data_system.armor_types.include?(str)
  203.     ACTOR
  204.   end
  205.   #--------------------------------------------------------------------------
  206.   # ● sym => wtype
  207.   #--------------------------------------------------------------------------
  208.   def self.sym_wtype(sym)
  209.     $data_system.weapon_types.index(sym.id2name)
  210.   end
  211.   #--------------------------------------------------------------------------
  212.   # ● sym => atype
  213.   #--------------------------------------------------------------------------
  214.   def self.sym_atype(sym)
  215.     $data_system.armor_types.index(sym.id2name)
  216.   end
  217.   #--------------------------------------------------------------------------
  218.   # ● symbol => 設定
  219.   #--------------------------------------------------------------------------
  220.   def self.sym2id(sym)
  221.     case sym
  222.     when :all;      return ALL
  223.     when :item;     return ITEM
  224.     when :weapon;   return WEAPON
  225.     when :armor;    return ARMOR
  226.     when :key_item; return KEY
  227.     when :shield, :helmet, :clothes, :accessory;  return ARMOR
  228.     else  return sym_type(sym)
  229.     end
  230.   end
  231.   #--------------------------------------------------------------------------
  232.   # ● symbol => アイコン
  233.   #--------------------------------------------------------------------------
  234.   def self.sym2icon(sym)
  235.     case sym
  236.     when :all;        return CT_ICON[ALL]
  237.     when :none;       return 0
  238.     when :item;       return CT_ICON[ITEM]
  239.     when :weapon;     return CT_ICON[WEAPON]
  240.     when :armor;      return CT_ICON[ARMOR]
  241.     when :key_item;   return CT_ICON[KEY]
  242.     when :shield;     return CT_E_ICON[1]
  243.     when :helmet;     return CT_E_ICON[2]
  244.     when :clothes;    return CT_E_ICON[3]
  245.     when :accessory;  return CT_E_ICON[4]
  246.     else
  247.       case sym_type(sym)
  248.       when WEAPON;  return CT_W_ICON[sym_wtype(sym)]
  249.       when ARMOR;   return CT_A_ICON[sym_atype(sym)]
  250.       when ACTOR;   return 0
  251.       end
  252.     end
  253.   end
  254.   #--------------------------------------------------------------------------
  255.   # ● symbol => Actor
  256.   #--------------------------------------------------------------------------
  257.   def self.sym2actor(sym)
  258.     $game_actors[sym.id2name.to_i]
  259.   end
  260.   #--------------------------------------------------------------------------
  261.   # ● アイテムをリストに含めるかどうか
  262.   #--------------------------------------------------------------------------
  263.   def self.item_include?(sym, item)
  264.     case sym
  265.     when :all
  266.       true
  267.     when :none
  268.       false
  269.     when :item
  270.       item.is_a?(RPG::Item) && !item.key_item?
  271.     when :weapon
  272.       item.is_a?(RPG::Weapon)
  273.     when :armor
  274.       item.is_a?(RPG::Armor)
  275.     when :key_item
  276.       item.is_a?(RPG::Item) && item.key_item?
  277.     when :shield
  278.       item.is_a?(RPG::Armor) && item.etype_id == 1
  279.     when :helmet
  280.       item.is_a?(RPG::Armor) && item.etype_id == 2
  281.     when :clothes
  282.       item.is_a?(RPG::Armor) && item.etype_id == 3
  283.     when :accessory
  284.       item.is_a?(RPG::Armor) && item.etype_id == 4
  285.     else
  286.       case sym_type(sym)
  287.       when WEAPON
  288.         item.is_a?(RPG::Weapon) and item.wtype_id == sym_wtype(sym)
  289.       when ARMOR
  290.         item.is_a?(RPG::Armor)  and item.atype_id == sym_atype(sym)
  291.       when ACTOR
  292.         sym2actor(sym).equippable?(item)
  293.       else
  294.         false
  295.       end
  296.     end
  297.   end
  298.   #--------------------------------------------------------------------------
  299.   # ● アイテムタイプ
  300.   #--------------------------------------------------------------------------
  301.   def self.item_type(item)
  302.     case item
  303.     when RPG::Item;   return 0
  304.     when RPG::Weapon; return 1
  305.     when RPG::Armor;  return 2
  306.     end
  307.   end
  308.   #--------------------------------------------------------------------------
  309.   # ● 購入可否判定
  310.   #--------------------------------------------------------------------------
  311.   def self.buy_enable?(item)
  312.     not $game_system.shop.buy.ng_item?(item_type(item), item.id)
  313.   end
  314.   #--------------------------------------------------------------------------
  315.   # ● 売却可否判定
  316.   #--------------------------------------------------------------------------
  317.   def self.sell_enable?(item)
  318.     not $game_system.shop.sell.ng_item?(item_type(item), item.id)
  319.   end
  320.   #--------------------------------------------------------------------------
  321.   # ● 購入不可文字
  322.   #--------------------------------------------------------------------------
  323.   def self.not_buy(item, price)
  324.     return price if V_N_BUY == ""
  325.     buy_enable?(item) ? price : V_N_BUY
  326.   end
  327. end



  328. #==============================================================================
  329. # ■ RPG::Item
  330. #==============================================================================
  331. class RPG::Item < RPG::UsableItem
  332.   #--------------------------------------------------------------------------
  333.   # ● 売却可能か?
  334.   #--------------------------------------------------------------------------
  335.   def sell?
  336.     @price > 0 and !@note.include?("<not_sell>")
  337.   end
  338. end

  339. #==============================================================================
  340. # ■ RPG::EquipItem
  341. #==============================================================================
  342. class RPG::EquipItem < RPG::BaseItem
  343.   #--------------------------------------------------------------------------
  344.   # ● 売却可能か?
  345.   #--------------------------------------------------------------------------
  346.   def sell?
  347.     @price > 0 and !@note.include?("<not_sell>")
  348.   end
  349. end


  350. #==============================================================================
  351. # ■ ExShop::ShopStatus
  352. #==============================================================================
  353. class ExShop::ShopStatus
  354.   #--------------------------------------------------------------------------
  355.   # ● 公開インスタンス変数
  356.   #--------------------------------------------------------------------------
  357.   attr_reader :buy   # 購入ステータス
  358.   attr_reader :sell  # 売却ステータス
  359.   #--------------------------------------------------------------------------
  360.   # ● オブジェクト初期化
  361.   #--------------------------------------------------------------------------
  362.   def initialize
  363.     reset
  364.   end
  365.   #--------------------------------------------------------------------------
  366.   # ● リセット
  367.   #--------------------------------------------------------------------------
  368.   def reset
  369.     @buy  = Status.new(ExShop::BUY_RATE)
  370.     @sell = Status.new(ExShop::SELL_RATE)
  371.   end
  372.   #--------------------------------------------------------------------------
  373.   # ● レートリセット
  374.   #--------------------------------------------------------------------------
  375.   def rate_reset
  376.     @buy.rate  = ExShop::BUY_RATE
  377.     @sell.rate = ExShop::SELL_RATE
  378.     @buy.i_rate_reset
  379.     @sell.i_rate_reset
  380.   end
  381.   #--------------------------------------------------------------------------
  382.   # ● 売買不可アイテム情報リセット
  383.   #--------------------------------------------------------------------------
  384.   def ng_reset
  385.     @buy.ng_reset
  386.     @sell.ng_reset
  387.   end

  388.   #============================================================================
  389.   # ■ Status  : 売買情報
  390.   #============================================================================
  391.   class Status
  392.     attr_accessor :rate        # レート
  393.     attr_accessor :gold        # 金額
  394.     #------------------------------------------------------------------------
  395.     # ● オブジェクト初期化
  396.     #------------------------------------------------------------------------
  397.     def initialize(rate)
  398.       @rate = rate
  399.       [url=home.php?mod=space&uid=236945]@gold[/url] = 0
  400.       i_rate_reset
  401.       ng_reset
  402.     end
  403.     #------------------------------------------------------------------------
  404.     # ● 個別レート設定リセット
  405.     #------------------------------------------------------------------------
  406.     def i_rate_reset
  407.       @i_rate = []
  408.     end
  409.     #------------------------------------------------------------------------
  410.     # ● 売買不可アイテムリセット
  411.     #------------------------------------------------------------------------
  412.     def ng_reset
  413.       @ng_items = []
  414.     end
  415.     #------------------------------------------------------------------------
  416.     # ● レート: 百分率 => 浮動小数点数
  417.     #------------------------------------------------------------------------
  418.     def rate_f
  419.       (@rate / 100.0)
  420.     end
  421.     #------------------------------------------------------------------------
  422.     # ● アイテム価格計算
  423.     #------------------------------------------------------------------------
  424.     def price(type, id, price)
  425.       (price * i_rate_f(type, id)).truncate
  426.     end
  427.     #------------------------------------------------------------------------
  428.     # ● 対象アイテムレート取得
  429.     #------------------------------------------------------------------------
  430.     def i_rate_f(type, id)
  431.       it = find_i_rate(type, id)
  432.       it.nil? ? rate_f : it.rate_f
  433.     end
  434.     #------------------------------------------------------------------------
  435.     # ● 対象アイテムレート取得
  436.     #------------------------------------------------------------------------
  437.     def i_rate(type, id)
  438.       it = find_i_rate(type, id)
  439.       it.nil? ? @rate : it.rate
  440.     end
  441.     #------------------------------------------------------------------------
  442.     # ● 個別レート設定アイテム?
  443.     #------------------------------------------------------------------------
  444.     def item_rate?(type, id)
  445.       find_i_rate(type, id) != nil
  446.     end
  447.     #------------------------------------------------------------------------
  448.     # ● 個別レート設定アイテム情報取得
  449.     #------------------------------------------------------------------------
  450.     def find_i_rate(type, id)
  451.       @i_rate.find {|a| a.include?(type, id)}
  452.     end
  453.     #------------------------------------------------------------------------
  454.     # ● 個別レート設定
  455.     #------------------------------------------------------------------------
  456.     def item_rate(type, id, rate)
  457.       it = find_i_rate(type, id)
  458.       if it.nil?
  459.         @i_rate.push(Item_Rate.new(type, id, rate))
  460.       else
  461.         it.rate = rate
  462.       end
  463.     end
  464.     #------------------------------------------------------------------------
  465.     # ● 個別レート設定削除
  466.     #------------------------------------------------------------------------
  467.     def del_item_rate(type, id)
  468.       @i_rate.reject! {|item| item.include?(type, id)}
  469.     end
  470.     #------------------------------------------------------------------------
  471.     # ● 売買不可アイテム?
  472.     #------------------------------------------------------------------------
  473.     def ng_item?(type, id)
  474.       @ng_items.any? {|item| item.include?(type, id)}
  475.     end
  476.     #------------------------------------------------------------------------
  477.     # ● 売買不可アイテム追加
  478.     #------------------------------------------------------------------------
  479.     def add_ng_item(type, id)
  480.       return if ng_item?(type, id)
  481.       @ng_items.push(NG_Item.new(type, id))
  482.     end
  483.     #------------------------------------------------------------------------
  484.     # ● 売買不可アイテム解除
  485.     #------------------------------------------------------------------------
  486.     def del_ng_item(type, id)
  487.       @ng_items.reject! {|item| item.include?(type, id)}
  488.     end
  489.     #==========================================================================
  490.     # ■ NG_Item   : 売買不可アイテム情報
  491.     #==========================================================================
  492.     class NG_Item
  493.       #----------------------------------------------------------------------
  494.       # ● オブジェクト初期化
  495.       #      type : 種別(0..RPG:Item, 1..RPG::Weapon, 2..RPG::Armor)
  496.       #      id   : ID
  497.       #----------------------------------------------------------------------
  498.       def initialize(type, id)
  499.         @type = type; @id = id
  500.       end
  501.       #----------------------------------------------------------------------
  502.       # ● 売買不可アイテム?
  503.       #----------------------------------------------------------------------
  504.       def include?(type, id)
  505.         @type == type and @id == id
  506.       end
  507.     end
  508.     #==========================================================================
  509.     # ■ Item_Rate   : アイテム売買レート
  510.     #==========================================================================
  511.     class Item_Rate
  512.       #----------------------------------------------------------------------
  513.       # ● 公開インスタンス変数
  514.       #----------------------------------------------------------------------
  515.       attr_accessor :rate     # レート(%)
  516.       #----------------------------------------------------------------------
  517.       # ● オブジェクト初期化
  518.       #      type : 種別(0..RPG:Item, 1..RPG::Weapon, 2..RPG::Armor)
  519.       #      id   : ID
  520.       #      rate : レート(%)
  521.       #----------------------------------------------------------------------
  522.       def initialize(type, id, rate)
  523.         @type = type; @id = id; @rate = rate
  524.       end
  525.       #----------------------------------------------------------------------
  526.       # ● レート: 百分率 => 浮動小数点数
  527.       #----------------------------------------------------------------------
  528.       def rate_f
  529.         (@rate / 100.0)
  530.       end
  531.       #----------------------------------------------------------------------
  532.       # ● 売買レート対象アイテム?
  533.       #----------------------------------------------------------------------
  534.       def include?(type, id)
  535.         @type == type and @id == id
  536.       end
  537.     end
  538.   end
  539. end


  540. #==============================================================================
  541. # ■ Game_System
  542. #==============================================================================
  543. class Game_System
  544.   #--------------------------------------------------------------------------
  545.   # ● 公開インスタンス変数
  546.   #--------------------------------------------------------------------------
  547.   attr_reader :shop         # ショップ情報
  548.   #--------------------------------------------------------------------------
  549.   # ● オブジェクト初期化
  550.   #--------------------------------------------------------------------------
  551.   alias initialize_shop_ex initialize
  552.   def initialize
  553.     initialize_shop_ex
  554.     @shop = ExShop::ShopStatus.new
  555.   end
  556. end





  557. #==============================================================================
  558. # ■ Window_ExShopCommand
  559. #------------------------------------------------------------------------------
  560. #  ショップ画面で、購入/売却/装備を選択するウィンドウです。
  561. #==============================================================================
  562. class Window_ExShopCommand < Window_Command
  563.   #--------------------------------------------------------------------------
  564.   # ● クラス変数
  565.   #--------------------------------------------------------------------------
  566.   @@last_command_symbol = :buy
  567.   #--------------------------------------------------------------------------
  568.   # ● オブジェクト初期化
  569.   #--------------------------------------------------------------------------
  570.   def initialize(window_width, purchase_only)
  571.     @window_width = window_width
  572.     @purchase_only = purchase_only
  573.     super(0, 0)
  574.     select_last
  575.   end
  576.   #--------------------------------------------------------------------------
  577.   # ● ウィンドウ幅の取得
  578.   #--------------------------------------------------------------------------
  579.   def window_width
  580.     @window_width
  581.   end
  582.   #--------------------------------------------------------------------------
  583.   # ● 表示行数の取得
  584.   #--------------------------------------------------------------------------
  585.   def visible_line_number
  586.     4
  587.   end
  588.   #--------------------------------------------------------------------------
  589.   # ● コマンドリストの作成
  590.   #--------------------------------------------------------------------------
  591.   def make_command_list
  592.     add_command(Vocab::ShopBuy,    :buy)
  593.     add_command(Vocab::ShopSell,   :sell,   !@purchase_only)
  594.     add_command(Vocab.equip,       :equip,  $game_party.members.size > 0)
  595.     add_command(Vocab::ShopCancel, :cancel)
  596.   end
  597.   #--------------------------------------------------------------------------
  598.   # ● 決定ボタンが押されたときの処理
  599.   #--------------------------------------------------------------------------
  600.   def process_ok
  601.     @@last_command_symbol = (current_symbol == :equip ? :equip : :buy)
  602.     super
  603.   end
  604.   #--------------------------------------------------------------------------
  605.   # ● 前回の選択位置を復帰
  606.   #--------------------------------------------------------------------------
  607.   def select_last
  608.     select_symbol(@@last_command_symbol)
  609.   end
  610. end


  611. #==============================================================================
  612. # ■ Window_ExShopCategory
  613. #------------------------------------------------------------------------------
  614. #  ショップ画面で、カテゴリを選択するウィンドウです。
  615. #==============================================================================
  616. class Window_ExShopCategory < Window_HorzCommand
  617.   #--------------------------------------------------------------------------
  618.   # ● 公開インスタンス変数
  619.   #--------------------------------------------------------------------------
  620.   attr_reader   :item_window
  621.   #--------------------------------------------------------------------------
  622.   # ● オブジェクト初期化
  623.   #--------------------------------------------------------------------------
  624.   def initialize(x, y, w)
  625.     @win_width = w
  626.     super(x, y)
  627.   end
  628.   #--------------------------------------------------------------------------
  629.   # ● ウィンドウ幅の取得
  630.   #--------------------------------------------------------------------------
  631.   def window_width
  632.     @win_width
  633.   end
  634.   #--------------------------------------------------------------------------
  635.   # ● 桁数の取得
  636.   #--------------------------------------------------------------------------
  637.   def col_max
  638.     ExShop::GOLD_LD ? 10 : 5
  639.   end
  640.   #--------------------------------------------------------------------------
  641.   # ● 先頭の桁の設定
  642.   #--------------------------------------------------------------------------
  643.   def top_col=(col)
  644.     col = 0 if col < 0
  645. #    col = col_max - 1 if col > col_max - 1
  646.     self.ox = col * (item_width + spacing)
  647.   end
  648.   #--------------------------------------------------------------------------
  649.   # ● シンボルリスト
  650.   #--------------------------------------------------------------------------
  651.   def symlist
  652.     [:all, :item, :weapon, :armor, :key_item]
  653.   end
  654.   #--------------------------------------------------------------------------
  655.   # ● コマンドリストの作成
  656.   #--------------------------------------------------------------------------
  657.   def make_command_list
  658.     symlist.each {|s| add_command(ExShop.sym2icon(s), s, true, ExShop.sym2id(s))}
  659.   end
  660.   #--------------------------------------------------------------------------
  661.   # ● 項目を描画する矩形の取得
  662.   #--------------------------------------------------------------------------
  663.   def item_rect(index)
  664.     r = super(index)
  665.     r.x += (r.width - 24) / 2
  666.     r.width = 24
  667.     r
  668.   end
  669.   #--------------------------------------------------------------------------
  670.   # ● 項目の描画
  671.   #--------------------------------------------------------------------------
  672.   def draw_item(index)
  673.     r = item_rect(index)
  674.     if @list[index][:ext] == ExShop::ACTOR
  675.       draw_charicon(ExShop.sym2actor(@list[index][:symbol]), r.x, r.y, command_enabled?(index))
  676.     else
  677.       draw_icon(command_name(index), r.x, r.y, command_enabled?(index))
  678.     end
  679.   end
  680.   #--------------------------------------------------------------------------
  681.   # ● 歩行グラフィックの描画
  682.   #--------------------------------------------------------------------------
  683.   def draw_charicon(actor, x, y, enabled)
  684.     return if actor.nil?
  685.     return unless actor.character_name
  686.     bitmap = Cache.character(actor.character_name)
  687.     sign = actor.character_name[/^[\!\$]./]
  688.     if sign && sign.include?('$')
  689.       cw = bitmap.width / 3
  690.       ch = bitmap.height / 4
  691.     else
  692.       cw = bitmap.width / 12
  693.       ch = bitmap.height / 8
  694.     end
  695.     n = actor.character_index
  696.     src_rect = Rect.new((n%4*3+1)*cw + (cw - 20) / 2, (n/4*4)*ch, 20, 20)
  697.     contents.blt(x+2, y+2, bitmap, src_rect)
  698.   end
  699.   #--------------------------------------------------------------------------
  700.   # ● フレーム更新
  701.   #--------------------------------------------------------------------------
  702.   def update
  703.     super
  704.     @item_window.category = current_symbol if @item_window
  705.   end
  706.   #--------------------------------------------------------------------------
  707.   # ● アイテムウィンドウの設定
  708.   #--------------------------------------------------------------------------
  709.   def item_window=(item_window)
  710.     @item_window = item_window
  711.     update
  712.   end
  713. end

  714. #==============================================================================
  715. # ■ Window_ExShopCategory
  716. #------------------------------------------------------------------------------
  717. #  ショップ画面で、購入カテゴリを選択するウィンドウです。
  718. #==============================================================================
  719. class Window_ExShopBuyCt < Window_ExShopCategory
  720.   #--------------------------------------------------------------------------
  721.   # ● シンボルリスト
  722.   #--------------------------------------------------------------------------
  723.   def symlist
  724.     ExShop.ct_sym(ExShop::BUY_CT)
  725.   end
  726. end

  727. #==============================================================================
  728. # ■ Window_ExShopCategory
  729. #------------------------------------------------------------------------------
  730. #  ショップ画面で、売却カテゴリを選択するウィンドウです。
  731. #==============================================================================
  732. class Window_ExShopSellCt < Window_ExShopCategory
  733.   #--------------------------------------------------------------------------
  734.   # ● シンボルリスト
  735.   #--------------------------------------------------------------------------
  736.   def symlist
  737.     ExShop.ct_sym(ExShop::SELL_CT)
  738.   end
  739. end


  740. #==============================================================================
  741. # ■ Sprite_ShopTAG
  742. #==============================================================================
  743. class Sprite_ShopTAG < Sprite
  744.   W = 100
  745.   H = 14
  746.   #--------------------------------------------------------------------------
  747.   # ● オブジェクト初期化
  748.   #--------------------------------------------------------------------------
  749.   def initialize(x, y, tag)
  750.     super(Viewport.new(x, y, W, H))
  751.     self.viewport.z = 200
  752.     self.bitmap = Bitmap.new(W, H)
  753.     self.bitmap.font.size = 12
  754.     self.bitmap.font.color = system_color
  755.     self.bitmap.draw_text(0, 0, W, H, tag)
  756.   end
  757.   #--------------------------------------------------------------------------
  758.   # ● 文字色取得
  759.   #     n : 文字色番号(0..31)
  760.   #--------------------------------------------------------------------------
  761.   def text_color(n)
  762.     Cache.system("Window").get_pixel(64 + (n % 8) * 8, 96 + (n / 8) * 8)
  763.   end
  764.   #--------------------------------------------------------------------------
  765.   # ● 各種文字色の取得
  766.   #--------------------------------------------------------------------------
  767.   def normal_color;      text_color(0);   end;    # 通常
  768.   def system_color;      text_color(16);  end;    # システム
  769. end

  770. #==============================================================================
  771. # ■ Window_ShopBuy
  772. #==============================================================================
  773. class Window_ShopBuy < Window_Selectable
  774.   #--------------------------------------------------------------------------
  775.   # ● オブジェクト初期化
  776.   #--------------------------------------------------------------------------
  777.   def initialize(x, y, width, height, shop_goods)
  778.     super(x, y, width, height)
  779.     @shop_goods = shop_goods
  780.     [url=home.php?mod=space&uid=26101]@Money[/url] = 0
  781.     @category = :none
  782.     refresh
  783.     select(0)
  784.     create_sprites
  785.   end
  786.   #--------------------------------------------------------------------------
  787.   # ● 解放
  788.   #--------------------------------------------------------------------------
  789.   def dispose
  790.     super
  791.     dispose_sprites
  792.   end
  793.   #--------------------------------------------------------------------------
  794.   # ● タグスプライト生成
  795.   #--------------------------------------------------------------------------
  796.   def create_sprites
  797.     @sprite_price = Sprite_ShopTAG.new(self.x+385, self.y+2, "价格")
  798.     @sprite_num   = Sprite_ShopTAG.new(self.x+430, self.y+2, "拥有数目")
  799.   end
  800.   #--------------------------------------------------------------------------
  801.   # ● タグスプライト解放
  802.   #--------------------------------------------------------------------------
  803.   def dispose_sprites
  804.     @sprite_price.dispose
  805.     @sprite_num.dispose
  806.   end
  807.   #--------------------------------------------------------------------------
  808.   # ● ウィンドウの表示/非表示
  809.   #--------------------------------------------------------------------------
  810.   def visible=(flag)
  811.     super(flag)
  812.     @sprite_price.visible = @sprite_num.visible = flag
  813.   end
  814.   #--------------------------------------------------------------------------
  815.   # ● ウィンドウ幅の取得
  816.   #--------------------------------------------------------------------------
  817.   def window_width
  818.     width
  819.   end
  820.   #--------------------------------------------------------------------------
  821.   # ● カテゴリの設定
  822.   #--------------------------------------------------------------------------
  823.   def category=(category)
  824.     return if @category == category
  825.     @category = category
  826.     refresh
  827.     self.oy = 0
  828.   end
  829.   #--------------------------------------------------------------------------
  830.   # ● アイテムリストの作成 <再定義>
  831.   #--------------------------------------------------------------------------
  832.   def make_item_list
  833.     @data = []
  834.     @price = {}
  835.     @shop_goods.each do |goods|
  836.       case goods[0]
  837.       when 0;  item = $data_items[goods[1]]
  838.       when 1;  item = $data_weapons[goods[1]]
  839.       when 2;  item = $data_armors[goods[1]]
  840.       end
  841.       if item
  842.         next unless include?(item)
  843.         @data.push(item)
  844.         i_price = goods[2] == 0 ? item.price : goods[3]
  845.         @price[item] = ExShop.buy_price(item, i_price, goods[2] != 0)
  846.       end
  847.     end
  848.   end
  849.   #--------------------------------------------------------------------------
  850.   # ● アイテムをリストに含めるかどうか
  851.   #--------------------------------------------------------------------------
  852.   def include?(item)
  853.     item && ExShop.item_include?(@category, item)
  854.   end
  855.   #--------------------------------------------------------------------------
  856.   # ● 項目の描画
  857.   #--------------------------------------------------------------------------
  858.   def draw_item(index)
  859.     item = @data[index]
  860.     rect = item_rect(index)
  861.     draw_item_name(item, rect.x, rect.y, enable?(item))
  862.     rect.width -= 64
  863.     draw_text(rect, ExShop.not_buy(item, price(item)), 2)
  864.     rect.width += 60
  865.     draw_text(rect, $game_party.item_number(item), 2)
  866.   end
  867.   #--------------------------------------------------------------------------
  868.   # ● アイテムを許可状態で表示するかどうか
  869.   #--------------------------------------------------------------------------
  870.   def enable?(item)
  871.     item && price(item) <= [url=home.php?mod=space&uid=26101]@Money[/url] && !$game_party.item_max?(item) && ExShop.buy_enable?(item)
  872.   end
  873.   #--------------------------------------------------------------------------
  874.   # ● ヘルプテキスト更新
  875.   #--------------------------------------------------------------------------
  876.   def update_help
  877.     @help_window.set_item(item) if @help_window
  878.     if @status_window
  879.       @status_window.item = item
  880.       if ExShop.sym2id(@category) == ExShop::ACTOR
  881.         @status_window.page_index = ExShop.sym2actor(@category).index
  882.       end
  883.     end
  884.   end
  885. end


  886. #==============================================================================
  887. # ■ Window_ShopSell
  888. #==============================================================================
  889. class Window_ShopSell < Window_ItemList
  890.   #--------------------------------------------------------------------------
  891.   # ● 公開インスタンス変数
  892.   #--------------------------------------------------------------------------
  893.   attr_reader   :status_window            # ステータスウィンドウ
  894.   #--------------------------------------------------------------------------
  895.   # ● 桁数の取得
  896.   #--------------------------------------------------------------------------
  897.   def col_max
  898.     1
  899.   end
  900.   #--------------------------------------------------------------------------
  901.   # ● アイテムをリストに含めるかどうか
  902.   #--------------------------------------------------------------------------
  903.   def include?(item)
  904.     item && ExShop.item_include?(@category, item)
  905.   end
  906.   #--------------------------------------------------------------------------
  907.   # ● アイテムを許可状態で表示するかどうか
  908.   #--------------------------------------------------------------------------
  909.   def enable?(item)
  910.     item && item.sell? && ExShop.sell_enable?(item)
  911.   end
  912.   #--------------------------------------------------------------------------
  913.   # ● ステータスウィンドウの設定
  914.   #--------------------------------------------------------------------------
  915.   def status_window=(status_window)
  916.     @status_window = status_window
  917.     call_update_help
  918.   end
  919.   #--------------------------------------------------------------------------
  920.   # ● ヘルプテキスト更新
  921.   #--------------------------------------------------------------------------
  922.   def update_help
  923.     super
  924.     @status_window.item = item if @status_window
  925.   end
  926. end



  927. #==============================================================================
  928. # ■ Window_ShopNumber
  929. #==============================================================================
  930. class Window_ShopNumber < Window_Selectable
  931.   #--------------------------------------------------------------------------
  932.   # ● 公開インスタンス変数
  933.   #--------------------------------------------------------------------------
  934.   attr_reader   :number                   # 入力された個数
  935.   #--------------------------------------------------------------------------
  936.   # ● オブジェクト初期化
  937.   #--------------------------------------------------------------------------
  938.   def initialize(x, y, width, height)
  939.     super(x, y, width, height)
  940.     @item = nil
  941.     [url=home.php?mod=space&uid=25307]@Max[/url] = 1
  942.     @price = 0
  943.     [url=home.php?mod=space&uid=27178]@Number[/url] = 1
  944.     @currency_unit = Vocab::currency_unit
  945.   end
  946. end


  947. #==============================================================================
  948. # ■ Window_ShopStatus
  949. #==============================================================================
  950. class Window_ShopStatus < Window_Base
  951.   #--------------------------------------------------------------------------
  952.   # ● オブジェクト初期化
  953.   #--------------------------------------------------------------------------
  954.   def initialize(x, y, width, height, actor)
  955.     super(x, y, width, height)
  956.     @item = nil
  957.     @page_index = actor.index
  958.     self.ox = 1 if page_max > 1
  959.     refresh
  960.   end
  961.   #--------------------------------------------------------------------------
  962.   # ● ウィンドウ内容の幅を計算
  963.   #--------------------------------------------------------------------------
  964.   def contents_width
  965.     super + (page_max > 1 ? 2 : 0)
  966.   end
  967.   #--------------------------------------------------------------------------
  968.   # ● リフレッシュ
  969.   #--------------------------------------------------------------------------
  970.   def refresh
  971.     contents.clear
  972.     actor = current_actor
  973.     enabled = @item.is_a?(RPG::EquipItem) ? actor.equippable?(@item) : false
  974.     draw_actor_face(actor, self.ox + contents_width - 96, 0, enabled)
  975.     change_color(normal_color, enabled)
  976.     draw_text(self.ox, 0, 112, line_height, actor.name)
  977.     return unless @item.is_a?(RPG::EquipItem)
  978.     draw_actor_equip_info(self.ox, line_height*2, actor, enabled)
  979.   end
  980.   #--------------------------------------------------------------------------
  981.   # ● 顔グラフィックの描画
  982.   #--------------------------------------------------------------------------
  983.   def draw_actor_face(actor, x, y, enabled = true)
  984.     bitmap = Cache.face(actor.face_name)
  985.     rect = Rect.new(actor.face_index % 4 * 96,
  986.                     actor.face_index / 4 * 96 + 16, 96, line_height*2)
  987.     contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
  988.     bitmap.dispose
  989.   end
  990.   #--------------------------------------------------------------------------
  991.   # ● アイテムの設定
  992.   #--------------------------------------------------------------------------
  993.   def item=(item)
  994.     @item = item
  995.     refresh
  996.   end
  997.   #--------------------------------------------------------------------------
  998.   # ● 表示中アクター
  999.   #--------------------------------------------------------------------------
  1000.   def current_actor
  1001.     $game_party.members[@page_index]
  1002.   end
  1003.   #--------------------------------------------------------------------------
  1004.   # ● 一度に表示できるアクターの人数
  1005.   #--------------------------------------------------------------------------
  1006.   def page_size
  1007.     return 1
  1008.   end
  1009.   #--------------------------------------------------------------------------
  1010.   # ● 最大ページ数の取得
  1011.   #--------------------------------------------------------------------------
  1012.   def page_max
  1013.     $game_party.members.size
  1014.   end
  1015.   #--------------------------------------------------------------------------
  1016.   # ● アクターの装備情報を描画
  1017.   #--------------------------------------------------------------------------
  1018.   def draw_actor_equip_info(x, y, actor, enabled)
  1019.     item1 = current_equipped_item(actor, @item.etype_id)
  1020.     prms = ExShop::GOLD_LD ? [2, 3, 4, 5] : [2, 3, 4, 5, 6, 7]
  1021.     prms.each do |prm|
  1022.       draw_actor_param_change(x, y, actor, item1, prm, enabled)
  1023.       y += line_height
  1024.     end
  1025.   end
  1026.   #--------------------------------------------------------------------------
  1027.   # ● アクターの能力値変化を描画
  1028.   #--------------------------------------------------------------------------
  1029.   def draw_actor_param_change(x, y, actor, item1, prm_id, enabled)
  1030.     rect = Rect.new(x, y, contents.width - 4 - x, line_height)
  1031.     change = @item.params[prm_id] - (item1 ? item1.params[prm_id] : 0)
  1032.     change_color(system_color, enabled)
  1033.     draw_text(rect, $data_system.terms.params[prm_id])
  1034.     if enabled
  1035.       change_color(param_change_color(change), enabled)
  1036.       draw_text(rect, sprintf("%+d", change), 2)
  1037.     else
  1038.       change_color(normal_color, enabled)
  1039.       draw_text(rect, "―", 2)
  1040.     end
  1041.   end
  1042.   #--------------------------------------------------------------------------
  1043.   # ● フレーム更新
  1044.   #--------------------------------------------------------------------------
  1045.   def update
  1046.     super
  1047.     update_page
  1048.   end
  1049.   #--------------------------------------------------------------------------
  1050.   # ● ページの更新
  1051.   #--------------------------------------------------------------------------
  1052.   def update_page
  1053.     if active && visible && page_max > 1
  1054.       next_page if Input.trigger?(:RIGHT)
  1055.       prev_page if Input.trigger?(:LEFT)
  1056.     end
  1057.   end
  1058.   #--------------------------------------------------------------------------
  1059.   # ● 指定ページへ
  1060.   #--------------------------------------------------------------------------
  1061.   def page_index=(index)
  1062.     @page_index = index
  1063.     refresh
  1064.   end
  1065.   #--------------------------------------------------------------------------
  1066.   # ● 次のページへ
  1067.   #--------------------------------------------------------------------------
  1068.   def next_page
  1069.     Sound.play_cursor
  1070.     @page_index = (@page_index + 1) % page_max
  1071.     refresh
  1072.   end
  1073.   #--------------------------------------------------------------------------
  1074.   # ● 前のページへ
  1075.   #--------------------------------------------------------------------------
  1076.   def prev_page
  1077.     Sound.play_cursor
  1078.     @page_index = (@page_index - 1 + page_max) % page_max
  1079.     refresh
  1080.   end
  1081. end


  1082. #==============================================================================
  1083. # ■ Window_ShopEquip
  1084. #==============================================================================
  1085. class Window_ShopEquip < Window_HorzCommand
  1086.   #--------------------------------------------------------------------------
  1087.   # ● オブジェクト初期化
  1088.   #--------------------------------------------------------------------------
  1089.   def initialize(x, y, width, height)
  1090.     @ww = width
  1091.     @wh = height
  1092.     super(x, y)
  1093.   end
  1094.   #--------------------------------------------------------------------------
  1095.   # ● ウィンドウ幅の取得
  1096.   #--------------------------------------------------------------------------
  1097.   def window_width
  1098.     @ww
  1099.   end
  1100.   #--------------------------------------------------------------------------
  1101.   # ● ウィンドウ高さの取得
  1102.   #--------------------------------------------------------------------------
  1103.   def window_height
  1104.     @wh
  1105.   end
  1106.   #--------------------------------------------------------------------------
  1107.   # ● 桁数の取得
  1108.   #--------------------------------------------------------------------------
  1109.   def col_max
  1110.     2
  1111.   end
  1112.   #--------------------------------------------------------------------------
  1113.   # ● ウィンドウ内容の高さを計算
  1114.   #--------------------------------------------------------------------------
  1115.   def contents_height
  1116.     height - standard_padding * 3
  1117.   end
  1118.   #--------------------------------------------------------------------------
  1119.   # ● 項目を描画する矩形の取得
  1120.   #--------------------------------------------------------------------------
  1121.   def item_rect(index)
  1122.     rect = super
  1123.     rect.y = 0
  1124.     rect.width = 80
  1125.     rect.x = 180 + index * (rect.width + spacing)
  1126.     rect
  1127.   end
  1128.   #--------------------------------------------------------------------------
  1129.   # ● コマンドリストの作成
  1130.   #--------------------------------------------------------------------------
  1131.   def make_command_list
  1132.     add_command("装备",   :equip)
  1133.     add_command("否", :cancel)
  1134.   end
  1135.   #--------------------------------------------------------------------------
  1136.   # ● リフレッシュ
  1137.   #--------------------------------------------------------------------------
  1138.   def set(actor=nil, item=nil)
  1139.     [url=home.php?mod=space&uid=95897]@actor[/url] = actor
  1140.     @item  = item
  1141.     refresh
  1142.   end
  1143.   #--------------------------------------------------------------------------
  1144.   # ● リフレッシュ
  1145.   #--------------------------------------------------------------------------
  1146.   def refresh
  1147.     super
  1148.     if !@actor.nil? and !@item.nil?
  1149.       draw_text(0, 0, 150, line_height,"是否装备?")
  1150.       draw_horz_line(line_height)
  1151.       draw_actor_equip(line_height * 2)
  1152.     end
  1153.   end
  1154.   #--------------------------------------------------------------------------
  1155.   # ● 水平線の描画
  1156.   #--------------------------------------------------------------------------
  1157.   def draw_horz_line(y)
  1158.     line_y = y + line_height / 2 - 1
  1159.     contents.fill_rect(0, line_y, contents_width, 2, line_color)
  1160.   end
  1161.   #--------------------------------------------------------------------------
  1162.   # ● 水平線の色を取得
  1163.   #--------------------------------------------------------------------------
  1164.   def line_color
  1165.     color = normal_color
  1166.     color.alpha = 48
  1167.     color
  1168.   end
  1169.   #--------------------------------------------------------------------------
  1170.   # ● アクターの装備情報を描画
  1171.   #--------------------------------------------------------------------------
  1172.   def draw_actor_equip(y)
  1173.     draw_actor_name(@actor, 4, y)
  1174.     item1 = current_equipped_item
  1175.     draw_item_name(item1, 140, y)
  1176.     draw_actor_param_changes(4, y + line_height, item1)
  1177.   end
  1178.   #--------------------------------------------------------------------------
  1179.   # ● 現在の装備品を取得
  1180.   #    二刀流など、同じ種類の装備が複数ある場合は弱い方を返す。
  1181.   #--------------------------------------------------------------------------
  1182.   def current_equipped_item
  1183.     list = []
  1184.     @actor.equip_slots.each_with_index do |slot_etype_id, i|
  1185.       list.push(@actor.equips[i]) if slot_etype_id == @item.etype_id
  1186.     end
  1187.     list.min_by {|item| item ? item.params[param_id] : 0 }
  1188.   end
  1189.   #--------------------------------------------------------------------------
  1190.   # ● 選択中のアイテムに対応する能力値 ID の取得
  1191.   #    デフォルトでは武器なら攻撃力、防具なら防御力とする。
  1192.   #--------------------------------------------------------------------------
  1193.   def param_id
  1194.     @item.is_a?(RPG::Weapon) ? 2 : 3
  1195.   end
  1196.   #--------------------------------------------------------------------------
  1197.   # ● アクターの装備情報を描画
  1198.   #--------------------------------------------------------------------------
  1199.   def draw_actor_param_changes(x, y, item)
  1200.     prms = [0, 1, 2, 3, 4, 5, 6, 7]
  1201.     rect = Rect.new(x, y, (contents_width-8) / 2, line_height)
  1202.     prms.each_index do |i|
  1203.       draw_actor_param_change(rect, item, prms[i])
  1204.       rect.y += rect.height
  1205.     end
  1206.   end
  1207.   #--------------------------------------------------------------------------
  1208.   # ● アクターの能力値変化を描画
  1209.   #--------------------------------------------------------------------------
  1210.   def draw_actor_param_change(rect, item1, prm_id)
  1211.     change = @item.params[prm_id] - (item1 ? item1.params[prm_id] : 0)
  1212.     change_color(system_color)
  1213.     draw_text(rect, $data_system.terms.params[prm_id])
  1214.     change_color(normal_color)
  1215.     r = Rect.new(rect.x + 70, rect.y, 80, rect.height)
  1216.     draw_text(r, @actor.param(prm_id), 2)
  1217.     return if change == 0
  1218.     r.x += r.width + 4
  1219.     draw_text(r, "→")
  1220.     change_color(param_change_color(change))
  1221.     draw_text(r, @actor.param(prm_id) + change , 2)
  1222.   end
  1223. end




  1224. #==============================================================================
  1225. # ■ Scene_Shop
  1226. #==============================================================================
  1227. class Scene_Shop < Scene_MenuBase
  1228.   #--------------------------------------------------------------------------
  1229.   # ● 準備
  1230.   #--------------------------------------------------------------------------
  1231.   def prepare(goods, purchase_only)
  1232.     @goods = goods
  1233.     @purchase_only = purchase_only
  1234.     [url=home.php?mod=space&uid=95897]@actor[/url] = $game_party.members[0]
  1235.   end
  1236.   #--------------------------------------------------------------------------
  1237.   # ● 準備
  1238.   #--------------------------------------------------------------------------
  1239.   def prepare_actor(actor)
  1240.     [url=home.php?mod=space&uid=95897]@actor[/url] = actor
  1241.   end
  1242.   #--------------------------------------------------------------------------
  1243.   # ● 開始処理
  1244.   #--------------------------------------------------------------------------
  1245.   def start
  1246.     super
  1247.     create_help_window
  1248.     create_gold_window
  1249.     create_command_window
  1250.     create_dummy_window
  1251.     create_status_window
  1252.     create_category_window
  1253.     create_buy_window
  1254.     create_sell_window
  1255.     create_number_window
  1256.     create_equip_window
  1257.   end
  1258.   #--------------------------------------------------------------------------
  1259.   # ● ゴールドウィンドウの作成
  1260.   #--------------------------------------------------------------------------
  1261.   def create_gold_window
  1262.     @gold_window = Window_Gold.new
  1263.     @gold_window.viewport = @viewport
  1264.     if ExShop::GOLD_LD
  1265.       @gold_window.y = Graphics.height - @gold_window.height
  1266.     else
  1267.       @gold_window.x = Graphics.width - @gold_window.width
  1268.       @gold_window.y = @help_window.height
  1269.       @gold_window.z = 200
  1270.     end
  1271.   end
  1272.   #--------------------------------------------------------------------------
  1273.   # ● コマンドウィンドウの作成
  1274.   #--------------------------------------------------------------------------
  1275.   def create_command_window
  1276.     @command_window = Window_ExShopCommand.new(@gold_window.width, @purchase_only)
  1277.     @command_window.viewport = @viewport
  1278.     @command_window.y = @help_window.height
  1279.     @command_window.set_handler(:buy,    method(:command_buy))
  1280.     @command_window.set_handler(:sell,   method(:command_sell))
  1281.     @command_window.set_handler(:equip,  method(:command_equip))
  1282.     @command_window.set_handler(:cancel, method(:return_scene))
  1283.   end
  1284.   #--------------------------------------------------------------------------
  1285.   # ● ダミーウィンドウの作成
  1286.   #--------------------------------------------------------------------------
  1287.   def create_dummy_window
  1288.     wx = @command_window.width
  1289.     wy = @help_window.height
  1290.     ww = Graphics.width  - wx
  1291.     wh = Graphics.height - wy
  1292.     @dummy_window = Window_Base.new(wx, wy, ww, wh)
  1293.     @dummy_window.viewport = @viewport
  1294.   end
  1295.   #--------------------------------------------------------------------------
  1296.   # ● 個数入力ウィンドウの作成
  1297.   #--------------------------------------------------------------------------
  1298.   def create_number_window
  1299.     wx = @buy_window.x
  1300.     wy = @buy_window.y
  1301.     ww = @buy_window.width
  1302.     wh = @buy_window.height
  1303.     @number_window = Window_ShopNumber.new(wx, wy, ww, wh)
  1304.     @number_window.viewport = @viewport
  1305.     @number_window.hide
  1306.     @number_window.set_handler(:ok,     method(:on_number_ok))
  1307.     @number_window.set_handler(:cancel, method(:on_number_cancel))
  1308.   end
  1309.   #--------------------------------------------------------------------------
  1310.   # ● ステータスウィンドウの作成
  1311.   #--------------------------------------------------------------------------
  1312.   def create_status_window
  1313.     wy = @command_window.y + @command_window.height
  1314.     ww = @command_window.width
  1315.     wh = Graphics.height - wy
  1316.     wh -= @gold_window.height if ExShop::GOLD_LD
  1317.     @status_window = Window_ShopStatus.new(0, wy, ww, wh, @actor)
  1318.     @status_window.viewport = @viewport
  1319.   end
  1320.   #--------------------------------------------------------------------------
  1321.   # ● カテゴリウィンドウの作成
  1322.   #--------------------------------------------------------------------------
  1323.   def create_category_window
  1324.     wx = @command_window.width
  1325.     wy = @help_window.height
  1326.     ww = Graphics.width - wx
  1327.     ww -= @gold_window.width unless ExShop::GOLD_LD
  1328.     @buy_ct_window = Window_ExShopBuyCt.new(wx, wy, ww)
  1329.     @buy_ct_window.viewport = @viewport
  1330.     @buy_ct_window.hide.deactivate
  1331.    
  1332.     @sell_ct_window = Window_ExShopSellCt.new(wx, wy, ww)
  1333.     @sell_ct_window.viewport = @viewport
  1334.     @sell_ct_window.hide.deactivate
  1335.   end
  1336.   #--------------------------------------------------------------------------
  1337.   # ● 購入ウィンドウの作成
  1338.   #--------------------------------------------------------------------------
  1339.   def create_buy_window
  1340.     wx = @dummy_window.x
  1341.     wy = @buy_ct_window.y + @buy_ct_window.height
  1342.     ww = Graphics.width - wx
  1343.     wh = Graphics.height - wy
  1344.     @buy_window = Window_ShopBuy.new(wx, wy, ww, wh, @goods)
  1345.     @buy_window.viewport = @viewport
  1346.     @buy_window.help_window = @help_window
  1347.     @buy_window.status_window = @status_window
  1348.     @buy_window.hide
  1349.     @buy_window.set_handler(:ok,       method(:on_buy_ok))
  1350.     @buy_window.set_handler(:cancel,   method(:on_buy_cancel))
  1351.     @buy_window.set_handler(:pagedown, method(:next_buy_ct))
  1352.     @buy_window.set_handler(:pageup,   method(:prev_buy_ct))
  1353.     @buy_ct_window.item_window = @buy_window
  1354.   end
  1355.   #--------------------------------------------------------------------------
  1356.   # ● 売却ウィンドウの作成
  1357.   #--------------------------------------------------------------------------
  1358.   def create_sell_window
  1359.     wx = @command_window.width
  1360.     wy = @sell_ct_window.y + @sell_ct_window.height
  1361.     ww = Graphics.width - wx
  1362.     wh = Graphics.height - wy
  1363.     @sell_window = Window_ShopSell.new(wx, wy, ww, wh)
  1364.     @sell_window.viewport = @viewport
  1365.     @sell_window.help_window = @help_window
  1366.     @sell_window.status_window = @status_window
  1367.     @sell_window.hide
  1368.     @sell_window.set_handler(:ok,     method(:on_sell_ok))
  1369.     @sell_window.set_handler(:cancel, method(:on_sell_cancel))
  1370.     @sell_window.set_handler(:pagedown, method(:next_sell_ct))
  1371.     @sell_window.set_handler(:pageup,   method(:prev_sell_ct))
  1372.     @sell_ct_window.item_window = @sell_window
  1373.   end
  1374.   #--------------------------------------------------------------------------
  1375.   # ● 装備ウィンドウの作成
  1376.   #--------------------------------------------------------------------------
  1377.   def create_equip_window
  1378.     wx = @number_window.x
  1379.     wy = @number_window.y
  1380.     ww = @number_window.width
  1381.     wh = @number_window.height
  1382.     @equip_window = Window_ShopEquip.new(wx, wy, ww, wh)
  1383.     @equip_window.hide.deactivate
  1384.     @equip_window.set_handler(:equip,  method(:on_equip_ok))
  1385.     @equip_window.set_handler(:cancel, method(:on_equip_cancel))
  1386.   end
  1387.   #--------------------------------------------------------------------------
  1388.   # ● コマンドウィンドウのアクティブ化
  1389.   #--------------------------------------------------------------------------
  1390.   def activate_cmd_window
  1391.     @command_window.activate
  1392.     @dummy_window.show
  1393.     @buy_ct_window.hide
  1394.     @buy_window.hide
  1395.     @sell_ct_window.hide
  1396.     @sell_window.hide
  1397.     @status_window.item = nil
  1398.     @help_window.clear
  1399.   end
  1400.   #--------------------------------------------------------------------------
  1401.   # ● 購入ウィンドウのアクティブ化
  1402.   #--------------------------------------------------------------------------
  1403.   def activate_buy_window
  1404.     @buy_ct_window.show
  1405.     @buy_window.money = money
  1406.     @buy_window.refresh
  1407.     @buy_window.show.activate
  1408.     @status_window.activate
  1409.   end
  1410.   #--------------------------------------------------------------------------
  1411.   # ● 売却ウィンドウのアクティブ化
  1412.   #--------------------------------------------------------------------------
  1413.   def activate_sell_window
  1414.     @sell_ct_window.show
  1415.     @sell_window.refresh
  1416.     @sell_window.show.activate
  1417.     @status_window.activate
  1418.   end
  1419.   #--------------------------------------------------------------------------
  1420.   # ● 装備ウィンドウのアクティブ化
  1421.   #--------------------------------------------------------------------------
  1422.   def activate_equip_window
  1423.     @equip_window.set(@status_window.current_actor, @item)
  1424.     @equip_window.show.activate
  1425.     @equip_window.select(0)
  1426.     @status_window.deactivate
  1427.   end
  1428.   #--------------------------------------------------------------------------
  1429.   # ● コマンド[購入する]
  1430.   #--------------------------------------------------------------------------
  1431.   def command_buy
  1432.     @dummy_window.hide
  1433.     activate_buy_window
  1434.     @buy_window.select(0)
  1435.   end
  1436.   #--------------------------------------------------------------------------
  1437.   # ● コマンド[売却する]
  1438.   #--------------------------------------------------------------------------
  1439.   def command_sell
  1440.     @dummy_window.hide
  1441.     activate_sell_window
  1442.     @sell_window.select(0)
  1443.   end
  1444.   #--------------------------------------------------------------------------
  1445.   # ● コマンド[装備]
  1446.   #--------------------------------------------------------------------------
  1447.   def command_equip
  1448.     SceneManager.call(Scene_ShopEquip)
  1449.     SceneManager.scene.prepare(@status_window.current_actor)
  1450.   end
  1451.   #--------------------------------------------------------------------------
  1452.   # ● 購入[決定]
  1453.   #--------------------------------------------------------------------------
  1454.   def on_buy_ok
  1455.     @item = @buy_window.item
  1456.     @buy_window.hide
  1457.     @number_window.set(@item, max_buy, buying_price, currency_unit)
  1458.     @number_window.show.activate
  1459.     @status_window.deactivate
  1460.   end
  1461.   #--------------------------------------------------------------------------
  1462.   # ● 購入[キャンセル]
  1463.   #--------------------------------------------------------------------------
  1464.   def on_buy_cancel
  1465.     activate_cmd_window
  1466.   end
  1467.   #--------------------------------------------------------------------------
  1468.   # ● 次の購入カテゴリに切り替え
  1469.   #--------------------------------------------------------------------------
  1470.   def next_buy_ct
  1471.     @buy_ct_window.cursor_right(true)
  1472.     @buy_ct_window.update_cursor
  1473.     @buy_ct_window.update
  1474.     @buy_window.activate.select(0)
  1475.     @buy_window.update_help
  1476.   end
  1477.   #--------------------------------------------------------------------------
  1478.   # ● 前の購入カテゴリに切り替え
  1479.   #--------------------------------------------------------------------------
  1480.   def prev_buy_ct
  1481.     @buy_ct_window.cursor_left(true)
  1482.     @buy_ct_window.update_cursor
  1483.     @buy_ct_window.update
  1484.     @buy_window.activate.select(0)
  1485.     @buy_window.update_help
  1486.   end
  1487.   #--------------------------------------------------------------------------
  1488.   # ● 売却[決定]
  1489.   #--------------------------------------------------------------------------
  1490.   def on_sell_ok
  1491.     @item = @sell_window.item
  1492.     @sell_window.hide
  1493.     @number_window.set(@item, max_sell, selling_price, currency_unit)
  1494.     @number_window.show.activate
  1495.     @status_window.deactivate
  1496.   end
  1497.   #--------------------------------------------------------------------------
  1498.   # ● 売却[キャンセル]
  1499.   #--------------------------------------------------------------------------
  1500.   def on_sell_cancel
  1501.     activate_cmd_window
  1502.   end
  1503.   #--------------------------------------------------------------------------
  1504.   # ● 次の売却カテゴリに切り替え
  1505.   #--------------------------------------------------------------------------
  1506.   def next_sell_ct
  1507.     @sell_ct_window.cursor_right(true)
  1508.     @sell_ct_window.update_cursor
  1509.     @sell_ct_window.update
  1510.     @sell_window.activate.select(0)
  1511.     @sell_window.update_help
  1512.   end
  1513.   #--------------------------------------------------------------------------
  1514.   # ● 前の売却カテゴリに切り替え
  1515.   #--------------------------------------------------------------------------
  1516.   def prev_sell_ct
  1517.     @sell_ct_window.cursor_left(true)
  1518.     @sell_ct_window.update_cursor
  1519.     @sell_ct_window.update
  1520.     @sell_window.activate.select(0)
  1521.     @sell_window.update_help
  1522.   end
  1523.   #--------------------------------------------------------------------------
  1524.   # ● 個数入力[決定]
  1525.   #--------------------------------------------------------------------------
  1526.   def on_number_ok
  1527.     Sound.play_shop
  1528.     case @command_window.current_symbol
  1529.     when :buy
  1530.       do_buy(@number_window.number)
  1531.     when :sell
  1532.       do_sell(@number_window.number)
  1533.     end
  1534.     end_number_input(true)
  1535.     @gold_window.refresh
  1536.     @status_window.refresh
  1537.   end
  1538.   #--------------------------------------------------------------------------
  1539.   # ● 個数入力[キャンセル]
  1540.   #--------------------------------------------------------------------------
  1541.   def on_number_cancel
  1542.     Sound.play_cancel
  1543.     end_number_input(false)
  1544.   end
  1545.   #--------------------------------------------------------------------------
  1546.   # ● 購入の実行
  1547.   #--------------------------------------------------------------------------
  1548.   def do_buy(number)
  1549.     $game_party.lose_gold(number * buying_price)
  1550.     $game_party.gain_item(@item, number)
  1551.     $game_system.shop.buy.gold += number * buying_price
  1552.   end
  1553.   #--------------------------------------------------------------------------
  1554.   # ● 売却の実行
  1555.   #--------------------------------------------------------------------------
  1556.   def do_sell(number)
  1557.     $game_party.gain_gold(number * selling_price)
  1558.     $game_party.lose_item(@item, number)
  1559.     $game_system.shop.sell.gold += number * selling_price
  1560.   end
  1561.   #--------------------------------------------------------------------------
  1562.   # ● 個数入力の終了
  1563.   #--------------------------------------------------------------------------
  1564.   def end_number_input(buy=true)
  1565.     @number_window.hide
  1566.     case @command_window.current_symbol
  1567.     when :buy
  1568.       if buy && @status_window.current_actor.equippable?(@item)
  1569.         activate_equip_window
  1570.       else
  1571.         activate_buy_window
  1572.       end
  1573.     when :sell
  1574.       activate_sell_window
  1575.     end
  1576.   end
  1577.   #--------------------------------------------------------------------------
  1578.   # ● 装備[決定]
  1579.   #--------------------------------------------------------------------------
  1580.   def on_equip_ok
  1581.     Sound.play_equip
  1582.     @equip_window.hide
  1583.     actor = @status_window.current_actor
  1584.     actor.change_equip(actor.empty_slot(@item.etype_id), @item)
  1585.     activate_buy_window
  1586.   end
  1587.   #--------------------------------------------------------------------------
  1588.   # ● 装備[キャンセル]
  1589.   #--------------------------------------------------------------------------
  1590.   def on_equip_cancel
  1591.     @equip_window.hide
  1592.     activate_buy_window
  1593.   end
  1594.   #--------------------------------------------------------------------------
  1595.   # ● 最大購入可能個数の取得
  1596.   #--------------------------------------------------------------------------
  1597.   def max_buy
  1598.     max = $game_party.max_item_number(@item) - $game_party.item_number(@item)
  1599.     buying_price == 0 ? max : [max, money / buying_price].min
  1600.   end
  1601.   #--------------------------------------------------------------------------
  1602.   # ● 売値の取得
  1603.   #--------------------------------------------------------------------------
  1604.   def selling_price
  1605.     ExShop::sell_price(@item, @item.price)
  1606.   end
  1607. end



  1608. #==============================================================================
  1609. # ■ Scene_ShopEquip
  1610. #------------------------------------------------------------------------------
  1611. # ショップ画面から呼び出す装備画面。メニューのものとは処理を分離。
  1612. # ($game_party.menu_actorは変化させない)
  1613. #==============================================================================
  1614. class Scene_ShopEquip < Scene_Equip
  1615.   #--------------------------------------------------------------------------
  1616.   # ● 準備
  1617.   #--------------------------------------------------------------------------
  1618.   def prepare(actor)
  1619.     @start_actor = actor
  1620.   end
  1621.   #--------------------------------------------------------------------------
  1622.   # ● 開始処理
  1623.   #--------------------------------------------------------------------------
  1624.   def start
  1625.     tmp_actor = $game_party.menu_actor
  1626.     $game_party.menu_actor = @start_actor
  1627.     super
  1628.     $game_party.menu_actor = tmp_actor
  1629.   end
  1630.   #--------------------------------------------------------------------------
  1631.   # ● 次のアクターに切り替え
  1632.   #--------------------------------------------------------------------------
  1633.   def next_actor
  1634.     tmp_actor = $game_party.menu_actor
  1635.     @actor = $game_party.menu_actor_next
  1636.     $game_party.menu_actor = tmp_actor
  1637.     on_actor_change
  1638.   end
  1639.   #--------------------------------------------------------------------------
  1640.   # ● 前のアクターに切り替え
  1641.   #--------------------------------------------------------------------------
  1642.   def prev_actor
  1643.     tmp_actor = $game_party.menu_actor
  1644.     @actor = $game_party.menu_actor_prev
  1645.     $game_party.menu_actor = tmp_actor
  1646.     on_actor_change
  1647.   end
  1648.   #--------------------------------------------------------------------------
  1649.   # ● 呼び出し元のシーンへ戻る
  1650.   #--------------------------------------------------------------------------
  1651.   def return_scene
  1652.     super
  1653.     SceneManager.scene.prepare_actor(@actor)
  1654.   end
  1655. end
复制代码
你的意思就是要打架咯?
梦石
0
星屑
22879
在线时间
8598 小时
注册时间
2011-12-31
回帖
3270
发表于 2013-11-21 23:10:52 | 显示全部楼层
試試把622刪去(在前面+「#」字)
  add_command(Vocab.equip,       :equip,  $game_party.members.size > 0)

点评

哈哈 大神就是靠的住啊 解决了 可以了 非常感谢你!  发表于 2013-11-22 00:21

评分

参与人数 2星屑 +1 梦石 +1 收起 理由
Sion + 1 认可答案
mabingjun626 + 1 认可答案

查看全部评分

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部