Project1

标题: 求一个可自己添加合成方式的合成系统~ [打印本页]

作者: xfx510061635    时间: 2012-10-5 14:14
标题: 求一个可自己添加合成方式的合成系统~
RT,我看了fxwd的脚本整合。
但打开网页后却显示无法显示网页~
召唤~
@fxwd
作者: yoyu1989    时间: 2012-10-6 20:18
http://dl.vmall.com/c07omsbtig
华为硬盘的?可以下的啊~是这个地址吗?这个一般人应该都能打开吧~
作者: fxwd    时间: 2012-10-7 10:08
召唤失败了。。。偶然点进来的。
下载地址可以下载啊,莫非LZ指的不是下载地址?
作者: qwrffdtqfsd    时间: 2012-10-7 14:07
本帖最后由 qwrffdtqfsd 于 2012-10-7 14:08 编辑
  1. #==============================================================================
  2. # ■ RGSS3 アイテム合成 ver 1.02
  3. #------------------------------------------------------------------------------
  4. #  配布元:
  5. #     白の魔 http://izumiwhite.web.fc2.com/
  6. #
  7. #  利用規約:
  8. #     RPGツクールVX Aceの正規の登録者のみご利用になれます。
  9. #     利用報告・著作権表示とかは必要ありません。
  10. #     改造もご自由にどうぞ。
  11. #     何か問題が発生しても責任は持ちません。
  12. #==============================================================================


  13. #--------------------------------------------------------------------------
  14. # ★ 初期設定。
  15. #    合成レシピ等の設定
  16. #--------------------------------------------------------------------------
  17. module WD_itemsynthesis_ini
  18.   
  19.   Cost_view =  true #費用(G)の表示(合成の費用が全て0Gの場合はfalseを推奨)
  20.   
  21.   Category_i = true #カテゴリウィンドウに「アイテム」の項目を表示
  22.   Category_w = true #カテゴリウィンドウに「武器」の項目を表示
  23.   Category_a = true #カテゴリウィンドウに「防具」の項目を表示
  24.   Category_k = true #カテゴリウィンドウに「大事なもの」の項目を表示
  25.   
  26.   I_recipe = [] #この行は削除しないこと
  27.   W_recipe = [] #この行は削除しないこと
  28.   A_recipe = [] #この行は削除しないこと
  29.   
  30.   #以下、合成レシピ。
  31.   #例: I_recipe[3]  = [100, ["I",1,1], ["W",2,1], ["A",2,2], ["A",3,1]]
  32.   #と記載した場合、ID3のアイテムの合成必要は、100G。
  33.   #必要な素材は、ID1のアイテム1個、ID2の武器1個、ID2の防具2個、ID3の防具1個
  34.   #となる。
  35.   
  36.   #アイテムの合成レシピ
  37.   I_recipe[2]  = [10,  ["I",1,2]]
  38.   I_recipe[3]  = [100, ["I",1,1], ["I",2,1]]
  39.   I_recipe[17] = [500, ["I",1,10]]

  40.   #武器の合成レシピ
  41.   W_recipe[3]  = [50,   ["W",1,1], ["W",2,1]]
  42.   W_recipe[6]  = [600,  ["W",3,1], ["I",17,0]]
  43.   
  44.   #防具の合成レシピ  
  45.   A_recipe[2]  = [40,   ["A",1,2]]
  46.   A_recipe[5]  = [400,  ["A",2,1], ["W",2,2], ["I",17,0]]
  47.   
  48. end


  49. #==============================================================================
  50. # ■ WD_itemsynthesis
  51. #------------------------------------------------------------------------------
  52. #  アイテム合成用の共通メソッドです。
  53. #==============================================================================

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

  140. end

  141. class Game_Interpreter
  142.   include WD_itemsynthesis
  143. end

  144. class Game_System
  145.   #--------------------------------------------------------------------------
  146.   # ● 公開インスタンス変数
  147.   #--------------------------------------------------------------------------
  148.   attr_accessor :i_rcp_sw
  149.   attr_accessor :w_rcp_sw
  150.   attr_accessor :a_rcp_sw
  151.   #--------------------------------------------------------------------------
  152.   # ● オブジェクト初期化
  153.   #--------------------------------------------------------------------------
  154.   alias wd_orig_initialize004 initialize
  155.   def initialize
  156.     wd_orig_initialize004
  157.     @i_rcp_sw = []
  158.     @w_rcp_sw = []
  159.     @a_rcp_sw = []
  160.   end
  161. end


  162. #==============================================================================
  163. # ■ Scene_ItemSynthesis
  164. #------------------------------------------------------------------------------
  165. #  合成画面の処理を行うクラスです。
  166. #==============================================================================

  167. class Scene_ItemSynthesis < Scene_MenuBase
  168.   #--------------------------------------------------------------------------
  169.   # ● 開始処理
  170.   #--------------------------------------------------------------------------
  171.   def start
  172.     super
  173.     create_help_window
  174.     create_dummy_window
  175.     create_number_window
  176.     create_status_window
  177.     create_material_window
  178.     create_list_window
  179.     create_category_window
  180.     create_gold_window
  181.     create_change_window
  182.   end
  183.   #--------------------------------------------------------------------------
  184.   # ● ゴールドウィンドウの作成
  185.   #--------------------------------------------------------------------------
  186.   def create_gold_window
  187.     @gold_window = Window_Gold.new
  188.     @gold_window.viewport = @viewport
  189.     @gold_window.x = Graphics.width - @gold_window.width
  190.     @gold_window.y = @help_window.height
  191.     @gold_window.hide
  192.   end
  193.   #--------------------------------------------------------------------------
  194.   # ● 切り替え表示ウィンドウの作成
  195.   #--------------------------------------------------------------------------
  196.   def create_change_window
  197.     wx = 0
  198.     wy = @gold_window.y
  199.     ww = Graphics.width - @gold_window.width
  200.     wh = @gold_window.height
  201.     @change_window = Window_ItemSynthesisChange.new(wx, wy, ww, wh)
  202.     @change_window.viewport = @viewport
  203.     @change_window.hide
  204.   end
  205.   #--------------------------------------------------------------------------
  206.   # ● ダミーウィンドウの作成
  207.   #--------------------------------------------------------------------------
  208.   def create_dummy_window
  209.     wy = @help_window.y + @help_window.height + 48
  210.     wh = Graphics.height - wy
  211.     @dummy_window = Window_Base.new(0, wy, Graphics.width, wh)
  212.     @dummy_window.viewport = @viewport
  213.   end
  214.   #--------------------------------------------------------------------------
  215.   # ● 個数入力ウィンドウの作成
  216.   #--------------------------------------------------------------------------
  217.   def create_number_window
  218.     wy = @dummy_window.y
  219.     wh = @dummy_window.height
  220.     @number_window = Window_ItemSynthesisNumber.new(0, wy, wh)
  221.     @number_window.viewport = @viewport
  222.     @number_window.hide
  223.     @number_window.set_handler(:ok,     method(:on_number_ok))
  224.     @number_window.set_handler(:cancel, method(:on_number_cancel))
  225.   end
  226.   #--------------------------------------------------------------------------
  227.   # ● ステータスウィンドウの作成
  228.   #--------------------------------------------------------------------------
  229.   def create_status_window
  230.     wx = @number_window.width
  231.     wy = @dummy_window.y
  232.     ww = Graphics.width - wx
  233.     wh = @dummy_window.height
  234.     @status_window = Window_ShopStatus.new(wx, wy, ww, wh)
  235.     @status_window.viewport = @viewport
  236.     @status_window.hide
  237.   end
  238.   #--------------------------------------------------------------------------
  239.   # ● 素材ウィンドウの作成
  240.   #--------------------------------------------------------------------------
  241.   def create_material_window
  242.     wx = @number_window.width
  243.     wy = @dummy_window.y
  244.     ww = Graphics.width - wx
  245.     wh = @dummy_window.height
  246.     @material_window = Window_ItemSynthesisMaterial.new(wx, wy, ww, wh)
  247.     @material_window.viewport = @viewport
  248.     @material_window.hide
  249.     @number_window.material_window = @material_window
  250.   end
  251.   #--------------------------------------------------------------------------
  252.   # ● 合成アイテムリストウィンドウの作成
  253.   #--------------------------------------------------------------------------
  254.   def create_list_window
  255.     wy = @dummy_window.y
  256.     wh = @dummy_window.height
  257.     @list_window = Window_ItemSynthesisList.new(0, wy, wh)
  258.     @list_window.viewport = @viewport
  259.     @list_window.help_window = @help_window
  260.     @list_window.status_window = @status_window
  261.     @list_window.material_window = @material_window
  262.     @list_window.hide
  263.     @list_window.set_handler(:ok,     method(:on_list_ok))
  264.     @list_window.set_handler(:cancel, method(:on_list_cancel))
  265.     @list_window.set_handler(:change_window, method(:on_change_window))   
  266.   end
  267.   #--------------------------------------------------------------------------
  268.   # ● カテゴリウィンドウの作成
  269.   #--------------------------------------------------------------------------
  270.   def create_category_window
  271.     @category_window = Window_ItemSynthesisCategory.new
  272.     @category_window.viewport = @viewport
  273.     @category_window.help_window = @help_window
  274.     @category_window.y = @help_window.height
  275.     @category_window.activate
  276.     @category_window.item_window = @list_window
  277.     @category_window.set_handler(:ok,     method(:on_category_ok))
  278.     @category_window.set_handler(:cancel, method(:return_scene))
  279.   end
  280.   #--------------------------------------------------------------------------
  281.   # ● 合成アイテムリストウィンドウのアクティブ化
  282.   #--------------------------------------------------------------------------
  283.   def activate_list_window
  284.     @list_window.money = money
  285.     @list_window.show.activate
  286.   end
  287.   #--------------------------------------------------------------------------
  288.   # ● 合成[決定]
  289.   #--------------------------------------------------------------------------
  290.   def on_list_ok
  291.     @item = @list_window.item
  292.     @list_window.hide
  293.     @number_window.set(@item, max_buy, buying_price, currency_unit)
  294.     @number_window.show.activate
  295.   end
  296.   #--------------------------------------------------------------------------
  297.   # ● 合成[キャンセル]
  298.   #--------------------------------------------------------------------------
  299.   def on_list_cancel
  300.     @category_window.activate
  301.     @category_window.show
  302.     @dummy_window.show
  303.     @list_window.hide
  304.     @status_window.hide
  305.     @status_window.item = nil
  306.     @material_window.hide
  307.     @material_window.set(nil, nil)
  308.     @gold_window.hide
  309.     @change_window.hide
  310.     @help_window.clear
  311.   end
  312.   #--------------------------------------------------------------------------
  313.   # ● 表示切替
  314.   #--------------------------------------------------------------------------
  315.   def on_change_window
  316.     if @status_window.visible
  317.       @status_window.hide
  318.       @material_window.show
  319.     else
  320.       @status_window.show
  321.       @material_window.hide
  322.     end
  323.   end
  324.   #--------------------------------------------------------------------------
  325.   # ● カテゴリ[決定]
  326.   #--------------------------------------------------------------------------
  327.   def on_category_ok
  328.     activate_list_window
  329.     @gold_window.show
  330.     @change_window.show
  331.     @material_window.show
  332.     @category_window.hide
  333.     @list_window.select(0)
  334.   end
  335.   #--------------------------------------------------------------------------
  336.   # ● 個数入力[決定]
  337.   #--------------------------------------------------------------------------
  338.   def on_number_ok
  339.     Sound.play_shop
  340.     do_syntetic(@number_window.number)
  341.     end_number_input
  342.     @gold_window.refresh
  343.   end
  344.   #--------------------------------------------------------------------------
  345.   # ● 個数入力[キャンセル]
  346.   #--------------------------------------------------------------------------
  347.   def on_number_cancel
  348.     Sound.play_cancel
  349.     end_number_input
  350.   end
  351.   #--------------------------------------------------------------------------
  352.   # ● 合成の実行
  353.   #--------------------------------------------------------------------------
  354.   def do_syntetic(number)
  355.     $game_party.lose_gold(number * buying_price)
  356.     $game_party.gain_item(@item, number)
  357.    
  358.       @recipe = @list_window.recipe(@item)
  359.       for i in [email protected]
  360.         kind = @recipe[i][0]
  361.         id   = @recipe[i][1]
  362.         num  = @recipe[i][2]
  363.         if kind == "I"
  364.           item = $data_items[id]
  365.         elsif kind == "W"
  366.           item = $data_weapons[id]
  367.         elsif kind == "A"
  368.           item = $data_armors[id]
  369.         end
  370.         $game_party.lose_item(item, num*number)
  371.       end
  372.   end
  373.   #--------------------------------------------------------------------------
  374.   # ● 個数入力の終了
  375.   #--------------------------------------------------------------------------
  376.   def end_number_input
  377.     @number_window.hide
  378.     activate_list_window
  379.   end
  380.   #--------------------------------------------------------------------------
  381.   # ● 最大購入可能個数の取得
  382.   #--------------------------------------------------------------------------
  383.   def max_buy
  384.     max = $game_party.max_item_number(@item) - $game_party.item_number(@item)
  385.    
  386.     @recipe = @list_window.recipe(@item)
  387.       for i in [email protected]
  388.         kind = @recipe[i][0]
  389.         id   = @recipe[i][1]
  390.         num  = @recipe[i][2]
  391.         if kind == "I"
  392.           item = $data_items[id]
  393.         elsif kind == "W"
  394.           item = $data_weapons[id]
  395.         elsif kind == "A"
  396.           item = $data_armors[id]
  397.         end
  398.         if num > 0
  399.           max_buf = $game_party.item_number(item)/num
  400.         else
  401.           max_buf = 999
  402.         end
  403.         max = [max, max_buf].min
  404.       end
  405.       
  406.     buying_price == 0 ? max : [max, money / buying_price].min

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


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

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


  667. #==============================================================================
  668. # ■ Window_ItemSynthesisMaterial
  669. #------------------------------------------------------------------------------
  670. #  合成画面で、合成に必要な素材を表示するウィンドウです。
  671. #==============================================================================

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


  749. #==============================================================================
  750. # ■ Window_ItemSynthesisNumber
  751. #------------------------------------------------------------------------------
  752. #  合成画面で、合成するアイテムの個数を入力するウィンドウです。
  753. #==============================================================================

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


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

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


  812. #==============================================================================
  813. # ■ Window_ItemSynthesisNumber
  814. #------------------------------------------------------------------------------
  815. #  合成画面で、切替を表示するウィンドウです。
  816. #==============================================================================

  817. class Window_ItemSynthesisChange < Window_Base
  818.   #--------------------------------------------------------------------------
  819.   # ● オブジェクト初期化
  820.   #--------------------------------------------------------------------------
  821.   def initialize(x, y, width, height)
  822.     super(x, y, width, height)
  823.     refresh
  824.   end
  825.   #--------------------------------------------------------------------------
  826.   # ● リフレッシュ
  827.   #--------------------------------------------------------------------------
  828.   def refresh
  829.     contents.clear
  830.     text = "X Y:表示切り替え"
  831.     draw_text(0, 0, contents_width, line_height, text, 1)
  832.   end
  833. end
复制代码
这个用着挺好~LZ可以试试




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