设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 2738|回复: 5
打印 上一主题 下一主题

[已经过期] 关于物品合成脚本的问题

[复制链接]

Lv1.梦旅人

梦石
0
星屑
143
在线时间
347 小时
注册时间
2010-7-7
帖子
128
跳转到指定楼层
1
发表于 2013-6-20 11:53:04 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

x
这个是超级整合范例中的物品合成脚本:

其中选项是:物品,武器,防具以及贵重物品,由于道具种类和数量比较多,而武器和防具可以通过锻造脚本实现,所以我想把分类变为:药剂,材料,任务,和其他,分类通过物品的注释更改,本人脚本盲,请教各位该如何解决?
RUBY 代码复制
  1. #==============================================================================
  2. # ■ RGSS3 アイテム合成 ver 1.02
  3. #------------------------------------------------------------------------------
  4. #  配布元:
  5. #     白の魔 [url]http://izumiwhite.web.fc2.com/[/url]
  6. #
  7. #  利用規約:
  8. #     RPGツクールVX Aceの正規の登録者のみご利用になれます。
  9. #     利用報告・著作権表示とかは必要ありません。
  10. #     改造もご自由にどうぞ。
  11. #     何か問題が発生しても責任は持ちません。
  12. #==============================================================================
  13.  
  14.  
  15. #--------------------------------------------------------------------------
  16. # ★ 初期設定。
  17. #    合成レシピ等の設定
  18. #--------------------------------------------------------------------------
  19. module WD_itemsynthesis_ini
  20.  
  21.   Cost_view =  true #費用(G)の表示(合成の費用が全て0Gの場合はfalseを推奨)
  22.  
  23.   Category_i = true #カテゴリウィンドウに「アイテム」の項目を表示
  24.   Category_w = true #カテゴリウィンドウに「武器」の項目を表示
  25.   Category_a = true #カテゴリウィンドウに「防具」の項目を表示
  26.   Category_k = true #カテゴリウィンドウに「大事なもの」の項目を表示
  27.  
  28.   I_recipe = [] #この行は削除しないこと
  29.   W_recipe = [] #この行は削除しないこと
  30.   A_recipe = [] #この行は削除しないこと
  31.  
  32.   #以下、合成レシピ。
  33.   #例: I_recipe[3]  = [100, ["I",1,1], ["W",2,1], ["A",2,2], ["A",3,1]]
  34.   #と記載した場合、ID3のアイテムの合成必要は、100G。
  35.   #必要な素材は、ID1のアイテム1個、ID2の武器1個、ID2の防具2個、ID3の防具1個
  36.   #となる。
  37.  
  38.   #アイテムの合成レシピ
  39.   I_recipe[2]  = [10,  ["I",1,2]]
  40.   #I_recipe[3]  = [100, ["I",1,1], ["I",2,1]]
  41.   #I_recipe[17] = [500, ["I",1,10]]
  42.  
  43.   #武器の合成レシピ
  44.   W_recipe[3]  = [50,   ["W",1,1], ["W",2,1]]
  45.   #W_recipe[6]  = [600,  ["W",3,1], ["I",17,0]]
  46.  
  47.   #防具の合成レシピ  
  48.   A_recipe[2]  = [40,   ["A",1,2]]
  49.   #A_recipe[5]  = [400,  ["A",2,1], ["W",2,2], ["I",17,0]]
  50.  
  51. end
  52.  
  53.  
  54. #==============================================================================
  55. # ■ WD_itemsynthesis
  56. #------------------------------------------------------------------------------
  57. #  アイテム合成用の共通メソッドです。
  58. #==============================================================================
  59.  
  60. module WD_itemsynthesis
  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.     $game_system.i_rcp_sw[id] = true
  65.   end
  66.   def i_recipe_switch_off(id)
  67.     $game_system.i_rcp_sw = [] if $game_system.i_rcp_sw == nil
  68.     $game_system.i_rcp_sw[id] = false if $game_system.i_rcp_sw[id] == nil
  69.     $game_system.i_rcp_sw[id] = false
  70.   end
  71.   def i_recipe_switch_on?(id)
  72.     $game_system.i_rcp_sw = [] if $game_system.i_rcp_sw == nil
  73.     $game_system.i_rcp_sw[id] = false if $game_system.i_rcp_sw[id] == nil
  74.     return $game_system.i_rcp_sw[id]
  75.   end
  76.   def i_recipe_all_switch_on
  77.     for i in 1..$data_items.size
  78.       i_recipe_switch_on(i)
  79.     end
  80.   end
  81.   def i_recipe_all_switch_off
  82.     for i in 1..$data_items.size
  83.       i_recipe_switch_off(i)
  84.     end
  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.     $game_system.w_rcp_sw[id] = true
  90.   end
  91.   def w_recipe_switch_off(id)
  92.     $game_system.w_rcp_sw = [] if $game_system.w_rcp_sw == nil
  93.     $game_system.w_rcp_sw[id] = false if $game_system.w_rcp_sw[id] == nil
  94.     $game_system.w_rcp_sw[id] = false
  95.   end
  96.   def w_recipe_switch_on?(id)
  97.     $game_system.w_rcp_sw = [] if $game_system.w_rcp_sw == nil
  98.     $game_system.w_rcp_sw[id] = false if $game_system.w_rcp_sw[id] == nil
  99.     return $game_system.w_rcp_sw[id]
  100.   end
  101.   def w_recipe_all_switch_on
  102.     for i in 1..$data_weapons.size
  103.       w_recipe_switch_on(i)
  104.     end
  105.   end
  106.   def w_recipe_all_switch_off
  107.     for i in 1..$data_weapons.size
  108.       w_recipe_switch_off(i)
  109.     end
  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.     $game_system.a_rcp_sw[id] = true
  115.   end
  116.   def a_recipe_switch_off(id)
  117.     $game_system.a_rcp_sw = [] if $game_system.a_rcp_sw == nil
  118.     $game_system.a_rcp_sw[id] = false if $game_system.a_rcp_sw[id] == nil
  119.     $game_system.a_rcp_sw[id] = false
  120.   end
  121.   def a_recipe_switch_on?(id)
  122.     $game_system.a_rcp_sw = [] if $game_system.a_rcp_sw == nil
  123.     $game_system.a_rcp_sw[id] = false if $game_system.a_rcp_sw[id] == nil
  124.     return $game_system.a_rcp_sw[id]
  125.   end
  126.   def a_recipe_all_switch_on
  127.     for i in 1..$data_armors.size
  128.       a_recipe_switch_on(i)
  129.     end
  130.   end
  131.   def a_recipe_all_switch_off
  132.     for i in 1..$data_armors.size
  133.       a_recipe_switch_off(i)
  134.     end
  135.   end
  136.   def recipe_all_switch_on
  137.     i_recipe_all_switch_on
  138.     w_recipe_all_switch_on
  139.     a_recipe_all_switch_on
  140.   end
  141.   def recipe_all_switch_off
  142.     i_recipe_all_switch_off
  143.     w_recipe_all_switch_off
  144.     a_recipe_all_switch_off
  145.   end
  146.  
  147. end
  148.  
  149. class Game_Interpreter
  150.   include WD_itemsynthesis
  151. end
  152.  
  153. class Game_System
  154.   #--------------------------------------------------------------------------
  155.   # ● 公開インスタンス変数
  156.   #--------------------------------------------------------------------------
  157.   attr_accessor :i_rcp_sw
  158.   attr_accessor :w_rcp_sw
  159.   attr_accessor :a_rcp_sw
  160.   #--------------------------------------------------------------------------
  161.   # ● オブジェクト初期化
  162.   #--------------------------------------------------------------------------
  163.   alias wd_orig_initialize004 initialize
  164.   def initialize
  165.     wd_orig_initialize004
  166.     @i_rcp_sw = []
  167.     @w_rcp_sw = []
  168.     @a_rcp_sw = []
  169.   end
  170. end
  171.  
  172.  
  173. #==============================================================================
  174. # ■ Scene_ItemSynthesis
  175. #------------------------------------------------------------------------------
  176. #  合成画面の処理を行うクラスです。
  177. #==============================================================================
  178.  
  179. class Scene_ItemSynthesis < Scene_MenuBase
  180.   #--------------------------------------------------------------------------
  181.   # ● 開始処理
  182.   #--------------------------------------------------------------------------
  183.   def start
  184.     super
  185.     create_help_window
  186.     create_dummy_window
  187.     create_number_window
  188.     create_status_window
  189.     create_material_window
  190.     create_list_window
  191.     create_category_window
  192.     create_gold_window
  193.     create_change_window
  194.   end
  195.   #--------------------------------------------------------------------------
  196.   # ● ゴールドウィンドウの作成
  197.   #--------------------------------------------------------------------------
  198.   def create_gold_window
  199.     @gold_window = Window_Gold.new
  200.     @gold_window.viewport = @viewport
  201.     @gold_window.x = Graphics.width - @gold_window.width
  202.     @gold_window.y = @help_window.height
  203.     @gold_window.hide
  204.   end
  205.   #--------------------------------------------------------------------------
  206.   # ● 切り替え表示ウィンドウの作成
  207.   #--------------------------------------------------------------------------
  208.   def create_change_window
  209.     wx = 0
  210.     wy = @gold_window.y
  211.     ww = Graphics.width - @gold_window.width
  212.     wh = @gold_window.height
  213.     @change_window = Window_ItemSynthesisChange.new(wx, wy, ww, wh)
  214.     @change_window.viewport = @viewport
  215.     @change_window.hide
  216.   end
  217.   #--------------------------------------------------------------------------
  218.   # ● ダミーウィンドウの作成
  219.   #--------------------------------------------------------------------------
  220.   def create_dummy_window
  221.     wy = @help_window.y + @help_window.height + 48
  222.     wh = Graphics.height - wy
  223.     @dummy_window = Window_Base.new(0, wy, Graphics.width, wh)
  224.     @dummy_window.viewport = @viewport
  225.   end
  226.   #--------------------------------------------------------------------------
  227.   # ● 個数入力ウィンドウの作成
  228.   #--------------------------------------------------------------------------
  229.   def create_number_window
  230.     wy = @dummy_window.y
  231.     wh = @dummy_window.height
  232.     @number_window = Window_ItemSynthesisNumber.new(0, wy, wh)
  233.     @number_window.viewport = @viewport
  234.     @number_window.hide
  235.     @number_window.set_handler(:ok,     method(:on_number_ok))
  236.     @number_window.set_handler(:cancel, method(:on_number_cancel))
  237.   end
  238.   #--------------------------------------------------------------------------
  239.   # ● ステータスウィンドウの作成
  240.   #--------------------------------------------------------------------------
  241.   def create_status_window
  242.     wx = @number_window.width
  243.     wy = @dummy_window.y
  244.     ww = Graphics.width - wx
  245.     wh = @dummy_window.height
  246.     @status_window = Window_ShopStatus.new(wx, wy, ww, wh)
  247.     @status_window.viewport = @viewport
  248.     @status_window.hide
  249.   end
  250.   #--------------------------------------------------------------------------
  251.   # ● 素材ウィンドウの作成
  252.   #--------------------------------------------------------------------------
  253.   def create_material_window
  254.     wx = @number_window.width
  255.     wy = @dummy_window.y
  256.     ww = Graphics.width - wx
  257.     wh = @dummy_window.height
  258.     @material_window = Window_ItemSynthesisMaterial.new(wx, wy, ww, wh)
  259.     @material_window.viewport = @viewport
  260.     @material_window.hide
  261.     @number_window.material_window = @material_window
  262.   end
  263.   #--------------------------------------------------------------------------
  264.   # ● 合成アイテムリストウィンドウの作成
  265.   #--------------------------------------------------------------------------
  266.   def create_list_window
  267.     wy = @dummy_window.y
  268.     wh = @dummy_window.height
  269.     @list_window = Window_ItemSynthesisList.new(0, wy, wh)
  270.     @list_window.viewport = @viewport
  271.     @list_window.help_window = @help_window
  272.     @list_window.status_window = @status_window
  273.     @list_window.material_window = @material_window
  274.     @list_window.hide
  275.     @list_window.set_handler(:ok,     method(:on_list_ok))
  276.     @list_window.set_handler(:cancel, method(:on_list_cancel))
  277.     @list_window.set_handler(:change_window, method(:on_change_window))   
  278.   end
  279.   #--------------------------------------------------------------------------
  280.   # ● カテゴリウィンドウの作成
  281.   #--------------------------------------------------------------------------
  282.   def create_category_window
  283.     @category_window = Window_ItemSynthesisCategory.new
  284.     @category_window.viewport = @viewport
  285.     @category_window.help_window = @help_window
  286.     @category_window.y = @help_window.height
  287.     @category_window.activate
  288.     @category_window.item_window = @list_window
  289.     @category_window.set_handler(:ok,     method(:on_category_ok))
  290.     @category_window.set_handler(:cancel, method(:return_scene))
  291.   end
  292.   #--------------------------------------------------------------------------
  293.   # ● 合成アイテムリストウィンドウのアクティブ化
  294.   #--------------------------------------------------------------------------
  295.   def activate_list_window
  296.     @list_window.money = money
  297.     @list_window.show.activate
  298.   end
  299.   #--------------------------------------------------------------------------
  300.   # ● 合成[決定]
  301.   #--------------------------------------------------------------------------
  302.   def on_list_ok
  303.     @item = @list_window.item
  304.     @list_window.hide
  305.     @number_window.set(@item, max_buy, buying_price, currency_unit)
  306.     @number_window.show.activate
  307.   end
  308.   #--------------------------------------------------------------------------
  309.   # ● 合成[キャンセル]
  310.   #--------------------------------------------------------------------------
  311.   def on_list_cancel
  312.     @category_window.activate
  313.     @category_window.show
  314.     @dummy_window.show
  315.     @list_window.hide
  316.     @status_window.hide
  317.     @status_window.item = nil
  318.     @material_window.hide
  319.     @material_window.set(nil, nil)
  320.     @gold_window.hide
  321.     @change_window.hide
  322.     @help_window.clear
  323.   end
  324.   #--------------------------------------------------------------------------
  325.   # ● 表示切替
  326.   #--------------------------------------------------------------------------
  327.   def on_change_window
  328.     if @status_window.visible
  329.       @status_window.hide
  330.       @material_window.show
  331.     else
  332.       @status_window.show
  333.       @material_window.hide
  334.     end
  335.   end
  336.   #--------------------------------------------------------------------------
  337.   # ● カテゴリ[決定]
  338.   #--------------------------------------------------------------------------
  339.   def on_category_ok
  340.     activate_list_window
  341.     @gold_window.show
  342.     @change_window.show
  343.     @material_window.show
  344.     @category_window.hide
  345.     @list_window.select(0)
  346.   end
  347.   #--------------------------------------------------------------------------
  348.   # ● 個数入力[決定]
  349.   #--------------------------------------------------------------------------
  350.   def on_number_ok
  351.     Sound.play_shop
  352.     do_syntetic(@number_window.number)
  353.     end_number_input
  354.     @gold_window.refresh
  355.   end
  356.   #--------------------------------------------------------------------------
  357.   # ● 個数入力[キャンセル]
  358.   #--------------------------------------------------------------------------
  359.   def on_number_cancel
  360.     Sound.play_cancel
  361.     end_number_input
  362.   end
  363.   #--------------------------------------------------------------------------
  364.   # ● 合成の実行
  365.   #--------------------------------------------------------------------------
  366.   def do_syntetic(number)
  367.     $game_party.lose_gold(number * buying_price)
  368.     $game_party.gain_item(@item, number)
  369.  
  370.       @recipe = @list_window.recipe(@item)
  371.       for i in [email]1...@recipe.size[/email]
  372.         kind = @recipe[i][0]
  373.         id   = @recipe[i][1]
  374.         num  = @recipe[i][2]
  375.         if kind == "I"
  376.           item = $data_items[id]
  377.         elsif kind == "W"
  378.           item = $data_weapons[id]
  379.         elsif kind == "A"
  380.           item = $data_armors[id]
  381.         end
  382.         $game_party.lose_item(item, num*number)
  383.       end
  384.   end
  385.   #--------------------------------------------------------------------------
  386.   # ● 個数入力の終了
  387.   #--------------------------------------------------------------------------
  388.   def end_number_input
  389.     @number_window.hide
  390.     activate_list_window
  391.   end
  392.   #--------------------------------------------------------------------------
  393.   # ● 最大購入可能個数の取得
  394.   #--------------------------------------------------------------------------
  395.   def max_buy
  396.     max = $game_party.max_item_number(@item) - $game_party.item_number(@item)
  397.  
  398.     @recipe = @list_window.recipe(@item)
  399.       for i in [email]1...@recipe.size[/email]
  400.         kind = @recipe[i][0]
  401.         id   = @recipe[i][1]
  402.         num  = @recipe[i][2]
  403.         if kind == "I"
  404.           item = $data_items[id]
  405.         elsif kind == "W"
  406.           item = $data_weapons[id]
  407.         elsif kind == "A"
  408.           item = $data_armors[id]
  409.         end
  410.         if num > 0
  411.           max_buf = $game_party.item_number(item)/num
  412.         else
  413.           max_buf = 999
  414.         end
  415.         max = [max, max_buf].min
  416.       end
  417.  
  418.     buying_price == 0 ? max : [max, money / buying_price].min
  419.  
  420.   end
  421.   #--------------------------------------------------------------------------
  422.   # ● 所持金の取得
  423.   #--------------------------------------------------------------------------
  424.   def money
  425.     @gold_window.value
  426.   end
  427.   #--------------------------------------------------------------------------
  428.   # ● 通貨単位の取得
  429.   #--------------------------------------------------------------------------
  430.   def currency_unit
  431.     @gold_window.currency_unit
  432.   end
  433.   #--------------------------------------------------------------------------
  434.   # ● 合成費用の取得
  435.   #--------------------------------------------------------------------------
  436.   def buying_price
  437.     @list_window.price(@item)
  438.   end
  439. end
  440.  
  441.  
  442. #==============================================================================
  443. # ■ Window_ItemSynthesisList
  444. #------------------------------------------------------------------------------
  445. #  合成画面で、合成可能なアイテムの一覧を表示するウィンドウです。
  446. #==============================================================================
  447.  
  448. class Window_ItemSynthesisList < Window_Selectable
  449.   include WD_itemsynthesis
  450.   #--------------------------------------------------------------------------
  451.   # ● 公開インスタンス変数
  452.   #--------------------------------------------------------------------------
  453.   attr_reader   :status_window            # ステータスウィンドウ
  454.   #--------------------------------------------------------------------------
  455.   # ● オブジェクト初期化
  456.   #--------------------------------------------------------------------------
  457.   def initialize(x, y, height)
  458.     super(x, y, window_width, height)
  459.  
  460.     @shop_goods = []
  461.     @shop_recipes = []
  462.  
  463.     for i in 1..WD_itemsynthesis_ini::I_recipe.size
  464.       recipe = WD_itemsynthesis_ini::I_recipe[i]
  465.       if recipe
  466.         good = [0, i, recipe[0]]
  467.         if i_recipe_switch_on?(i)
  468.           @shop_goods.push(good)
  469.           @shop_recipes.push(recipe)
  470.         end
  471.       end
  472.     end
  473.     for i in 1..WD_itemsynthesis_ini::W_recipe.size
  474.       recipe = WD_itemsynthesis_ini::W_recipe[i]
  475.       if recipe
  476.         good = [1, i, recipe[0]]
  477.         if w_recipe_switch_on?(i)
  478.           @shop_goods.push(good)
  479.           @shop_recipes.push(recipe)
  480.         end
  481.       end
  482.     end
  483.     for i in 1..WD_itemsynthesis_ini::A_recipe.size
  484.       recipe = WD_itemsynthesis_ini::A_recipe[i]
  485.       if recipe
  486.         good = [2, i, recipe[0]]
  487.         if a_recipe_switch_on?(i)
  488.           @shop_goods.push(good)
  489.           @shop_recipes.push(recipe)
  490.         end
  491.       end
  492.     end
  493.  
  494.     [url=home.php?mod=space&uid=26101]@Money[/url] = 0
  495.     refresh
  496.     select(0)
  497.   end
  498.   #--------------------------------------------------------------------------
  499.   # ● ウィンドウ幅の取得
  500.   #--------------------------------------------------------------------------
  501.   def window_width
  502.     return 304
  503.   end
  504.   #--------------------------------------------------------------------------
  505.   # ● 項目数の取得
  506.   #--------------------------------------------------------------------------
  507.   def item_max
  508.     @data ? @data.size : 1
  509.   end
  510.   #--------------------------------------------------------------------------
  511.   # ● アイテムの取得
  512.   #--------------------------------------------------------------------------
  513.   def item
  514.     @data[index]
  515.   end
  516.   #--------------------------------------------------------------------------
  517.   # ● 所持金の設定
  518.   #--------------------------------------------------------------------------
  519.   def money=(money)
  520.     @money = money
  521.     refresh
  522.   end
  523.   #--------------------------------------------------------------------------
  524.   # ● 選択項目の有効状態を取得
  525.   #--------------------------------------------------------------------------
  526.   def current_item_enabled?
  527.     enable?(@data[index])
  528.   end
  529.   #--------------------------------------------------------------------------
  530.   # ● 合成費用を取得
  531.   #--------------------------------------------------------------------------
  532.   def price(item)
  533.     @price[item]
  534.   end
  535.   #--------------------------------------------------------------------------
  536.   # ● 合成可否を取得
  537.   #--------------------------------------------------------------------------
  538.   def enable?(item)
  539.     @makable[item]
  540.   end
  541.   #--------------------------------------------------------------------------
  542.   # ● レシピを取得
  543.   #--------------------------------------------------------------------------
  544.   def recipe(item)
  545.     @recipe[item]
  546.   end
  547.   #--------------------------------------------------------------------------
  548.   # ● アイテムを許可状態で表示するかどうか
  549.   #--------------------------------------------------------------------------
  550.   def have_mat?(recipe)
  551.     flag = true
  552.     if @money >= recipe[0]
  553.       for i in 1...recipe.size
  554.         kind = recipe[i][0]
  555.         id   = recipe[i][1]
  556.         num  = recipe[i][2]
  557.         if kind == "I"
  558.           item = $data_items[id]
  559.         elsif kind == "W"
  560.           item = $data_weapons[id]
  561.         elsif kind == "A"
  562.           item = $data_armors[id]
  563.         end
  564.         if $game_party.item_number(item) < [num, 1].max
  565.           flag = false
  566.         end
  567.       end
  568.     else
  569.       flag = false
  570.     end
  571.     return flag
  572.   end
  573.   #--------------------------------------------------------------------------
  574.   # ● カテゴリの設定
  575.   #--------------------------------------------------------------------------
  576.   def category=(category)
  577.     return if @category == category
  578.     @category = category
  579.     refresh
  580.   end
  581.   #--------------------------------------------------------------------------
  582.   # ● リフレッシュ
  583.   #--------------------------------------------------------------------------
  584.   def refresh
  585.     make_item_list
  586.     create_contents
  587.     draw_all_items
  588.   end
  589.   #--------------------------------------------------------------------------
  590.   # ● アイテムをリストに含めるかどうか
  591.   #--------------------------------------------------------------------------
  592.   def include?(item)
  593.     case @category
  594.     when :item
  595.       item.is_a?(RPG::Item) && !item.key_item?
  596.     when :weapon
  597.       item.is_a?(RPG::Weapon)
  598.     when :armor
  599.       item.is_a?(RPG::Armor)
  600.     when :key_item
  601.       item.is_a?(RPG::Item) && item.key_item?
  602.     else
  603.       false
  604.     end
  605.   end
  606.   #--------------------------------------------------------------------------
  607.   # ● アイテムリストの作成
  608.   #--------------------------------------------------------------------------
  609.   def make_item_list
  610.     @data = []
  611.     @price = {}
  612.     @makable = {}
  613.     @recipe = {}
  614.     for i in [email]0...@shop_goods.size[/email]
  615.       goods = @shop_goods[i]
  616.       recipe = @shop_recipes[i]
  617.       case goods[0]
  618.       when 0;  item = $data_items[goods[1]]
  619.       when 1;  item = $data_weapons[goods[1]]
  620.       when 2;  item = $data_armors[goods[1]]
  621.       end
  622.       if item
  623.         if include?(item)
  624.           @data.push(item)
  625.           @price[item] = goods[2]
  626.           @makable[item] = have_mat?(recipe)
  627.           @recipe[item] = recipe
  628.         end
  629.       end
  630.     end
  631.   end
  632.   #--------------------------------------------------------------------------
  633.   # ● 項目の描画
  634.   #--------------------------------------------------------------------------
  635.   def draw_item(index)
  636.     item = @data[index]
  637.     rect = item_rect(index)
  638.     draw_item_name(item, rect.x, rect.y, enable?(item))
  639.     rect.width -= 4
  640.     draw_text(rect, price(item), 2)  if WD_itemsynthesis_ini::Cost_view
  641.   end
  642.   #--------------------------------------------------------------------------
  643.   # ● ステータスウィンドウの設定
  644.   #--------------------------------------------------------------------------
  645.   def status_window=(status_window)
  646.     @status_window = status_window
  647.     call_update_help
  648.   end
  649.   #--------------------------------------------------------------------------
  650.   # ● 素材ウィンドウの設定
  651.   #--------------------------------------------------------------------------
  652.   def material_window=(material_window)
  653.     @material_window = material_window
  654.     call_update_help
  655.   end
  656.   #--------------------------------------------------------------------------
  657.   # ● ヘルプテキスト更新
  658.   #--------------------------------------------------------------------------
  659.   def update_help
  660.     @help_window.set_item(item) if @help_window
  661.     @status_window.item = item if @status_window
  662.     @material_window.set(item, recipe(item)) if @material_window
  663.   end
  664.   #--------------------------------------------------------------------------
  665.   # ● ←→ ボタン(表示切替)が押されたときの処理
  666.   #--------------------------------------------------------------------------
  667.   def process_change_window
  668.     Sound.play_cursor
  669.     Input.update
  670.     call_handler(:change_window)
  671.   end
  672.   #--------------------------------------------------------------------------
  673.   # ● 決定やキャンセルなどのハンドリング処理
  674.   #--------------------------------------------------------------------------
  675.   def process_handling
  676.     super
  677.     if active
  678.       return process_change_window if handle?(:change_window) && Input.trigger?(:X)
  679.       return process_change_window if handle?(:change_window) && Input.trigger?(:Y)
  680.     end
  681.   end
  682. end
  683.  
  684.  
  685. #==============================================================================
  686. # ■ Window_ItemSynthesisMaterial
  687. #------------------------------------------------------------------------------
  688. #  合成画面で、合成に必要な素材を表示するウィンドウです。
  689. #==============================================================================
  690.  
  691. class Window_ItemSynthesisMaterial < Window_Base
  692.   #--------------------------------------------------------------------------
  693.   # ● オブジェクト初期化
  694.   #--------------------------------------------------------------------------
  695.   def initialize(x, y, width, height)
  696.     super(x, y, width, height)
  697.     @item = nil
  698.     refresh
  699.   end
  700.   #--------------------------------------------------------------------------
  701.   # ● リフレッシュ
  702.   #--------------------------------------------------------------------------
  703.   def refresh
  704.     contents.clear
  705.     draw_possession(4, 0)
  706.     draw_material_info(0, line_height * 2)
  707.   end
  708.   #--------------------------------------------------------------------------
  709.   # ● アイテムの設定
  710.   #--------------------------------------------------------------------------
  711.   def set(item, recipe)
  712.     @item = item
  713.     @recipe = recipe
  714.     @make_number = 1
  715.     refresh
  716.   end
  717.   #--------------------------------------------------------------------------
  718.   # ● 作成個数の設定
  719.   #--------------------------------------------------------------------------
  720.   def set_num(make_number)
  721.     @make_number = make_number
  722.     refresh
  723.   end
  724.   #--------------------------------------------------------------------------
  725.   # ● 所持数の描画
  726.   #--------------------------------------------------------------------------
  727.   def draw_possession(x, y)
  728.     rect = Rect.new(x, y, contents.width - 4 - x, line_height)
  729.     change_color(system_color)
  730.     draw_text(rect, Vocab::Possession)
  731.     change_color(normal_color)
  732.     draw_text(rect, $game_party.item_number(@item), 2)
  733.   end
  734.   #--------------------------------------------------------------------------
  735.   # ● 素材情報の描画
  736.   #--------------------------------------------------------------------------
  737.   def draw_material_info(x, y)
  738.     rect = Rect.new(x, y, contents.width, line_height)
  739.     change_color(system_color)
  740.     contents.font.size = 18
  741.     draw_text(rect, "必要素材", 0)
  742.     if @recipe
  743.       for i in [email]1...@recipe.size[/email]
  744.         kind = @recipe[i][0]
  745.         id   = @recipe[i][1]
  746.         num  = @recipe[i][2]
  747.         if kind == "I"
  748.           item = $data_items[id]
  749.         elsif kind == "W"
  750.           item = $data_weapons[id]
  751.         elsif kind == "A"
  752.           item = $data_armors[id]
  753.         end
  754.         rect = Rect.new(x, y + line_height*i, contents.width, line_height)
  755.         enabled = true
  756.         enabled = false if [num*@make_number, 1].max  > $game_party.item_number(item)
  757.         draw_item_name(item, rect.x, rect.y, enabled)
  758.         change_color(normal_color, enabled)
  759.         if num > 0
  760.           draw_text(rect, "#{num*@make_number}/#{$game_party.item_number(item)}", 2)
  761.         end
  762.       end
  763.     end
  764.     change_color(normal_color)
  765.     contents.font.size = 24
  766.   end
  767. end
  768.  
  769.  
  770. #==============================================================================
  771. # ■ Window_ItemSynthesisNumber
  772. #------------------------------------------------------------------------------
  773. #  合成画面で、合成するアイテムの個数を入力するウィンドウです。
  774. #==============================================================================
  775.  
  776. class Window_ItemSynthesisNumber < Window_ShopNumber
  777.   #--------------------------------------------------------------------------
  778.   # ● リフレッシュ
  779.   #--------------------------------------------------------------------------
  780.   def refresh
  781.     contents.clear
  782.     draw_item_name(@item, 0, item_y)
  783.     draw_number
  784.     draw_total_price if WD_itemsynthesis_ini::Cost_view
  785.   end
  786.   #--------------------------------------------------------------------------
  787.   # ● オブジェクト初期化
  788.   #--------------------------------------------------------------------------
  789.   def material_window=(material_window)
  790.     @material_window = material_window
  791.     call_update_help
  792.   end
  793.   #--------------------------------------------------------------------------
  794.   # ● 作成個数の変更
  795.   #--------------------------------------------------------------------------
  796.   def change_number(amount)
  797.     @number = [[@number + amount, @max].min, 1].max
  798.     call_update_help #追加
  799.   end
  800.   #--------------------------------------------------------------------------
  801.   # ● ヘルプテキスト更新
  802.   #--------------------------------------------------------------------------
  803.   def call_update_help
  804.     @material_window.set_num(@number) if @material_window
  805.   end
  806. end
  807.  
  808.  
  809. #==============================================================================
  810. # ■ Window_ItemSynthesisCategory
  811. #------------------------------------------------------------------------------
  812. #  合成画面で、通常アイテムや装備品の分類を選択するウィンドウです。
  813. #==============================================================================
  814.  
  815. class Window_ItemSynthesisCategory < Window_ItemCategory
  816.   #--------------------------------------------------------------------------
  817.   # ● 桁数の取得
  818.   #--------------------------------------------------------------------------
  819.   def col_max
  820.     i = 0
  821.     i += 1 if WD_itemsynthesis_ini::Category_i
  822.     i += 1 if WD_itemsynthesis_ini::Category_w
  823.     i += 1 if WD_itemsynthesis_ini::Category_a
  824.     i += 1 if WD_itemsynthesis_ini::Category_k
  825.     return i
  826.   end
  827.   #--------------------------------------------------------------------------
  828.   # ● コマンドリストの作成
  829.   #--------------------------------------------------------------------------
  830.   def make_command_list
  831.     add_command(Vocab::item,     :item)     if WD_itemsynthesis_ini::Category_i
  832.     add_command(Vocab::weapon,   :weapon)   if WD_itemsynthesis_ini::Category_w
  833.     add_command(Vocab::armor,    :armor)    if WD_itemsynthesis_ini::Category_a
  834.     add_command(Vocab::key_item, :key_item) if WD_itemsynthesis_ini::Category_k
  835.   end
  836. end
  837.  
  838.  
  839. #==============================================================================
  840. # ■ Window_ItemSynthesisNumber
  841. #------------------------------------------------------------------------------
  842. #  合成画面で、切替を表示するウィンドウです。
  843. #==============================================================================
  844.  
  845. class Window_ItemSynthesisChange < Window_Base
  846.   #--------------------------------------------------------------------------
  847.   # ● オブジェクト初期化
  848.   #--------------------------------------------------------------------------
  849.   def initialize(x, y, width, height)
  850.     super(x, y, width, height)
  851.     refresh
  852.   end
  853.   #--------------------------------------------------------------------------
  854.   # ● リフレッシュ
  855.   #--------------------------------------------------------------------------
  856.   def refresh
  857.     contents.clear
  858.     text = "X Y:表示切り替え"
  859.     draw_text(0, 0, contents_width, line_height, text, 1)
  860.   end
  861. end

