Project1

标题: 为什么白魔的合成脚本呼出界面会出错? [打印本页]

作者: c123r123    时间: 2016-7-8 19:20
标题: 为什么白魔的合成脚本呼出界面会出错?
本帖最后由 c123r123 于 2016-7-8 19:20 编辑

刚没写好保存了草稿还以为手贱发了==
指令是recipe_all_switch_on SceneManager.call(Scene_ItemSynthesis)
然后下面的是脚本。
  1. #==============================================================================
  2. # ■ RGSS3 合成 ver 1.01
  3. #------------------------------------------------------------------------------
  4. #  配布元:
  5. #     白の魔 http://izumiwhite.web.fc2.com/
  6. #
  7. #  利用規約:
  8. #     RPGツクールVXの正規の登録者のみご利用になれます。
  9. #     利用報告・著作権表示とかは必要ありません。
  10. #     改造もご自由にどうぞ。
  11. #     何か問題が発生しても責任は持ちません。
  12. #==============================================================================


  13. #--------------------------------------------------------------------------
  14. # ★ 初期設定。
  15. #    设定合成配方等
  16. #--------------------------------------------------------------------------
  17. module WD_itemsynthesis_ini

  18.   Cost_view =  false # 是否显示合成费用(合成费用全部是0的情况推荐改成false)

  19.   Category_i = true # 分类窗口显示是否显示「物品」项目
  20.   Category_w = true # 分类窗口显示是否显示「武器」项目
  21.   Category_a = true # 分类窗口显示是否显示「防具」项目
  22.   Category_k = true # 分类窗口显示是否显示「贵重物品」项目

  23.   I_recipe = [] # 这行不能删
  24.   W_recipe = [] # 这行不能删
  25.   A_recipe = [] # 这行不能删

  26.   # 在这下面开始设置合成配方。
  27.   # 例: I_recipe[3] = [100, ["I",1,1], ["W",2,1], ["A",2,2], ["A",3,1]]
  28.   # 像↑这样设置的情况,合成ID为3的【物品】所需要的花费是:100G。
  29.   # 所需要的素材是:ID为1的【物品】一件、ID为2的【武器】1件、ID为2的【防具】2件、ID为3的【防具】1件。
  30.   
  31.   # 此外,等号左边的名词:I_recipe是【物品】,W_recipe是【武器】,A_recipe是【防具】
  32.   # 等号右边的数组里面,"I"是【物品】,"W"是【武器】,"A"【防具】

  33.   # 这里下面几个是默认的几个公式,可以删除或者修改。
  34.   # 【物品】合成配方在下方开始设定:
  35.   I_recipe[1]  = [10,  ["I",2,2]]
  36.   
  37.   # 【武器】合成配方在下方开始设定:
  38.   W_recipe[5]   =   [100, ["I",45,15],["I",48,1]]


  39.   # 【防具】合成配方在下方开始设定:
  40.   A_recipe[2]  = [40,   ["A",1,2]]

  41.   
  42.   
  43.   
  44. end # 全部配方设定在这行之上,请勿写在此行以下。


  45. #==============================================================================
  46. # ■ WD_itemsynthesis
  47. #------------------------------------------------------------------------------
  48. #  物品合成相关的通用方法。
  49. #==============================================================================

  50. module WD_itemsynthesis
  51.   def i_recipe_switch_on(id)
  52.     $game_system.i_rcp_sw = [] if $game_system.i_rcp_sw == nil
  53.     $game_system.i_rcp_sw[id] = false if $game_system.i_rcp_sw[id] == nil
  54.     $game_system.i_rcp_sw[id] = true
  55.   end
  56.   def i_recipe_switch_off(id)
  57.     $game_system.i_rcp_sw = [] if $game_system.i_rcp_sw == nil
  58.     $game_system.i_rcp_sw[id] = false if $game_system.i_rcp_sw[id] == nil
  59.     $game_system.i_rcp_sw[id] = false
  60.   end
  61.   def i_recipe_switch_on?(id)
  62.     $game_system.i_rcp_sw = [] if $game_system.i_rcp_sw == nil
  63.     $game_system.i_rcp_sw[id] = false if $game_system.i_rcp_sw[id] == nil
  64.     return $game_system.i_rcp_sw[id]
  65.   end
  66.   def i_recipe_all_switch_on
  67.     for i in 1..$data_items.size
  68.       i_recipe_switch_on(i)
  69.     end
  70.   end
  71.   def i_recipe_all_switch_off
  72.     for i in 1..$data_items.size
  73.       i_recipe_switch_off(i)
  74.     end
  75.   end
  76.   def w_recipe_switch_on(id)
  77.     $game_system.w_rcp_sw = [] if $game_system.w_rcp_sw == nil
  78.     $game_system.w_rcp_sw[id] = false if $game_system.w_rcp_sw[id] == nil
  79.     $game_system.w_rcp_sw[id] = true
  80.   end
  81.   def w_recipe_switch_off(id)
  82.     $game_system.w_rcp_sw = [] if $game_system.w_rcp_sw == nil
  83.     $game_system.w_rcp_sw[id] = false if $game_system.w_rcp_sw[id] == nil
  84.     $game_system.w_rcp_sw[id] = false
  85.   end
  86.   def w_recipe_switch_on?(id)
  87.     $game_system.w_rcp_sw = [] if $game_system.w_rcp_sw == nil
  88.     $game_system.w_rcp_sw[id] = false if $game_system.w_rcp_sw[id] == nil
  89.     return $game_system.w_rcp_sw[id]
  90.   end
  91.   def w_recipe_all_switch_on
  92.     for i in 1..$data_weapons.size
  93.       w_recipe_switch_on(i)
  94.     end
  95.   end
  96.   def w_recipe_all_switch_off
  97.     for i in 1..$data_weapons.size
  98.       w_recipe_switch_off(i)
  99.     end
  100.   end
  101.   def a_recipe_switch_on(id)
  102.     $game_system.a_rcp_sw = [] if $game_system.a_rcp_sw == nil
  103.     $game_system.a_rcp_sw[id] = false if $game_system.a_rcp_sw[id] == nil
  104.     $game_system.a_rcp_sw[id] = true
  105.   end
  106.   def a_recipe_switch_off(id)
  107.     $game_system.a_rcp_sw = [] if $game_system.a_rcp_sw == nil
  108.     $game_system.a_rcp_sw[id] = false if $game_system.a_rcp_sw[id] == nil
  109.     $game_system.a_rcp_sw[id] = false
  110.   end
  111.   def a_recipe_switch_on?(id)
  112.     $game_system.a_rcp_sw = [] if $game_system.a_rcp_sw == nil
  113.     $game_system.a_rcp_sw[id] = false if $game_system.a_rcp_sw[id] == nil
  114.     return $game_system.a_rcp_sw[id]
  115.   end
  116.   def a_recipe_all_switch_on
  117.     for i in 1..$data_armors.size
  118.       a_recipe_switch_on(i)
  119.     end
  120.   end
  121.   def a_recipe_all_switch_off
  122.     for i in 1..$data_armors.size
  123.       a_recipe_switch_off(i)
  124.     end
  125.   end
  126.   def recipe_all_switch_on
  127.     i_recipe_all_switch_on
  128.     w_recipe_all_switch_on
  129.     a_recipe_all_switch_on
  130.   end
  131.   def recipe_all_switch_off
  132.     i_recipe_all_switch_off
  133.     w_recipe_all_switch_off
  134.     a_recipe_all_switch_off
  135.   end

  136. end

  137. class Game_Interpreter
  138.   include WD_itemsynthesis
  139. end

  140. class Game_System
  141.   #--------------------------------------------------------------------------
  142.   # ● 公开实例变量
  143.   #--------------------------------------------------------------------------
  144.   attr_accessor :i_rcp_sw
  145.   attr_accessor :w_rcp_sw
  146.   attr_accessor :a_rcp_sw
  147.   #--------------------------------------------------------------------------
  148.   # ● 初始化
  149.   #--------------------------------------------------------------------------
  150.   alias wd_orig_initialize004 initialize
  151.   def initialize
  152.     wd_orig_initialize004
  153.     @i_rcp_sw = []
  154.     @w_rcp_sw = []
  155.     @a_rcp_sw = []
  156.   end
  157. end


  158. #==============================================================================
  159. # ■ Scene_ItemSynthesis
  160. #------------------------------------------------------------------------------
  161. #  执行物品合成的界面。
  162. #==============================================================================

  163. class Scene_ItemSynthesis < Scene_MenuBase
  164.   #--------------------------------------------------------------------------
  165.   # ● 開始処理
  166.   #--------------------------------------------------------------------------
  167.   def start
  168.     super
  169.     create_help_window
  170.     create_dummy_window
  171.     create_number_window
  172.     create_status_window
  173.     create_material_window
  174.     create_list_window
  175.     create_category_window
  176.     create_gold_window
  177.     create_change_window
  178.   end
  179.   #--------------------------------------------------------------------------
  180.   # ● 建立金钱窗口
  181.   #--------------------------------------------------------------------------
  182.   def create_gold_window
  183.     @gold_window = Window_Gold.new
  184.     @gold_window.viewport = @viewport
  185.     @gold_window.x = Graphics.width - @gold_window.width
  186.     @gold_window.y = @help_window.height
  187.     @gold_window.hide
  188.   end
  189.   #--------------------------------------------------------------------------
  190.   # ● 建立交换窗口
  191.   #--------------------------------------------------------------------------
  192.   def create_change_window
  193.     wx = 0
  194.     wy = @gold_window.y
  195.     ww = Graphics.width - @gold_window.width
  196.     wh = @gold_window.height
  197.     @change_window = Window_ItemSynthesisChange.new(wx, wy, ww, wh)
  198.     @change_window.viewport = @viewport
  199.     @change_window.hide
  200.   end
  201.   #--------------------------------------------------------------------------
  202.   # ● 建立底部大框窗口
  203.   #--------------------------------------------------------------------------
  204.   def create_dummy_window
  205.     wy = @help_window.y + @help_window.height + 48
  206.     wh = Graphics.height - wy
  207.     @dummy_window = Window_Base.new(0, wy, Graphics.width, wh)
  208.     @dummy_window.viewport = @viewport
  209.   end
  210.   #--------------------------------------------------------------------------
  211.   # ● 建立数值输入窗口
  212.   #--------------------------------------------------------------------------
  213.   def create_number_window
  214.     wy = @dummy_window.y
  215.     wh = @dummy_window.height
  216.     @number_window = Window_ItemSynthesisNumber.new(0, wy, wh)
  217.     @number_window.viewport = @viewport
  218.     @number_window.hide
  219.     @number_window.set_handler(:ok,     method(:on_number_ok))
  220.     @number_window.set_handler(:cancel, method(:on_number_cancel))
  221.   end
  222.   #--------------------------------------------------------------------------
  223.   # ● 建立商店信息窗口
  224.   #--------------------------------------------------------------------------
  225.   def create_status_window
  226.     wx = @number_window.width
  227.     wy = @dummy_window.y
  228.     ww = Graphics.width - wx
  229.     wh = @dummy_window.height
  230.     @status_window = Window_ShopStatus.new(wx, wy, ww, wh)
  231.     @status_window.viewport = @viewport
  232.     @status_window.hide
  233.   end
  234.   #--------------------------------------------------------------------------
  235.   # ● 建立素材窗口
  236.   #--------------------------------------------------------------------------
  237.   def create_material_window
  238.     wx = @number_window.width
  239.     wy = @dummy_window.y
  240.     ww = Graphics.width - wx
  241.     wh = @dummy_window.height
  242.     @material_window = Window_ItemSynthesisMaterial.new(wx, wy, ww, wh)
  243.     @material_window.viewport = @viewport
  244.     @material_window.hide
  245.     @number_window.material_window = @material_window
  246.   end
  247.   #--------------------------------------------------------------------------
  248.   # ● 建立物品合成列表窗口
  249.   #--------------------------------------------------------------------------
  250.   def create_list_window
  251.     wy = @dummy_window.y
  252.     wh = @dummy_window.height
  253.     @list_window = Window_ItemSynthesisList.new(0, wy, wh)
  254.     @list_window.viewport = @viewport
  255.     @list_window.help_window = @help_window
  256.     @list_window.status_window = @status_window
  257.     @list_window.material_window = @material_window
  258.     @list_window.hide
  259.     @list_window.set_handler(:ok,     method(:on_list_ok))
  260.     @list_window.set_handler(:cancel, method(:on_list_cancel))
  261.     @list_window.set_handler(:change_window, method(:on_change_window))   
  262.   end
  263.   #--------------------------------------------------------------------------
  264.   # ● 建立物品分类窗口
  265.   #--------------------------------------------------------------------------
  266.   def create_category_window
  267.     @category_window = Window_ItemSynthesisCategory.new
  268.     @category_window.viewport = @viewport
  269.     @category_window.help_window = @help_window
  270.     @category_window.y = @help_window.height
  271.     @category_window.activate
  272.     @category_window.item_window = @list_window
  273.     @category_window.set_handler(:ok,     method(:on_category_ok))
  274.     @category_window.set_handler(:cancel, method(:return_scene))
  275.   end
  276.   
  277.   #--------------------------------------------------------------------------
  278.   # ● 界面返回
  279.   #--------------------------------------------------------------------------
  280.   def return_scene
  281.     $game_map.autoplay
  282.     SceneManager.return
  283.   end

  284.   #--------------------------------------------------------------------------
  285.   # ● 合成アイテムリストウィンドウのアクティブ化
  286.   #--------------------------------------------------------------------------
  287.   def activate_list_window
  288.     @list_window.money = money
  289.     @list_window.show.activate
  290.   end
  291.   #--------------------------------------------------------------------------
  292.   # ● 合成[決定]
  293.   #--------------------------------------------------------------------------
  294.   def on_list_ok
  295.     @item = @list_window.item
  296.     @list_window.hide
  297.     @number_window.set(@item, max_buy, buying_price, currency_unit)
  298.     @number_window.show.activate
  299.   end
  300.   #--------------------------------------------------------------------------
  301.   # ● 合成[キャンセル]
  302.   #--------------------------------------------------------------------------
  303.   def on_list_cancel
  304.     @category_window.activate
  305.     @category_window.show
  306.     @dummy_window.show
  307.     @list_window.hide
  308.     @status_window.hide
  309.     @status_window.item = nil
  310.     @material_window.hide
  311.     @material_window.set(nil, nil)
  312.     @gold_window.hide
  313.     @change_window.hide
  314.     @help_window.clear
  315.   end
  316.   #--------------------------------------------------------------------------
  317.   # ● 表示切替
  318.   #--------------------------------------------------------------------------
  319.   def on_change_window
  320.     if @status_window.visible
  321.       @status_window.hide
  322.       @material_window.show
  323.     else
  324.       @status_window.show
  325.       @material_window.hide
  326.     end
  327.   end
  328.   #--------------------------------------------------------------------------
  329.   # ● カテゴリ[決定]
  330.   #--------------------------------------------------------------------------
  331.   def on_category_ok
  332.     activate_list_window
  333.     @gold_window.show
  334.     @change_window.show
  335.     @material_window.show
  336.     @category_window.hide
  337.     @list_window.select(0)
  338.   end
  339.   #--------------------------------------------------------------------------
  340.   # ● 個数入力[決定]
  341.   #--------------------------------------------------------------------------
  342.   def on_number_ok
  343.     Sound.play_shop
  344.     do_syntetic(@number_window.number)
  345.     end_number_input
  346.     @gold_window.refresh
  347.   end
  348.   #--------------------------------------------------------------------------
  349.   # ● 個数入力[キャンセル]
  350.   #--------------------------------------------------------------------------
  351.   def on_number_cancel
  352.     Sound.play_cancel
  353.     end_number_input
  354.   end
  355.   #--------------------------------------------------------------------------
  356.   # ● 合成の実行
  357.   #--------------------------------------------------------------------------
  358.   def do_syntetic(number)
  359.     $game_party.lose_gold(number * buying_price)
  360.     $game_party.gain_item(@item, number)
  361.     [url=home.php?mod=space&uid=2564094]@recipe[/url] = @list_window.recipe(@item)
  362.     for i in [email protected]
  363.       kind = @recipe[i][0]
  364.       id   = @recipe[i][1]
  365.       num  = @recipe[i][2]
  366.       if kind == "I"
  367.         item = $data_items[id]
  368.       elsif kind == "W"
  369.         item = $data_weapons[id]
  370.       elsif kind == "A"
  371.         item = $data_armors[id]
  372.       end
  373.       $game_party.lose_item(item, num * number)
  374.     end
  375.   end
  376.   #--------------------------------------------------------------------------
  377.   # ● 個数入力の終了
  378.   #--------------------------------------------------------------------------
  379.   def end_number_input
  380.     @number_window.hide
  381.     activate_list_window
  382.   end
  383.   #--------------------------------------------------------------------------
  384.   # ● 最大購入可能個数の取得
  385.   #--------------------------------------------------------------------------
  386.   def max_buy
  387.     max = $game_party.max_item_number(@item) - $game_party.item_number(@item)

  388.     @recipe = @list_window.recipe(@item)
  389.     for i in [email protected]
  390.       kind = @recipe[i][0]
  391.       id   = @recipe[i][1]
  392.       num  = @recipe[i][2]
  393.       if kind == "I"
  394.         item = $data_items[id]
  395.       elsif kind == "W"
  396.         item = $data_weapons[id]
  397.       elsif kind == "A"
  398.         item = $data_armors[id]
  399.       end
  400.       if num > 0
  401.         max_buf = $game_party.item_number(item)/num
  402.       else
  403.         max_buf = 999
  404.       end
  405.       max = [max, max_buf].min
  406.     end
  407.     buying_price == 0 ? max : [max, money / buying_price].min

  408.   end
  409.   #--------------------------------------------------------------------------
  410.   # ● 所持金の取得
  411.   #--------------------------------------------------------------------------
  412.   def money
  413.     @gold_window.value
  414.   end
  415.   #--------------------------------------------------------------------------
  416.   # ● 通貨単位の取得
  417.   #--------------------------------------------------------------------------
  418.   def currency_unit
  419.     @gold_window.currency_unit
  420.   end
  421.   #--------------------------------------------------------------------------
  422.   # ● 合成費用の取得
  423.   #--------------------------------------------------------------------------
  424.   def buying_price
  425.     @list_window.price(@item)
  426.   end
  427. end


  428. #==============================================================================
  429. # ■ Window_ItemSynthesisList
  430. #------------------------------------------------------------------------------
  431. #  合成画面で、合成可能なアイテムの一覧を表示するウィンドウです。
  432. #==============================================================================

  433. class Window_ItemSynthesisList < Window_Selectable
  434.   include WD_itemsynthesis
  435.   #--------------------------------------------------------------------------
  436.   # ● 公開インスタンス変数
  437.   #--------------------------------------------------------------------------
  438.   attr_reader   :status_window            # ステータスウィンドウ
  439.   #--------------------------------------------------------------------------
  440.   # ● オブジェクト初期化
  441.   #--------------------------------------------------------------------------
  442.   def initialize(x, y, height)
  443.     super(x, y, window_width, height)

  444.     @shop_goods = []
  445.     @shop_recipes = []

  446.     for i in 1..WD_itemsynthesis_ini::I_recipe.size
  447.       recipe = WD_itemsynthesis_ini::I_recipe[i]
  448.       if recipe
  449.         good = [0, i, recipe[0]]
  450.         if i_recipe_switch_on?(i)
  451.           @shop_goods.push(good)
  452.           @shop_recipes.push(recipe)
  453.         end
  454.       end
  455.     end
  456.     for i in 1..WD_itemsynthesis_ini::W_recipe.size
  457.       recipe = WD_itemsynthesis_ini::W_recipe[i]
  458.       if recipe
  459.         good = [1, i, recipe[0]]
  460.         if w_recipe_switch_on?(i)
  461.           @shop_goods.push(good)
  462.           @shop_recipes.push(recipe)
  463.         end
  464.       end
  465.     end
  466.     for i in 1..WD_itemsynthesis_ini::A_recipe.size
  467.       recipe = WD_itemsynthesis_ini::A_recipe[i]
  468.       if recipe
  469.         good = [2, i, recipe[0]]
  470.         if a_recipe_switch_on?(i)
  471.           @shop_goods.push(good)
  472.           @shop_recipes.push(recipe)
  473.         end
  474.       end
  475.     end

  476.     [url=home.php?mod=space&uid=26101]@Money[/url] = 0
  477.     refresh
  478.     select(0)
  479.   end
  480.   #--------------------------------------------------------------------------
  481.   # ● ウィンドウ幅の取得
  482.   #--------------------------------------------------------------------------
  483.   def window_width
  484.     return 304
  485.   end
  486.   #--------------------------------------------------------------------------
  487.   # ● 項目数の取得
  488.   #--------------------------------------------------------------------------
  489.   def item_max
  490.     [url=home.php?mod=space&uid=2653549]@data[/url] ? @data.size : 1
  491.   end
  492.   #--------------------------------------------------------------------------
  493.   # ● アイテムの取得
  494.   #--------------------------------------------------------------------------
  495.   def item
  496.     @data[index]
  497.   end
  498.   #--------------------------------------------------------------------------
  499.   # ● 所持金の設定
  500.   #--------------------------------------------------------------------------
  501.   def money=(money)
  502.     @money = money
  503.     refresh
  504.   end
  505.   #--------------------------------------------------------------------------
  506.   # ● 選択項目の有効状態を取得
  507.   #--------------------------------------------------------------------------
  508.   def current_item_enabled?
  509.     enable?(@data[index])
  510.   end
  511.   #--------------------------------------------------------------------------
  512.   # ● 合成費用を取得
  513.   #--------------------------------------------------------------------------
  514.   def price(item)
  515.     @price[item]
  516.   end
  517.   #--------------------------------------------------------------------------
  518.   # ● 合成可否を取得
  519.   #--------------------------------------------------------------------------
  520.   def enable?(item)
  521.     @makable[item]
  522.   end
  523.   #--------------------------------------------------------------------------
  524.   # ● レシピを取得
  525.   #--------------------------------------------------------------------------
  526.   def recipe(item)
  527.     @recipe[item]
  528.   end
  529.   #--------------------------------------------------------------------------
  530.   # ● アイテムを許可状態で表示するかどうか
  531.   #--------------------------------------------------------------------------
  532.   def have_mat?(recipe)
  533.     flag = true
  534.     if @money >= recipe[0]
  535.       for i in 1...recipe.size
  536.         kind = recipe[i][0]
  537.         id   = recipe[i][1]
  538.         num  = recipe[i][2]
  539.         if kind == "I"
  540.           item = $data_items[id]
  541.         elsif kind == "W"
  542.           item = $data_weapons[id]
  543.         elsif kind == "A"
  544.           item = $data_armors[id]
  545.         end
  546.         if $game_party.item_number(item) < [num, 1].max
  547.           flag = false
  548.         end
  549.       end
  550.     else
  551.       flag = false
  552.     end
  553.     return flag
  554.   end
  555.   #--------------------------------------------------------------------------
  556.   # ● カテゴリの設定
  557.   #--------------------------------------------------------------------------
  558.   def category=(category)
  559.     return if @category == category
  560.     @category = category
  561.     refresh
  562.   end
  563.   #--------------------------------------------------------------------------
  564.   # ● リフレッシュ
  565.   #--------------------------------------------------------------------------
  566.   def refresh
  567.     make_item_list
  568.     create_contents
  569.     draw_all_items
  570.   end
  571.   #--------------------------------------------------------------------------
  572.   # ● アイテムをリストに含めるかどうか
  573.   #--------------------------------------------------------------------------
  574.   def include?(item)
  575.     case @category
  576.     when :item
  577.       item.is_a?(RPG::Item) && !item.key_item?
  578.     when :weapon
  579.       item.is_a?(RPG::Weapon)
  580.     when :armor
  581.       item.is_a?(RPG::Armor)
  582.     when :key_item
  583.       item.is_a?(RPG::Item) && item.key_item?
  584.     else
  585.       false
  586.     end
  587.   end
  588.   #--------------------------------------------------------------------------
  589.   # ● アイテムリストの作成
  590.   #--------------------------------------------------------------------------
  591.   def make_item_list
  592.     @data = []
  593.     @price = {}
  594.     @makable = {}
  595.     @recipe = {}
  596.     for i in 0...@shop_goods.size
  597.       goods = @shop_goods[i]
  598.       recipe = @shop_recipes[i]
  599.       case goods[0]
  600.       when 0;  item = $data_items[goods[1]]
  601.       when 1;  item = $data_weapons[goods[1]]
  602.       when 2;  item = $data_armors[goods[1]]
  603.       end
  604.       if item and include?(item)
  605.         @data.push(item)
  606.         @price[item] = goods[2]
  607.         @makable[item] = have_mat?(recipe)
  608.         @recipe[item] = recipe
  609.       end
  610.     end
  611.   end
  612.   #--------------------------------------------------------------------------
  613.   # ● 項目の描画
  614.   #--------------------------------------------------------------------------
  615.   def draw_item(index)
  616.     item = @data[index]
  617.     rect = item_rect(index)
  618.     draw_item_name(item, rect.x, rect.y, enable?(item))
  619.     rect.width -= 4
  620.     draw_text(rect, price(item), 2)  if WD_itemsynthesis_ini::Cost_view
  621.   end
  622.   #--------------------------------------------------------------------------
  623.   # ● ステータスウィンドウの設定
  624.   #--------------------------------------------------------------------------
  625.   def status_window=(status_window)
  626.     @status_window = status_window
  627.     call_update_help
  628.   end
  629.   #--------------------------------------------------------------------------
  630.   # ● 素材ウィンドウの設定
  631.   #--------------------------------------------------------------------------
  632.   def material_window=(material_window)
  633.     @material_window = material_window
  634.     call_update_help
  635.   end
  636.   #--------------------------------------------------------------------------
  637.   # ● ヘルプテキスト更新
  638.   #--------------------------------------------------------------------------
  639.   def update_help
  640.     @help_window.set_item(item) if @help_window
  641.     @status_window.item = item if @status_window
  642.     @material_window.set(item, recipe(item)) if @material_window
  643.   end
  644.   #--------------------------------------------------------------------------
  645.   # ● ←→ ボタン(表示切替)が押されたときの処理
  646.   #--------------------------------------------------------------------------
  647.   def process_change_window
  648.     Sound.play_cursor
  649.     Input.update
  650.     call_handler(:change_window)
  651.   end
  652.   #--------------------------------------------------------------------------
  653.   # ● 決定やキャンセルなどのハンドリング処理
  654.   #--------------------------------------------------------------------------
  655.   def process_handling
  656.     super
  657.     if active
  658.       return process_change_window if handle?(:change_window) && Input.trigger?(:RIGHT)
  659.       return process_change_window if handle?(:change_window) && Input.trigger?(:LEFT)
  660.     end
  661.   end
  662. end


  663. #==============================================================================
  664. # ■ Window_ItemSynthesisMaterial
  665. #------------------------------------------------------------------------------
  666. #  合成画面で、合成に必要な素材を表示するウィンドウです。
  667. #==============================================================================

  668. class Window_ItemSynthesisMaterial < Window_Base
  669.   #--------------------------------------------------------------------------
  670.   # ● オブジェクト初期化
  671.   #--------------------------------------------------------------------------
  672.   def initialize(x, y, width, height)
  673.     super(x, y, width, height)
  674.     @item = nil
  675.     refresh
  676.   end
  677.   #--------------------------------------------------------------------------
  678.   # ● リフレッシュ
  679.   #--------------------------------------------------------------------------
  680.   def refresh
  681.     contents.clear
  682.     draw_possession(4, 0)
  683.     draw_material_info(0, line_height * 2)
  684.   end
  685.   #--------------------------------------------------------------------------
  686.   # ● アイテムの設定
  687.   #--------------------------------------------------------------------------
  688.   def set(item, recipe)
  689.     @item = item
  690.     @recipe = recipe
  691.     @make_number = 1
  692.     refresh
  693.   end
  694.   #--------------------------------------------------------------------------
  695.   # ● 作成個数の設定
  696.   #--------------------------------------------------------------------------
  697.   def set_num(make_number)
  698.     @make_number = make_number
  699.     refresh
  700.   end
  701.   #--------------------------------------------------------------------------
  702.   # ● 所持数の描画
  703.   #--------------------------------------------------------------------------
  704.   def draw_possession(x, y)
  705.     rect = Rect.new(x, y, contents.width - 4 - x, line_height)
  706.     change_color(system_color)
  707.     draw_text(rect, Vocab::Possession)
  708.     change_color(normal_color)
  709.     draw_text(rect, $game_party.item_number(@item), 2)
  710.   end
  711.   #--------------------------------------------------------------------------
  712.   # ● 素材情報の描画
  713.   #--------------------------------------------------------------------------
  714.   def draw_material_info(x, y)
  715.     rect = Rect.new(x, y, contents.width, line_height)
  716.     change_color(system_color)
  717.     contents.font.size = 18
  718.     draw_text(rect, "必要素材", 0)
  719.     if @recipe
  720.       for i in [email protected]
  721.         kind = @recipe[i][0]
  722.         id   = @recipe[i][1]
  723.         num  = @recipe[i][2]
  724.         if kind == "I"
  725.           item = $data_items[id]
  726.         elsif kind == "W"
  727.           item = $data_weapons[id]
  728.         elsif kind == "A"
  729.           item = $data_armors[id]
  730.         end
  731.         rect = Rect.new(x, y + line_height*i, contents.width, line_height)
  732.         enabled = true
  733.         enabled = false if [num*@make_number, 1].max  > $game_party.item_number(item)
  734.         draw_item_name(item, rect.x, rect.y, enabled)
  735.         change_color(normal_color, enabled)
  736.         if num > 0
  737.           draw_text(rect, "#{num*@make_number}/#{$game_party.item_number(item)}", 2)
  738.         end
  739.       end
  740.     end
  741.     change_color(normal_color)
  742.     contents.font.size = 24
  743.   end
  744. end


  745. #==============================================================================
  746. # ■ Window_ItemSynthesisNumber
  747. #------------------------------------------------------------------------------
  748. #  合成画面で、合成するアイテムの個数を入力するウィンドウです。
  749. #==============================================================================

  750. class Window_ItemSynthesisNumber < Window_ShopNumber
  751.   #--------------------------------------------------------------------------
  752.   # ● リフレッシュ
  753.   #--------------------------------------------------------------------------
  754.   def refresh
  755.     contents.clear
  756.     draw_item_name(@item, 0, item_y)
  757.     draw_number
  758.     draw_total_price if WD_itemsynthesis_ini::Cost_view
  759.   end
  760.   #--------------------------------------------------------------------------
  761.   # ● オブジェクト初期化
  762.   #--------------------------------------------------------------------------
  763.   def material_window=(material_window)
  764.     @material_window = material_window
  765.     call_update_help
  766.   end
  767.   #--------------------------------------------------------------------------
  768.   # ● 作成個数の変更
  769.   #--------------------------------------------------------------------------
  770.   def change_number(amount)
  771.     @number = [[@number + amount, @max].min, 1].max
  772.     call_update_help #追加
  773.   end
  774.   #--------------------------------------------------------------------------
  775.   # ● ヘルプテキスト更新
  776.   #--------------------------------------------------------------------------
  777.   def call_update_help
  778.     @material_window.set_num(@number) if @material_window
  779.   end
  780. end


  781. #==============================================================================
  782. # ■ Window_ItemSynthesisCategory
  783. #------------------------------------------------------------------------------
  784. #  合成画面で、通常アイテムや装備品の分類を選択するウィンドウです。
  785. #==============================================================================

  786. class Window_ItemSynthesisCategory < Window_ItemCategory
  787.   #--------------------------------------------------------------------------
  788.   # ● 桁数の取得
  789.   #--------------------------------------------------------------------------
  790.   def col_max
  791.     i = 0
  792.     i += 1 if WD_itemsynthesis_ini::Category_i
  793.     i += 1 if WD_itemsynthesis_ini::Category_w
  794.     i += 1 if WD_itemsynthesis_ini::Category_a
  795.     i += 1 if WD_itemsynthesis_ini::Category_k
  796.     return i
  797.   end
  798.   #--------------------------------------------------------------------------
  799.   # ● コマンドリストの作成
  800.   #--------------------------------------------------------------------------
  801.   def make_command_list
  802.     add_command(Vocab::item,     :item)     if WD_itemsynthesis_ini::Category_i
  803.     add_command(Vocab::weapon,   :weapon)   if WD_itemsynthesis_ini::Category_w
  804.     add_command(Vocab::armor,    :armor)    if WD_itemsynthesis_ini::Category_a
  805.     add_command(Vocab::key_item, :key_item) if WD_itemsynthesis_ini::Category_k
  806.   end
  807. end


  808. #==============================================================================
  809. # ■ Window_ItemSynthesisNumber
  810. #------------------------------------------------------------------------------
  811. #  合成画面で、切替を表示するウィンドウです。
  812. #==============================================================================

  813. class Window_ItemSynthesisChange < Window_Base
  814.   #--------------------------------------------------------------------------
  815.   # ● オブジェクト初期化
  816.   #--------------------------------------------------------------------------
  817.   def initialize(x, y, width, height)
  818.     super(x, y, width, height)
  819.     refresh
  820.   end
  821.   #--------------------------------------------------------------------------
  822.   # ● リフレッシュ
  823.   #--------------------------------------------------------------------------
  824.   def refresh
  825.     contents.clear
  826.     text = "← → :显示转换"
  827.     draw_text(0, 0, contents_width, line_height, text, 1)
  828.   end
  829. end
复制代码


我记得这个脚本还能用指令禁止所有东西的合成,能临时添加合成配方,我忘了--。如果还能告诉我就最好了。

作者: 喵呜喵5    时间: 2016-7-8 21:45
指令不要写在同一行……分成两行写




欢迎光临 Project1 (https://rpg.blue/) Powered by Discuz! X3.1