查看: 6955|回复: 14

[已经解决] 研究了半天,还是过来请教下好了,谢谢。

[复制链接]

梦石
0
星屑
239
在线时间
2399 小时
注册时间
2008-4-11
回帖
11727

贵宾第6届短篇游戏比赛季军

发表于 2013-8-13 02:56:34 | 显示全部楼层 |阅读模式
悬赏3星屑已解决

研究了一会儿,但是始终不知道该怎么做,只好来求助各位了。
这个合成脚本一切都很满意,只是目前它只对合成物品分了四个类:道具、武器、防具、重要品
我想要给武器和防具再细分出来,比如武器分成剑系、斧系、枪系,而防具分成盾、甲、盔、饰

我知道可能有些强人所难,因为看了这一段这样写:
   case @category
    when :item
      item.is_a?(RPG::Item) && !item.key_item?
    when :weapon
      item.is_a?(RPG::Weapon)
    when :armor
      item.is_a?(RPG::Armor)
    when :key_item
      item.is_a?(RPG::Item) && item.key_item?

如果要添加新的类,肯定不是件容易事。
总之谢谢大家,如果能给个思路也可以的,
比如说把weapon设定成id1~20是weapon_sword,21~40是weapon_axe
这样我只需要把剑系都设定在武器栏的1~20就可以实现分类的读取了。
  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 = false #カテゴリウィンドウに「重要物」の項目を表示
  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[31]  = [1,  ["I",21,1], ["I",41,1]]
  38.   I_recipe[32]  = [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 1...@recipe.size
  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 1...@recipe.size
  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.     [url=home.php?mod=space&uid=26101]@Money[/url] = 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 1...@recipe.size
  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 = "点击A键隐藏材料清单"
  831.     draw_text(0, 0, contents_width, line_height, text, 1)
  832.   end
  833. end

复制代码

最佳答案

查看完整内容

我稍微调整了一下,应该可以实现楼主想要的功能了 是通过物品ID实现的 默认是20个一组 我把改动的、新增的地方都添加了形如#########的标记 需要自定义的地方都有形如#▼▼▼▼的标记 很显眼,应该看得到 因为没有完整版的脚本(其实我根本没去试= =!)所以如果还有什么问题就请@我,我应该晚上会再来 脚本:[pre lang="ruby" line="1"]#============================================================================== # ■ RG ...

百合控

梦石
0
星屑
6548
在线时间
1275 小时
注册时间
2013-8-21
回帖
3522

开拓者

发表于 2013-8-13 02:56:35 | 显示全部楼层
本帖最后由 76213585 于 2013-10-5 19:36 编辑

我稍微调整了一下,应该可以实现楼主想要的功能了
是通过物品ID实现的 默认是20个一组
我把改动的、新增的地方都添加了形如#########的标记
需要自定义的地方都有形如#▼▼▼▼的标记
很显眼,应该看得到
因为没有完整版的脚本(其实我根本没去试= =!)所以如果还有什么问题就请@我,我应该晚上会再来
脚本:
  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. 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 = false #カテゴリウィンドウに「重要物」の項目を表示
  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[1]  = [1,  ["I",21,1], ["I",41,1]]
  38.   I_recipe[32]  = [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.     create_category_window_sec1 #############################################
  183.     create_category_window_sec2 #############################################
  184.     @ent_mo = 0
  185.   end
  186.   #--------------------------------------------------------------------------
  187.   # ● ゴールドウィンドウの作成
  188.   #--------------------------------------------------------------------------
  189.   def create_gold_window
  190.     @gold_window = Window_Gold.new
  191.     @gold_window.viewport = @viewport
  192.     @gold_window.x = Graphics.width - @gold_window.width
  193.     @gold_window.y = @help_window.height
  194.     @gold_window.hide
  195.   end
  196.   #--------------------------------------------------------------------------
  197.   # ● 切り替え表示ウィンドウの作成
  198.   #--------------------------------------------------------------------------
  199.   def create_change_window
  200.     wx = 0
  201.     wy = @gold_window.y
  202.     ww = Graphics.width - @gold_window.width
  203.     wh = @gold_window.height
  204.     @change_window = Window_ItemSynthesisChange.new(wx, wy, ww, wh)
  205.     @change_window.viewport = @viewport
  206.     @change_window.hide
  207.   end
  208.   #--------------------------------------------------------------------------
  209.   # ● ダミーウィンドウの作成
  210.   #--------------------------------------------------------------------------
  211.   def create_dummy_window
  212.     wy = @help_window.y + @help_window.height + 48
  213.     wh = Graphics.height - wy
  214.     @dummy_window = Window_Base.new(0, wy, Graphics.width, wh)
  215.     @dummy_window.viewport = @viewport
  216.   end
  217.   #--------------------------------------------------------------------------
  218.   # ● 個数入力ウィンドウの作成
  219.   #--------------------------------------------------------------------------
  220.   def create_number_window
  221.     wy = @dummy_window.y
  222.     wh = @dummy_window.height
  223.     @number_window = Window_ItemSynthesisNumber.new(0, wy, wh)
  224.     @number_window.viewport = @viewport
  225.     @number_window.hide
  226.     @number_window.set_handler(:ok,     method(:on_number_ok))
  227.     @number_window.set_handler(:cancel, method(:on_number_cancel))
  228.   end
  229.   #--------------------------------------------------------------------------
  230.   # ● ステータスウィンドウの作成
  231.   #--------------------------------------------------------------------------
  232.   def create_status_window
  233.     wx = @number_window.width
  234.     wy = @dummy_window.y
  235.     ww = Graphics.width - wx
  236.     wh = @dummy_window.height
  237.     @status_window = Window_ShopStatus.new(wx, wy, ww, wh)
  238.     @status_window.viewport = @viewport
  239.     @status_window.hide
  240.   end
  241.   #--------------------------------------------------------------------------
  242.   # ● 素材ウィンドウの作成
  243.   #--------------------------------------------------------------------------
  244.   def create_material_window
  245.     wx = @number_window.width
  246.     wy = @dummy_window.y
  247.     ww = Graphics.width - wx
  248.     wh = @dummy_window.height
  249.     @material_window = Window_ItemSynthesisMaterial.new(wx, wy, ww, wh)
  250.     @material_window.viewport = @viewport
  251.     @material_window.hide
  252.     @number_window.material_window = @material_window
  253.   end
  254.   #--------------------------------------------------------------------------
  255.   # ● 合成アイテムリストウィンドウの作成
  256.   #--------------------------------------------------------------------------
  257.   def create_list_window
  258.     wy = @dummy_window.y
  259.     wh = @dummy_window.height
  260.     @list_window = Window_ItemSynthesisList.new(0, wy, wh)
  261.     @list_window.viewport = @viewport
  262.     @list_window.help_window = @help_window
  263.     @list_window.status_window = @status_window
  264.     @list_window.material_window = @material_window
  265.     @list_window.hide
  266.     @list_window.set_handler(:ok,     method(:on_list_ok))
  267.     @list_window.set_handler(:cancel, method(:on_list_cancel))
  268.     @list_window.set_handler(:change_window, method(:on_change_window))   
  269.   end
  270.   #--------------------------------------------------------------------------
  271.   # ● カテゴリウィンドウの作成
  272.   #--------------------------------------------------------------------------
  273.   def create_category_window
  274.     @category_window = Window_ItemSynthesisCategory.new
  275.     @category_window.viewport = @viewport
  276.     @category_window.help_window = @help_window
  277.     @category_window.y = @help_window.height
  278.     @category_window.activate
  279.     @category_window.item_window = @list_window
  280.     @category_window.set_handler(:ok,     method(:on_category_ok))
  281.     @category_window.set_handler(:cancel, method(:return_scene))
  282.   end
  283.   #--------------------------------------------------------------------------
  284.   # ●● 创建第二次的分类选择窗口 p1
  285.   #--------------------------------------------------------------------------
  286.   def create_category_window_sec1 ############################################
  287.     @category_window_sec1 = Window_ItemSynthesisCategoryEX1.new
  288.     @category_window_sec1.viewport = @viewport
  289.     @category_window_sec1.help_window = @help_window
  290.     @category_window_sec1.y = @help_window.height
  291.     @category_window_sec1.activate
  292.     @category_window_sec1.item_window = @list_window
  293.     @category_window_sec1.set_handler(:ok,     method(:on_category_ok_sec))
  294.     @category_window_sec1.set_handler(:cancel, method(:return_cate_sec))
  295.     @category_window_sec1.hide
  296.     @category_window_sec1.deactivate
  297.   end
  298.   #--------------------------------------------------------------------------
  299.   # ●● 创建第二次的分类选择窗口 p2
  300.   #--------------------------------------------------------------------------
  301.   def create_category_window_sec2 ############################################
  302.     @category_window_sec2 = Window_ItemSynthesisCategoryEX2.new
  303.     @category_window_sec2.viewport = @viewport
  304.     @category_window_sec2.help_window = @help_window
  305.     @category_window_sec2.y = @help_window.height
  306.     @category_window_sec2.activate
  307.     @category_window_sec2.item_window = @list_window
  308.     @category_window_sec2.set_handler(:ok,     method(:on_category_ok_sec))
  309.     @category_window_sec2.set_handler(:cancel, method(:return_cate_sec))
  310.     @category_window_sec2.hide
  311.     @category_window_sec2.deactivate
  312.   end
  313.   #--------------------------------------------------------------------------
  314.   # ● 合成アイテムリストウィンドウのアクティブ化
  315.   #--------------------------------------------------------------------------
  316.   def activate_list_window
  317.     @list_window.money = money
  318.     @list_window.show.activate
  319.   end
  320.   #--------------------------------------------------------------------------
  321.   # ● 合成[決定]
  322.   #--------------------------------------------------------------------------
  323.   def on_list_ok
  324.     @item = @list_window.item
  325.     @list_window.hide
  326.     @number_window.set(@item, max_buy, buying_price, currency_unit)
  327.     @number_window.show.activate
  328.   end
  329.   #--------------------------------------------------------------------------
  330.   # ● 合成[キャンセル]
  331.   #--------------------------------------------------------------------------
  332.   def on_list_cancel
  333.     case @ent_mo
  334.     when 0
  335.       @category_window.activate
  336.       @category_window.show
  337.     when 1
  338.       @category_window_sec1.activate
  339.       @category_window_sec1.show
  340.     when 2
  341.       @category_window_sec2.activate
  342.       @category_window_sec2.show
  343.     end
  344.     @dummy_window.show
  345.     @list_window.hide
  346.     @status_window.hide
  347.     @status_window.item = nil
  348.     @material_window.hide
  349.     @material_window.set(nil, nil)
  350.     @gold_window.hide
  351.     @change_window.hide
  352.     @help_window.clear
  353.   end
  354.   #--------------------------------------------------------------------------
  355.   # ● 表示切替
  356.   #--------------------------------------------------------------------------
  357.   def on_change_window
  358.     if @status_window.visible
  359.       @status_window.hide
  360.       @material_window.show
  361.     else
  362.       @status_window.show
  363.       @material_window.hide
  364.     end
  365.   end
  366.   #--------------------------------------------------------------------------
  367.   # ● カテゴリ[決定]
  368.   #--------------------------------------------------------------------------
  369.   def on_category_ok ########################################################
  370.     case @category_window.current_symbol
  371.     when :weapon
  372.       @category_window.hide
  373.       @category_window_sec1.show
  374.       @category_window_sec1.activate
  375.       @category_window_sec1.select(0)
  376.     when :armor
  377.       @category_window.hide
  378.       @category_window_sec2.show
  379.       @category_window_sec2.activate
  380.       @category_window_sec2.select(0)
  381.     else
  382.       activate_list_window
  383.       @gold_window.show
  384.       @change_window.show
  385.       @material_window.show
  386.       @category_window.hide
  387.       @list_window.select(0)
  388.       @ent_mo = 0
  389.     end
  390.   end
  391.   #--------------------------------------------------------------------------
  392.   # ●● 分类确定(第二次)
  393.   #--------------------------------------------------------------------------
  394.   def on_category_ok_sec
  395.     activate_list_window
  396.     @gold_window.show
  397.     @change_window.show
  398.     @material_window.show
  399.     if @category_window_sec1.visible
  400.       @category_window_sec1.hide
  401.       @ent_mo = 1
  402.     else
  403.       @category_window_sec2.hide
  404.       @ent_mo = 2
  405.     end
  406.     @list_window.select(0)
  407.   end
  408.   #--------------------------------------------------------------------------
  409.   # ●● 分类取消(第二次)
  410.   #--------------------------------------------------------------------------
  411.   def return_cate_sec
  412.     @category_window.show
  413.     @category_window_sec1.hide
  414.     @category_window_sec2.hide
  415.     @category_window_sec1.deactivate
  416.     @category_window_sec2.deactivate
  417.     @category_window.activate
  418.     @category_window.select(0)
  419.   end
  420.   #--------------------------------------------------------------------------
  421.   # ● 個数入力[決定]
  422.   #--------------------------------------------------------------------------
  423.   def on_number_ok
  424.     Sound.play_shop
  425.     do_syntetic(@number_window.number)
  426.     end_number_input
  427.     @gold_window.refresh
  428.   end
  429.   #--------------------------------------------------------------------------
  430.   # ● 個数入力[キャンセル]
  431.   #--------------------------------------------------------------------------
  432.   def on_number_cancel
  433.     Sound.play_cancel
  434.     end_number_input
  435.   end
  436.   #--------------------------------------------------------------------------
  437.   # ● 合成の実行
  438.   #--------------------------------------------------------------------------
  439.   def do_syntetic(number)
  440.     $game_party.lose_gold(number * buying_price)
  441.     $game_party.gain_item(@item, number)
  442.    
  443.       @recipe = @list_window.recipe(@item)
  444.       for i in [email]1...@recipe.size[/email]
  445.         kind = @recipe[i][0]
  446.         id   = @recipe[i][1]
  447.         num  = @recipe[i][2]
  448.         if kind == "I"
  449.           item = $data_items[id]
  450.         elsif kind == "W"
  451.           item = $data_weapons[id]
  452.         elsif kind == "A"
  453.           item = $data_armors[id]
  454.         end
  455.         $game_party.lose_item(item, num*number)
  456.       end
  457.   end
  458.   #--------------------------------------------------------------------------
  459.   # ● 個数入力の終了
  460.   #--------------------------------------------------------------------------
  461.   def end_number_input
  462.     @number_window.hide
  463.     activate_list_window
  464.   end
  465.   #--------------------------------------------------------------------------
  466.   # ● 最大購入可能個数の取得
  467.   #--------------------------------------------------------------------------
  468.   def max_buy
  469.     max = $game_party.max_item_number(@item) - $game_party.item_number(@item)
  470.    
  471.     @recipe = @list_window.recipe(@item)
  472.       for i in [email]1...@recipe.size[/email]
  473.         kind = @recipe[i][0]
  474.         id   = @recipe[i][1]
  475.         num  = @recipe[i][2]
  476.         if kind == "I"
  477.           item = $data_items[id]
  478.         elsif kind == "W"
  479.           item = $data_weapons[id]
  480.         elsif kind == "A"
  481.           item = $data_armors[id]
  482.         end
  483.         if num > 0
  484.           max_buf = $game_party.item_number(item)/num
  485.         else
  486.           max_buf = 999
  487.         end
  488.         max = [max, max_buf].min
  489.       end
  490.       
  491.     buying_price == 0 ? max : [max, money / buying_price].min

  492.   end
  493.   #--------------------------------------------------------------------------
  494.   # ● 所持金の取得
  495.   #--------------------------------------------------------------------------
  496.   def money
  497.     @gold_window.value
  498.   end
  499.   #--------------------------------------------------------------------------
  500.   # ● 通貨単位の取得
  501.   #--------------------------------------------------------------------------
  502.   def currency_unit
  503.     @gold_window.currency_unit
  504.   end
  505.   #--------------------------------------------------------------------------
  506.   # ● 合成費用の取得
  507.   #--------------------------------------------------------------------------
  508.   def buying_price
  509.     @list_window.price(@item)
  510.   end
  511. end


  512. #==============================================================================
  513. # ■ Window_ItemSynthesisList
  514. #------------------------------------------------------------------------------
  515. #  合成画面で、合成可能なアイテムの一覧を表示するウィンドウです。
  516. #==============================================================================

  517. class Window_ItemSynthesisList < Window_Selectable
  518.   include WD_itemsynthesis
  519.   #--------------------------------------------------------------------------
  520.   # ● 公開インスタンス変数
  521.   #--------------------------------------------------------------------------
  522.   attr_reader   :status_window            # ステータスウィンドウ
  523.   #--------------------------------------------------------------------------
  524.   # ● オブジェクト初期化
  525.   #--------------------------------------------------------------------------
  526.   def initialize(x, y, height)
  527.     super(x, y, window_width, height)
  528.    
  529.     @shop_goods = []
  530.     @shop_recipes = []
  531.    
  532.     for i in 1..WD_itemsynthesis_ini::I_recipe.size
  533.       recipe = WD_itemsynthesis_ini::I_recipe[i]
  534.       if recipe
  535.         good = [0, i, recipe[0]]
  536.         if i_recipe_switch_on?(i)
  537.           @shop_goods.push(good)
  538.           @shop_recipes.push(recipe)
  539.         end
  540.       end
  541.     end
  542.     for i in 1..WD_itemsynthesis_ini::W_recipe.size
  543.       recipe = WD_itemsynthesis_ini::W_recipe[i]
  544.       if recipe
  545.         good = [1, i, recipe[0]]
  546.         if w_recipe_switch_on?(i)
  547.           @shop_goods.push(good)
  548.           @shop_recipes.push(recipe)
  549.         end
  550.       end
  551.     end
  552.     for i in 1..WD_itemsynthesis_ini::A_recipe.size
  553.       recipe = WD_itemsynthesis_ini::A_recipe[i]
  554.       if recipe
  555.         good = [2, i, recipe[0]]
  556.         if a_recipe_switch_on?(i)
  557.           @shop_goods.push(good)
  558.           @shop_recipes.push(recipe)
  559.         end
  560.       end
  561.     end
  562.    
  563.     @money = 0
  564.     refresh
  565.     select(0)
  566.   end
  567.   #--------------------------------------------------------------------------
  568.   # ● ウィンドウ幅の取得
  569.   #--------------------------------------------------------------------------
  570.   def window_width
  571.     return 304
  572.   end
  573.   #--------------------------------------------------------------------------
  574.   # ● 項目数の取得
  575.   #--------------------------------------------------------------------------
  576.   def item_max
  577.     @data ? @data.size : 1
  578.   end
  579.   #--------------------------------------------------------------------------
  580.   # ● アイテムの取得
  581.   #--------------------------------------------------------------------------
  582.   def item
  583.     @data[index]
  584.   end
  585.   #--------------------------------------------------------------------------
  586.   # ● 所持金の設定
  587.   #--------------------------------------------------------------------------
  588.   def money=(money)
  589.     @money = money
  590.     refresh
  591.   end
  592.   #--------------------------------------------------------------------------
  593.   # ● 選択項目の有効状態を取得
  594.   #--------------------------------------------------------------------------
  595.   def current_item_enabled?
  596.     enable?(@data[index])
  597.   end
  598.   #--------------------------------------------------------------------------
  599.   # ● 合成費用を取得
  600.   #--------------------------------------------------------------------------
  601.   def price(item)
  602.     @price[item]
  603.   end
  604.   #--------------------------------------------------------------------------
  605.   # ● 合成可否を取得
  606.   #--------------------------------------------------------------------------
  607.   def enable?(item)
  608.     @makable[item]
  609.   end
  610.   #--------------------------------------------------------------------------
  611.   # ● レシピを取得
  612.   #--------------------------------------------------------------------------
  613.   def recipe(item)
  614.     @recipe[item]
  615.   end
  616.   #--------------------------------------------------------------------------
  617.   # ● アイテムを許可状態で表示するかどうか
  618.   #--------------------------------------------------------------------------
  619.   def have_mat?(recipe)
  620.     flag = true
  621.     if @money >= recipe[0]
  622.       for i in 1...recipe.size
  623.         kind = recipe[i][0]
  624.         id   = recipe[i][1]
  625.         num  = recipe[i][2]
  626.         if kind == "I"
  627.           item = $data_items[id]
  628.         elsif kind == "W"
  629.           item = $data_weapons[id]
  630.         elsif kind == "A"
  631.           item = $data_armors[id]
  632.         end
  633.         if $game_party.item_number(item) < [num, 1].max
  634.           flag = false
  635.         end
  636.       end
  637.     else
  638.       flag = false
  639.     end
  640.     return flag
  641.   end
  642.   #--------------------------------------------------------------------------
  643.   # ● カテゴリの設定
  644.   #--------------------------------------------------------------------------
  645.   def category=(category)
  646.     return if @category == category
  647.     @category = category
  648.     refresh
  649.   end
  650.   #--------------------------------------------------------------------------
  651.   # ● リフレッシュ
  652.   #--------------------------------------------------------------------------
  653.   def refresh
  654.     make_item_list
  655.     create_contents
  656.     draw_all_items
  657.   end
  658.   #--------------------------------------------------------------------------
  659.   # ● アイテムをリストに含めるかどうか
  660.   #--------------------------------------------------------------------------
  661.   # ▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼▼
  662.   def include?(item)
  663.     case @category
  664.     when :item
  665.       item.is_a?(RPG::Item) && !item.key_item?
  666.     when :weapon_a
  667.       item.is_a?(RPG::Weapon) && item.wtype_id.between?(1,20) #▼
  668.     when :weapon_b
  669.       item.is_a?(RPG::Weapon) && item.wtype_id.between?(21,40) #▼
  670.     when:weapon_c
  671.       item.is_a?(RPG::Weapon) && item.wtype_id.between?(41,60) #▼
  672.     when :armor_a
  673.       item.is_a?(RPG::Armor) && item.atype_id.between?(1,20) #▼
  674.     when :armor_b
  675.       item.is_a?(RPG::Armor) && item.atype_id.between?(21,40) #▼
  676.     when :armor_c
  677.       item.is_a?(RPG::Armor) && item.atype_id.between?(41,60) #▼
  678.     when :armor_d
  679.       item.is_a?(RPG::Armor) && item.atype_id.between?(61,80) #▼
  680.     when :key_item
  681.       item.is_a?(RPG::Item) && item.key_item?
  682.     else
  683.       false
  684.     end
  685.   end
  686.   #--------------------------------------------------------------------------
  687.   # ● アイテムリストの作成
  688.   #--------------------------------------------------------------------------
  689.   def make_item_list
  690.     @data = []
  691.     @price = {}
  692.     @makable = {}
  693.     @recipe = {}
  694.     for i in [email]0...@shop_goods.size[/email]
  695.       goods = @shop_goods[i]
  696.       recipe = @shop_recipes[i]
  697.       case goods[0]
  698.       when 0;  item = $data_items[goods[1]]
  699.       when 1;  item = $data_weapons[goods[1]]
  700.       when 2;  item = $data_armors[goods[1]]
  701.       end
  702.       if item
  703.         if include?(item)
  704.           @data.push(item)
  705.           @price[item] = goods[2]
  706.           @makable[item] = have_mat?(recipe)
  707.           @recipe[item] = recipe
  708.         end
  709.       end
  710.     end
  711.   end
  712.   #--------------------------------------------------------------------------
  713.   # ● 項目の描画
  714.   #--------------------------------------------------------------------------
  715.   def draw_item(index)
  716.     item = @data[index]
  717.     rect = item_rect(index)
  718.     draw_item_name(item, rect.x, rect.y, enable?(item))
  719.     rect.width -= 4
  720.     draw_text(rect, price(item), 2)  if WD_itemsynthesis_ini::Cost_view
  721.   end
  722.   #--------------------------------------------------------------------------
  723.   # ● ステータスウィンドウの設定
  724.   #--------------------------------------------------------------------------
  725.   def status_window=(status_window)
  726.     @status_window = status_window
  727.     call_update_help
  728.   end
  729.   #--------------------------------------------------------------------------
  730.   # ● 素材ウィンドウの設定
  731.   #--------------------------------------------------------------------------
  732.   def material_window=(material_window)
  733.     @material_window = material_window
  734.     call_update_help
  735.   end
  736.   #--------------------------------------------------------------------------
  737.   # ● ヘルプテキスト更新
  738.   #--------------------------------------------------------------------------
  739.   def update_help
  740.     @help_window.set_item(item) if @help_window
  741.     @status_window.item = item if @status_window
  742.     @material_window.set(item, recipe(item)) if @material_window
  743.   end
  744.   #--------------------------------------------------------------------------
  745.   # ● ←→ ボタン(表示切替)が押されたときの処理
  746.   #--------------------------------------------------------------------------
  747.   def process_change_window
  748.     Sound.play_cursor
  749.     Input.update
  750.     call_handler(:change_window)
  751.   end
  752.   #--------------------------------------------------------------------------
  753.   # ● 決定やキャンセルなどのハンドリング処理
  754.   #--------------------------------------------------------------------------
  755.   def process_handling
  756.     super
  757.     if active
  758.       return process_change_window if handle?(:change_window) && Input.trigger?(:X)
  759.       return process_change_window if handle?(:change_window) && Input.trigger?(:Y)
  760.     end
  761.   end
  762. end


  763. #==============================================================================
  764. # ■ Window_ItemSynthesisMaterial
  765. #------------------------------------------------------------------------------
  766. #  合成画面で、合成に必要な素材を表示するウィンドウです。
  767. #==============================================================================

  768. class Window_ItemSynthesisMaterial < Window_Base
  769.   #--------------------------------------------------------------------------
  770.   # ● オブジェクト初期化
  771.   #--------------------------------------------------------------------------
  772.   def initialize(x, y, width, height)
  773.     super(x, y, width, height)
  774.     @item = nil
  775.     refresh
  776.   end
  777.   #--------------------------------------------------------------------------
  778.   # ● リフレッシュ
  779.   #--------------------------------------------------------------------------
  780.   def refresh
  781.     contents.clear
  782.     draw_possession(4, 0)
  783.     draw_material_info(0, line_height * 2)
  784.   end
  785.   #--------------------------------------------------------------------------
  786.   # ● アイテムの設定
  787.   #--------------------------------------------------------------------------
  788.   def set(item, recipe)
  789.     @item = item
  790.     @recipe = recipe
  791.     @make_number = 1
  792.     refresh
  793.   end
  794.   #--------------------------------------------------------------------------
  795.   # ● 作成個数の設定
  796.   #--------------------------------------------------------------------------
  797.   def set_num(make_number)
  798.     @make_number = make_number
  799.     refresh
  800.   end
  801.   #--------------------------------------------------------------------------
  802.   # ● 所持数の描画
  803.   #--------------------------------------------------------------------------
  804.   def draw_possession(x, y)
  805.     rect = Rect.new(x, y, contents.width - 4 - x, line_height)
  806.     change_color(system_color)
  807.     draw_text(rect, Vocab::Possession)
  808.     change_color(normal_color)
  809.     draw_text(rect, $game_party.item_number(@item), 2)
  810.   end
  811.   #--------------------------------------------------------------------------
  812.   # ● 素材情報の描画
  813.   #--------------------------------------------------------------------------
  814.   def draw_material_info(x, y)
  815.     rect = Rect.new(x, y, contents.width, line_height)
  816.     change_color(system_color)
  817.     contents.font.size = 18
  818.     draw_text(rect, "   锻造所需材料数 / 目前拥有材料", 0)
  819.     if @recipe
  820.       for i in [email]1...@recipe.size[/email]
  821.         kind = @recipe[i][0]
  822.         id   = @recipe[i][1]
  823.         num  = @recipe[i][2]
  824.         if kind == "I"
  825.           item = $data_items[id]
  826.         elsif kind == "W"
  827.           item = $data_weapons[id]
  828.         elsif kind == "A"
  829.           item = $data_armors[id]
  830.         end
  831.         rect = Rect.new(x, y + line_height*i, contents.width, line_height)
  832.         enabled = true
  833.         enabled = false if [num*@make_number, 1].max  > $game_party.item_number(item)
  834.         draw_item_name(item, rect.x, rect.y, enabled)
  835.         change_color(normal_color, enabled)
  836.         if num > 0
  837.           draw_text(rect, "#{num*@make_number}/#{$game_party.item_number(item)}", 2)
  838.         end
  839.       end
  840.     end
  841.     change_color(normal_color)
  842.     contents.font.size = 24
  843.   end
  844. end


  845. #==============================================================================
  846. # ■ Window_ItemSynthesisNumber
  847. #------------------------------------------------------------------------------
  848. #  合成画面で、合成するアイテムの個数を入力するウィンドウです。
  849. #==============================================================================

  850. class Window_ItemSynthesisNumber < Window_ShopNumber
  851.   #--------------------------------------------------------------------------
  852.   # ● リフレッシュ
  853.   #--------------------------------------------------------------------------
  854.   def refresh
  855.     contents.clear
  856.     draw_item_name(@item, 0, item_y)
  857.     draw_number
  858.     draw_total_price if WD_itemsynthesis_ini::Cost_view
  859.   end
  860.   #--------------------------------------------------------------------------
  861.   # ● オブジェクト初期化
  862.   #--------------------------------------------------------------------------
  863.   def material_window=(material_window)
  864.     @material_window = material_window
  865.     call_update_help
  866.   end
  867.   #--------------------------------------------------------------------------
  868.   # ● 作成個数の変更
  869.   #--------------------------------------------------------------------------
  870.   def change_number(amount)
  871.     @number = [[@number + amount, @max].min, 1].max
  872.     call_update_help #追加
  873.   end
  874.   #--------------------------------------------------------------------------
  875.   # ● ヘルプテキスト更新
  876.   #--------------------------------------------------------------------------
  877.   def call_update_help
  878.     @material_window.set_num(@number) if @material_window
  879.   end
  880. end


  881. #==============================================================================
  882. # ■ Window_ItemSynthesisCategory
  883. #------------------------------------------------------------------------------
  884. #  合成画面で、通常アイテムや装備品の分類を選択するウィンドウです。
  885. #==============================================================================

  886. class Window_ItemSynthesisCategory < Window_ItemCategory
  887.   #--------------------------------------------------------------------------
  888.   # ● 桁数の取得
  889.   #--------------------------------------------------------------------------
  890.   def col_max
  891.     i = 0
  892.     i += 1 if WD_itemsynthesis_ini::Category_i
  893.     i += 1 if WD_itemsynthesis_ini::Category_w
  894.     i += 1 if WD_itemsynthesis_ini::Category_a
  895.     i += 1 if WD_itemsynthesis_ini::Category_k
  896.     return i
  897.   end
  898.   #--------------------------------------------------------------------------
  899.   # ● コマンドリストの作成
  900.   #--------------------------------------------------------------------------
  901.   def make_command_list
  902.     add_command(Vocab::item,     :item)     if WD_itemsynthesis_ini::Category_i
  903.     add_command(Vocab::weapon,   :weapon)   if WD_itemsynthesis_ini::Category_w
  904.     add_command(Vocab::armor,    :armor)    if WD_itemsynthesis_ini::Category_a
  905.     add_command(Vocab::key_item, :key_item) if WD_itemsynthesis_ini::Category_k
  906.   end
  907. end

  908. class Window_ItemSynthesisCategoryEX1 < Window_ItemCategory
  909.   def col_max
  910.     return 3 #▼
  911.   end
  912.   def make_command_list
  913.     add_command("剑系", :weapon_a) #▼
  914.     add_command("斧系", :weapon_b) #▼
  915.     add_command("枪系", :weapon_c) #▼
  916.   end
  917. end

  918. class Window_ItemSynthesisCategoryEX2 < Window_ItemCategory
  919.   def col_max
  920.     return 4 #▼
  921.   end
  922.   def make_command_list
  923.     add_command("盾", :armor_a) #▼
  924.     add_command("甲", :armor_b) #▼
  925.     add_command("盔", :armor_c) #▼
  926.     add_command("饰", :armor_d) #▼
  927.   end
  928. end

  929. #==============================================================================
  930. # ■ Window_ItemSynthesisNumber
  931. #------------------------------------------------------------------------------
  932. #  合成画面で、切替を表示するウィンドウです。
  933. #==============================================================================

  934. class Window_ItemSynthesisChange < Window_Base
  935.   #--------------------------------------------------------------------------
  936.   # ● オブジェクト初期化
  937.   #--------------------------------------------------------------------------
  938.   def initialize(x, y, width, height)
  939.     super(x, y, width, height)
  940.     refresh
  941.   end
  942.   #--------------------------------------------------------------------------
  943.   # ● リフレッシュ
  944.   #--------------------------------------------------------------------------
  945.   def refresh
  946.     contents.clear
  947.     text = "点击A键隐藏材料清单"
  948.     draw_text(0, 0, contents_width, line_height, text, 1)
  949.   end
  950. end
复制代码

無法滾動的代碼框什麼的好影響閱讀

点评

不過我想你現在早就會了........  发表于 2013-10-28 07:51
我現在才看到........... 代碼框有Ruby版跟一般Code版 在高級模式中的就是Ruby版  发表于 2013-10-28 07:51
好吧我又忘了,点评里@不到人…………  发表于 2013-10-6 10:52
哇,感谢版主,话说…………怎么调整代码框……@76213585  发表于 2013-10-6 10:51
萌新瑟瑟发抖
看到我请叫我去干活
回复

使用道具 举报

梦石
0
星屑
55
在线时间
323 小时
注册时间
2010-8-21
回帖
638
发表于 2013-8-13 03:51:47 | 显示全部楼层
貌似没懂lz意思,“用语”里面不是有“武器类型”(weapon_obj.wtype_id)和"护甲类型"(armor_obj.atype_id)么,对照设定就能
设定为剑系、斧系、枪系等等等等...
>>猛戳>>MetalSagaR游戏主页<<这里<<
欢迎提供您的意见
回复

使用道具 举报

梦石
0
星屑
55
在线时间
79 小时
注册时间
2013-1-15
回帖
76
发表于 2013-8-13 06:22:07 | 显示全部楼层
本帖最后由 qqabcc 于 2013-8-13 06:24 编辑

弄下来研究下
回复

使用道具 举报

梦石
0
星屑
752
在线时间
800 小时
注册时间
2011-10-20
回帖
2257

开拓者

发表于 2013-8-13 10:04:40 | 显示全部楼层
瞬鼠的题一般都很简单,俺也来试试手气

点评

既然这么多人俺就放弃抢撸主了。  发表于 2013-8-14 18:00
欢迎点此进入我的egames.wink.ws,有RMQQ堂等

[url=http://rpg.blue/thread-317273-1-1.html]短篇八-赶选

http://yun.baidu.com/share/link?shareid=2158225779&uk=169642147&third=0


历险?ARPG?赢回你的疆域?新的战斗模式?…………点击这里:[宋乱贼狂 for QQ堂]
http://rpg.blue/group-368-1.html
programing ....?
[url=http://rpg.blue/thrd-234658-1-1.html]
回复

使用道具 举报

梦石
0
星屑
239
在线时间
2399 小时
注册时间
2008-4-11
回帖
11727

贵宾第6届短篇游戏比赛季军

 楼主| 发表于 2013-8-13 13:34:23 来自手机 | 显示全部楼层
end55rpg 发表于 2013-8-13 10:04
瞬鼠的题一般都很简单,俺也来试试手气

谢谢啊,希望能研究出来
回复

使用道具 举报

梦石
0
星屑
50
在线时间
256 小时
注册时间
2013-5-27
回帖
187
发表于 2013-8-13 13:43:51 | 显示全部楼层
我这个应该对你有帮助,剩下的我估计你自己能搞定。
http://rpg.blue/thread-325946-1-1.html
回复

使用道具 举报

梦石
1
星屑
23371
在线时间
9572 小时
注册时间
2012-6-19
回帖
7021

开拓者短篇九导演组冠军

发表于 2013-8-13 15:40:41 | 显示全部楼层
本帖最后由 喵呜喵5 于 2013-8-14 16:06 编辑

瞬鼠的题一般都很简单,俺也来试试手气+1

只说思路,因为这个白之魔的脚本好长懒得看了…………= =

先插入这两段脚本:

  1. class RPG::UsableItem
  2.   def item2?
  3.     /<item2>/ =~ @note ? true : false  
  4.   end
  5. end
  6. #检查物品的备注栏里面有没有<item2>这样的备注

  7. class RPG::EquipItem
  8.   def equip2?
  9.     /<equip2>/ =~ @note ? true : false  
  10.   end
  11. end
  12. #检查武器、护甲的备注栏里面有没有<Equip2>这样的备注
复制代码


然后修改你拿出来的那段脚本

  1. case @category
  2.     when :item
  3.       item.is_a?(RPG::Item) && !item.key_item? && !item.item2? #如果备注栏里有<item2>就不在这个分类中显示本物品
  4.     when :item2
  5.       item.is_a?(RPG::Item) && !item.key_item? && item.item2? #只在这个分类中显示备注栏里有<item2>的物品
  6.     when :weapon
  7.       item.is_a?(RPG::Weapon) && !item.hide_item? && !item.equip2? #如果备注栏里有<equip2>就不在这个分类中显示本武器
  8.     when :weapon2
  9.       item.is_a?(RPG::Weapon) && !item.hide_item? && item.equip2? #只在这个分类中显示备注栏里有<equip2>的武器
  10.     when :armor
  11.       item.is_a?(RPG::Armor)  && !item.hide_item? && !item.equip2? #如果备注栏里有<equip2>就不在这个分类中显示本护甲
  12.     when :armor2
  13.       item.is_a?(RPG::Armor)  && !item.hide_item? && item.equip2? #只在这个分类中显示备注栏里有<equip2>的护甲
  14.     when :key_item
  15.       item.is_a?(RPG::Item) && item.key_item?
  16.     else
  17.       false
  18.     end
复制代码


这样应该就可以了,接着修改一下分类菜单就好了……
回复

使用道具 举报

梦石
0
星屑
239
在线时间
2399 小时
注册时间
2008-4-11
回帖
11727

贵宾第6届短篇游戏比赛季军

 楼主| 发表于 2013-8-13 18:09:22 来自手机 | 显示全部楼层
喵呜喵5 发表于 2013-8-13 15:40
瞬鼠的题一般都很简单,俺也来试试手气+1

只说思路,因为这个白之魔的脚本好长懒得看了…………= =

利用备注栏这个我也想到了,之所以没有提出来是因为我不知道会不会有什么潜在的冲突(我现在的系统里面就有利用备注栏的),不知道会不会有冲突
回复

使用道具 举报

梦石
0
星屑
239
在线时间
2399 小时
注册时间
2008-4-11
回帖
11727

贵宾第6届短篇游戏比赛季军

 楼主| 发表于 2013-8-13 18:09:59 来自手机 | 显示全部楼层
喵呜喵5 发表于 2013-8-13 15:40
瞬鼠的题一般都很简单,俺也来试试手气+1

只说思路,因为这个白之魔的脚本好长懒得看了…………= =

利用备注栏这个我也想到了,之所以没有提出来是因为我不知道会不会有什么潜在的冲突(我现在的系统里面就有利用备注栏的),不知道会不会有冲突
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部