Lv1.梦旅人

梦石
0
星屑
143
在线时间
347 小时
注册时间
2010-7-7
帖子
128
2
 楼主| 发表于 2013-6-20 20:18:38 | 只看该作者
麻烦各位大神帮帮忙...
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
143
在线时间
347 小时
注册时间
2010-7-7
帖子
128
3
 楼主| 发表于 2013-6-22 09:12:37 | 只看该作者
拜托帮帮忙啊...
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
150 小时
注册时间
2010-10-22
帖子
58
4
发表于 2013-6-22 11:03:38 | 只看该作者
呵呵~~那你就要重新定义药剂,材料等!

那不亚于重新写一个罗!
XAS GYRO努力制造中
代码什么的最讨厌了!去改别人的才最好玩
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
50
在线时间
44 小时
注册时间
2013-5-25
帖子
91
5
发表于 2013-6-22 12:00:55 | 只看该作者
这倒是不难,有空试试。
楼主你能等么…大概期末考试以后才……OTZ

嗯…还是期待楼下大神出现的好。
回复 支持 反对

使用道具 举报

Lv1.梦旅人

梦石
0
星屑
143
在线时间
347 小时
注册时间
2010-7-7
帖子
128
6
 楼主| 发表于 2013-6-22 13:22:08 | 只看该作者
长奁 发表于 2013-6-22 12:00
这倒是不难,有空试试。
楼主你能等么…大概期末考试以后才……OTZ

没关系,可以等的,多谢~
回复 支持 反对

使用道具 举报

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

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2024-5-21 19:27

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表