查看: 3254|回复: 8

[已经解决] 寻找【道具生成系统】

[复制链接]
梦石
1
星屑
7574
在线时间
2650 小时
注册时间
2013-8-23
回帖
2152

开拓者

发表于 2013-8-28 16:00:30 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 鑫晴 于 2013-8-29 11:44 编辑

                                    
                                

                                              虽然知道伸手不好,但是找了很久都没找到满意的。
                                                                                                                                                                                                  
                                如果大家手头上有这脚本,麻烦您按下手中的"Ctrl+C"然后在回帖框中"Ctrl+V" ,谢谢!




                                 吐槽 1:  关于【生成系统】的,找了很多个脚本,都是NPC版的,VA超级整合那样....
                                 吐槽 2:  在论坛翻了几个小时,10个关于【生成系统】的脚本,70%以上都是VX,XP版本....




                                      
                                      【问题描述】:
                                                                                                                             
                                                 我想要一个想【任务系统】那样子的,直接打开菜单,就可以使用。

                                       
                                     【版本要求】:
                                                
                                                  RMVXAce




                     

                                                  
                                                                            华丽丽地向各位伸手......
         

                                                                                         默默等待着各位的复制粘贴......









                     
梦石
0
星屑
600
在线时间
1118 小时
注册时间
2012-12-24
回帖
761
发表于 2013-8-28 16:22:32 | 显示全部楼层
没明白楼主想要什么啊
是合成系统吗?

点评

是的  发表于 2013-8-28 16:32

点击签名档去一个神奇的地方
回复

使用道具 举报

梦石
0
星屑
600
在线时间
1118 小时
注册时间
2012-12-24
回帖
761
发表于 2013-8-28 16:36:04 | 显示全部楼层

  1. #encoding:utf-8
  2. #==============================================================================
  3. #
  4. #每添加一个制造的类型,最上面的类别菜单就会多一项。
  5. #
  6. #添加类型的方法是:
  7. #$game_party.add_cook_type(类别名称,类别介绍, 类别状态-默认false)
  8. #
  9. #举例:
  10. #$game_party.add_cook_type("制药","调配药品", true)
  11. #
  12. #添加配方的方法:
  13. #$game_party.add_cookbook(配方名称, 配方介绍, 配方类别名称,材料的二维数组,产出物的二维数组,配方状态默认为true)
  14. #
  15. #举例:
  16. #$game_party.add_cookbook("初级补血药水", "制作初级补血药水", "制药",[[18,2],[3,4],[2,5]],[[1,1],[44,5]],true)
  17. #
  18. #调用窗口的方法:SceneManager.call(Scene_Cook)
  19. #==============================================================================

  20. #==============================================================================
  21. # ■ Cookbook_Type
  22. #------------------------------------------------------------------------------
  23. #  食谱类型类。
  24. #==============================================================================

  25. class Cookbook_Type
  26.   attr_reader :index
  27.   attr_reader :name
  28.   attr_reader :description
  29.   attr_reader :enabled
  30.   #--------------------------------------------------------------------------
  31.   # ● 初始化对象
  32.   #--------------------------------------------------------------------------
  33.   def initialize(index, name, description, enabled = false)
  34.     [url=home.php?mod=space&uid=370741]@Index[/url] = index
  35.     @name = name
  36.     @description = description
  37.     @enabled = enabled
  38.   end
  39.   
  40.   def enable(en)
  41.     @enabled = en
  42.   end
  43. end

  44. #==============================================================================
  45. # ■ Cookbook
  46. #------------------------------------------------------------------------------
  47. #  食谱类。本类在 Game_Task 类的内部使用。
  48. #   食谱属性:食谱序号,食谱名称,食谱类型,食谱介绍,原料,成品
  49. #==============================================================================

  50. class Cookbook
  51.   attr_reader :index
  52.   attr_reader :name
  53.   attr_reader :description
  54.   attr_reader :type
  55.   attr_reader :input
  56.   attr_reader :output
  57.   attr_reader :enabled
  58.   #--------------------------------------------------------------------------
  59.   # ● 初始化对象
  60.   #--------------------------------------------------------------------------
  61.   def initialize(index, name, description, type, input, output, enabled = true)
  62.     @index = index
  63.     @name = name
  64.     @description = description
  65.     @type = type
  66.     @input = input
  67.     @output = output
  68.     @enabled = enabled
  69.   end
  70.   
  71.   def enable(en)
  72.     @enabled = en
  73.   end
  74.   
  75.   #--------------------------------------------------------------------------
  76.   # ● 查询列表中的物品
  77.   #--------------------------------------------------------------------------
  78.   def in_list?(item, list)
  79.     list.each do |arr|
  80.       return true if arr[0] == item.id
  81.     end
  82.     return false
  83.   end
  84.   #--------------------------------------------------------------------------
  85.   # ● 查询是否是材料列表中的物品
  86.   #--------------------------------------------------------------------------
  87.   def resource?(item)
  88.     in_list?(item, @input)
  89.   end
  90.   #--------------------------------------------------------------------------
  91.   # ● 查询是否是产出列表中的物品
  92.   #--------------------------------------------------------------------------
  93.   def output?(item)
  94.     in_list?(item, @output)
  95.   end
  96.   #--------------------------------------------------------------------------
  97.   # ● 查询材料需求量
  98.   #--------------------------------------------------------------------------
  99.   def amount(item, i)
  100.     if i == 0
  101.       @input.each do |arr|
  102.         return arr[1] if arr[0] == item.id
  103.       end
  104.     else
  105.       @output.each do |arr|
  106.         return arr[1] if arr[0] == item.id
  107.       end
  108.     end
  109.     return 0
  110.   end
  111.   #--------------------------------------------------------------------------
  112.   # ● 查询材料是否足够
  113.   #--------------------------------------------------------------------------
  114.   def enough?
  115.     input.each do |arr|
  116.       return false if $data_items[arr[0]] && arr[1] > $game_party.item_number($data_items[arr[0]])
  117.     end
  118.     return true
  119.   end
  120.   #--------------------------------------------------------------------------
  121.   # ● 查询某件材料是否足够
  122.   #--------------------------------------------------------------------------
  123.   def item_enough?(item)
  124.     input.each do |arr|
  125.       return false if arr[0] == item.id && arr[1] > $game_party.item_number(item)
  126.     end
  127.     return true
  128.   end
  129. end

  130. #==============================================================================
  131. # ■ Game_Party
  132. #==============================================================================

  133. class Game_Party < Game_Unit
  134.   #--------------------------------------------------------------------------
  135.   # ● 初始化对象
  136.   #--------------------------------------------------------------------------
  137.   alias old_init initialize
  138.   def initialize
  139.     old_init
  140.     @cook_types = []
  141.     @cookbooks = []
  142.   end
  143.   #--------------------------------------------------------------------------
  144.   # ● 添加新的食谱类型
  145.   #--------------------------------------------------------------------------
  146.   def add_cook_type(n, d, en)
  147.     @cook_types.push(Cookbook_Type.new(@cook_types.size, n, d, en)) if !have_cook_type?(n)
  148.   end
  149.   #--------------------------------------------------------------------------
  150.   # ● 添加新的食谱
  151.   #--------------------------------------------------------------------------
  152.   def add_cookbook(n, d, type, input, output, en)
  153.     if !have_cookbook?(n) && have_cook_type?(type)
  154.       @cookbooks.push(Cookbook.new(@cookbooks.size, n, d, type, input, output, en))
  155.     end
  156.   end
  157.   #--------------------------------------------------------------------------
  158.   # ● 判断名称为n的食谱类型是否存在
  159.   #--------------------------------------------------------------------------
  160.   def have_cook_type?(n)
  161.     @cook_types.each do |x|
  162.       return true if x.name == n
  163.     end
  164.     return false
  165.   end
  166.   #--------------------------------------------------------------------------
  167.   # ● 判断名称为n的食谱是否存在
  168.   #--------------------------------------------------------------------------
  169.   def have_cookbook?(n)
  170.     @cookbooks.each do |x|
  171.       return true if x.name == n
  172.     end
  173.     return false
  174.   end
  175.   #--------------------------------------------------------------------------
  176.   # ● 返回食谱类型列表
  177.   #--------------------------------------------------------------------------
  178.   def cook_types
  179.     return @cook_types
  180.   end
  181.   #--------------------------------------------------------------------------
  182.   # ● 返回食谱列表
  183.   #--------------------------------------------------------------------------
  184.   def cookbooks(type = nil)
  185.     return @cookbooks if type == nil
  186.     arr = []
  187.     @cookbooks.each do |x|
  188.       arr.push(x) if x.type == type
  189.     end
  190.     return arr
  191.   end
  192.   #--------------------------------------------------------------------------
  193.   # ● 更改序号为i的食谱类型的使用状态
  194.   #--------------------------------------------------------------------------
  195.   def set_cook_type(i, en)
  196.     @cook_types[i].enable(en)
  197.   end
  198.   #--------------------------------------------------------------------------
  199.   # ● 更改序号为i的食谱的使用状态
  200.   #--------------------------------------------------------------------------
  201.   def set_cookbook(i, en)
  202.     @cookbooks[i].enable(en)
  203.   end
  204.   #--------------------------------------------------------------------------
  205.   # ● 返回食谱类型数目
  206.   #--------------------------------------------------------------------------
  207.   def cook_types_size
  208.     return @cook_types.size
  209.   end
  210.   #--------------------------------------------------------------------------
  211.   # ● 查询名称为n的食谱类型的描述
  212.   #--------------------------------------------------------------------------
  213.   def cook_type_description(n)
  214.     @cook_types.each do |x|
  215.       return x.description if x.name == n
  216.     end
  217.     return ""
  218.   end
  219. end

  220. #==============================================================================
  221. # ■ Scene_Cook
  222. #------------------------------------------------------------------------------
  223. #  烹饪画面
  224. #==============================================================================

  225. class Scene_Cook < Scene_ItemBase
  226.   #--------------------------------------------------------------------------
  227.   # ● 开始处理
  228.   #--------------------------------------------------------------------------
  229.   def start
  230.     super
  231.     create_category_window
  232.     create_cookbook_window
  233.     create_description_window
  234.     create_needs_window
  235.   end
  236.   #--------------------------------------------------------------------------
  237.   # ● 生成分类窗口
  238.   #--------------------------------------------------------------------------
  239.   def create_category_window
  240.     @category_window = Window_CookCategory.new
  241.     @category_window.viewport = @viewport
  242.     @category_window.y = 0
  243.     @category_window.set_handler(:ok,     method(:on_category_ok))
  244.     @category_window.set_handler(:cancel, method(:return_scene))
  245.   end
  246.   #--------------------------------------------------------------------------
  247.   # ● 生成食谱窗口
  248.   #--------------------------------------------------------------------------
  249.   def create_cookbook_window
  250.     wy = @category_window.height
  251.     wh = Graphics.height - wy
  252.     @item_window = Window_CookList.new(0, wy, Graphics.width*0.5 , wh)
  253.     @item_window.viewport = @viewport
  254.     @item_window.set_handler(:ok,     method(:on_item_ok))
  255.     @item_window.set_handler(:cancel, method(:on_item_cancel))
  256.     @category_window.item_window = @item_window
  257.   end
  258.   #--------------------------------------------------------------------------
  259.   # ● 生成描述窗口
  260.   #--------------------------------------------------------------------------
  261.   def create_description_window
  262.     wy = @category_window.height
  263.     @help_window = Window_Description.new(Graphics.width*0.5, wy)
  264.     @help_window.viewport = @viewport
  265.     @item_window.help_window = @help_window
  266.     @category_window.help_window = @help_window
  267.   end
  268.     #--------------------------------------------------------------------------
  269.   # ● 生成材料窗口
  270.   #--------------------------------------------------------------------------
  271.   def create_needs_window
  272.     wy = @category_window.height + @help_window.height
  273.     wh = Graphics.height - wy
  274.     @needs_window = Window_NeedsList.new(Graphics.width*0.5, wy, Graphics.width*0.5 , wh)
  275.     #@item_window.viewport = @viewport
  276.     @item_window.needs_window = @needs_window
  277.    
  278.   end
  279.   #--------------------------------------------------------------------------
  280.   # ● 分类“确定”
  281.   #--------------------------------------------------------------------------
  282.   def on_category_ok
  283.     @item_window.activate
  284.     @item_window.select_last
  285.   end
  286.   #--------------------------------------------------------------------------
  287.   # ● 食谱“确定”
  288.   #--------------------------------------------------------------------------
  289.   def on_item_ok
  290.     #$game_party.last_item.object = item
  291.     cook
  292.   end
  293.   #--------------------------------------------------------------------------
  294.   # ● 食谱“取消”
  295.   #--------------------------------------------------------------------------
  296.   def on_item_cancel
  297.     @item_window.unselect
  298.     @category_window.activate
  299.   end
  300.   #--------------------------------------------------------------------------
  301.   # ● 烹饪
  302.   #--------------------------------------------------------------------------
  303.   def cook
  304.     if item.enough?
  305.       play_se_for_item
  306.       use_item
  307.       @needs_window.refresh
  308.       @item_window.refresh
  309.       activate_item_window
  310.     end
  311.   end
  312.   #--------------------------------------------------------------------------
  313.   # ● 播放制作声效
  314.   #--------------------------------------------------------------------------
  315.   def play_se_for_item
  316.     Sound.play_recovery
  317.   end
  318.   #--------------------------------------------------------------------------
  319.   # ● 使用食谱
  320.   #--------------------------------------------------------------------------
  321.   def use_item
  322.     #super
  323.     #@item_window.redraw_current_item
  324.     $data_items.each do |it|
  325.       if it && !it.name.empty?
  326.         $game_party.gain_item(it,-item.amount(it,0)) if item.resource?(it)
  327.         $game_party.gain_item(it,item.amount(it,1)) if item.output?(it)
  328.       end
  329.     end
  330.   end
  331. end


  332. #==============================================================================
  333. # ■ Window_CookCategory
  334. #------------------------------------------------------------------------------
  335. #  烹饪画面中,显示食谱类型的窗口。
  336. #==============================================================================

  337. class Window_CookCategory < Window_HorzCommand
  338.   #--------------------------------------------------------------------------
  339.   # ● 定义实例变量
  340.   #--------------------------------------------------------------------------
  341.   attr_reader   :item_window
  342.   #--------------------------------------------------------------------------
  343.   # ● 初始化对象
  344.   #--------------------------------------------------------------------------
  345.   def initialize
  346.     super(0, 0)
  347.   end
  348.   #--------------------------------------------------------------------------
  349.   # ● 获取窗口的宽度
  350.   #--------------------------------------------------------------------------
  351.   def window_width
  352.     Graphics.width
  353.   end
  354.   #--------------------------------------------------------------------------
  355.   # ● 获取列数
  356.   #--------------------------------------------------------------------------
  357.   def col_max
  358.     return $game_party.cook_types_size
  359.   end
  360.   #--------------------------------------------------------------------------
  361.   # ● 更新画面
  362.   #--------------------------------------------------------------------------
  363.   def update
  364.     super
  365.     #@item_window.category = current_symbol if @item_window
  366.     @item_window.category = current_data[:name] if @item_window
  367.   end
  368.   #--------------------------------------------------------------------------
  369.   # ● 生成食谱类型列表
  370.   #--------------------------------------------------------------------------
  371.   def make_command_list
  372.     $game_party.cook_types.each do |t|
  373.       add_command(t.name, t.index, t.enabled)
  374.     end
  375.   end
  376.   #--------------------------------------------------------------------------
  377.   # ● 设置食谱列表窗口
  378.   #--------------------------------------------------------------------------
  379.   def item_window=(item_window)
  380.     @item_window = item_window
  381.     update
  382.   end
  383.   #--------------------------------------------------------------------------
  384.   # ● 更新帮助内容
  385.   #--------------------------------------------------------------------------
  386.   def update_help
  387.     @help_window.set_text($game_party.cook_type_description(current_data[:name]))
  388.   end
  389. end

  390. #==============================================================================
  391. # ■ Window_CookList
  392. #------------------------------------------------------------------------------
  393. #  任务画面中,显示已获得任务的窗口。
  394. #==============================================================================

  395. class Window_CookList < Window_Selectable
  396.   #--------------------------------------------------------------------------
  397.   # ● 定义实例变量
  398.   #--------------------------------------------------------------------------
  399.   attr_reader   :needs_window
  400.   #--------------------------------------------------------------------------
  401.   # ● 初始化对象
  402.   #--------------------------------------------------------------------------
  403.   def initialize(x, y, width, height)
  404.     super
  405.     @data = []
  406.     @category = $game_party.cook_types_size > 0 ? $game_party.cook_types[0].name : nil
  407.     refresh
  408.   end
  409.   #--------------------------------------------------------------------------
  410.   # ● 设置分类
  411.   #--------------------------------------------------------------------------
  412.   def category=(category)
  413.     return if @category == category
  414.     @category = category
  415.     refresh
  416.     self.oy = 0
  417.   end
  418.   #--------------------------------------------------------------------------
  419.   # ● 设置材料窗口
  420.   #--------------------------------------------------------------------------
  421.   def needs_window=(needs_window)
  422.     @needs_window = needs_window
  423.     update
  424.   end
  425.   #--------------------------------------------------------------------------
  426.   # ● 获取列数
  427.   #--------------------------------------------------------------------------
  428.   def col_max
  429.     return 1
  430.   end
  431.   #--------------------------------------------------------------------------
  432.   # ● 获取项目数
  433.   #--------------------------------------------------------------------------
  434.   def item_max
  435.     @data ? @data.size : 1
  436.   end
  437.   #--------------------------------------------------------------------------
  438.   # ● 获取食谱
  439.   #--------------------------------------------------------------------------
  440.   def item
  441.     @data && index >= 0 ? @data[index] : nil
  442.   end
  443.   #--------------------------------------------------------------------------
  444.   # ● 获取选择食谱的有效状态
  445.   #--------------------------------------------------------------------------
  446.   def current_item_enabled?
  447.     enable?(@data[index])
  448.   end
  449.   #--------------------------------------------------------------------------
  450.   # ● 查询此食谱是否可用
  451.   #--------------------------------------------------------------------------
  452.   def enable?(item)
  453.     item.enabled && item.enough?
  454.   end
  455.   #--------------------------------------------------------------------------
  456.   # ● 生成食谱列表
  457.   #--------------------------------------------------------------------------
  458.   def make_item_list
  459.     @data = $game_party.cookbooks(@category)
  460.   end
  461.   #--------------------------------------------------------------------------
  462.   # ● 返回上一个选择的位置
  463.   #--------------------------------------------------------------------------
  464.   def select_last
  465.     select(0)
  466.   end
  467.   #--------------------------------------------------------------------------
  468.   # ● 绘制项目
  469.   #--------------------------------------------------------------------------
  470.   def draw_item(index)
  471.     item = @data[index]
  472.     if item
  473.       rect = item_rect(index)
  474.       rect.width -= 4
  475.       draw_item_name(item, rect.x, rect.y, enable?(item))
  476.     end
  477.   end
  478.   #--------------------------------------------------------------------------
  479.   # ● 绘制名称
  480.   #     enabled : 有效的标志。false 的时候使用半透明效果绘制
  481.   #--------------------------------------------------------------------------
  482.   def draw_item_name(item, x, y, enabled = true, width = 300)
  483.     return unless item
  484.     text = item.name
  485.     text += "[材料不足]" if !item.enough?
  486.     change_color(normal_color, enabled)
  487.     draw_text(x, y, width, line_height, text)
  488.   end
  489.   #--------------------------------------------------------------------------
  490.   # ● 更新帮助内容
  491.   #--------------------------------------------------------------------------
  492.   def update_help
  493.     @help_window.set_item(item)
  494.   end
  495.    #--------------------------------------------------------------------------
  496.   # ● 更新食谱清单
  497.   #--------------------------------------------------------------------------
  498.   def update_needslist
  499.     @needs_window.set_item(item)
  500.   end
  501.   #--------------------------------------------------------------------------
  502.   # ● 调用帮助窗口的更新方法
  503.   #--------------------------------------------------------------------------
  504.   def call_update_help
  505.     update_help if @help_window
  506.     update_needslist if @needs_window
  507.   end
  508.   #--------------------------------------------------------------------------
  509.   # ● 刷新
  510.   #--------------------------------------------------------------------------
  511.   def refresh
  512.     make_item_list
  513.     create_contents
  514.     draw_all_items
  515.   end
  516. end
  517. #==============================================================================
  518. # ■ Window_Description
  519. #------------------------------------------------------------------------------
  520. #  显示食谱的说明的窗口
  521. #==============================================================================

  522. class Window_Description < Window_Base
  523.   #--------------------------------------------------------------------------
  524.   # ● 初始化对象
  525.   #--------------------------------------------------------------------------
  526.   def initialize(x, y)
  527.     super(x, y, Graphics.width*0.5, fitting_height(4))
  528.   end
  529.   #--------------------------------------------------------------------------
  530.   # ● 设置内容
  531.   #--------------------------------------------------------------------------
  532.   def set_text(text)
  533.     if text != @text
  534.       @text = text
  535.       refresh
  536.     end
  537.   end
  538.   #--------------------------------------------------------------------------
  539.   # ● 清除
  540.   #--------------------------------------------------------------------------
  541.   def clear
  542.     set_text("")
  543.   end
  544.   #--------------------------------------------------------------------------
  545.   # ● 设置食谱的介绍
  546.   #--------------------------------------------------------------------------
  547.   def set_item(item)
  548.     set_text(item ? item.description : "")
  549.   end
  550.   #--------------------------------------------------------------------------
  551.   # ● 刷新
  552.   #--------------------------------------------------------------------------
  553.   def refresh
  554.     contents.clear
  555.     draw_text_ex(4, 0, @text)
  556.   end
  557. end

  558. #==============================================================================
  559. # ■ Window_NeedsList
  560. #------------------------------------------------------------------------------
  561. #  烹饪画面中,显示食谱所需材料的窗口。
  562. #==============================================================================

  563. class Window_NeedsList < Window_Selectable
  564.   #--------------------------------------------------------------------------
  565.   # ● 初始化对象
  566.   #--------------------------------------------------------------------------
  567.   def initialize(x, y, width, height)
  568.     super
  569.     @category = :item
  570.     @cookbook = nil
  571.     @data = []
  572.     refresh
  573.   end
  574.   #--------------------------------------------------------------------------
  575.   # ● 获取列数
  576.   #--------------------------------------------------------------------------
  577.   def col_max
  578.     return 1
  579.   end
  580.   #--------------------------------------------------------------------------
  581.   # ● 获取项目数
  582.   #--------------------------------------------------------------------------
  583.   def item_max
  584.     @data ? @data.size : 1
  585.   end
  586.   #--------------------------------------------------------------------------
  587.   # ● 获取物品
  588.   #--------------------------------------------------------------------------
  589.   def item
  590.     @data && index >= 0 ? @data[index] : nil
  591.   end
  592.   #--------------------------------------------------------------------------
  593.   # ● 查询列表中是否含有此物品
  594.   #--------------------------------------------------------------------------
  595.   def include?(item)
  596.     item.is_a?(RPG::Item) && !item.key_item?
  597.   end
  598.   #--------------------------------------------------------------------------
  599.   # ● 获取选择食谱的有效状态
  600.   #--------------------------------------------------------------------------
  601.   def current_item_enabled?
  602.     enable?(@data[index])
  603.   end
  604.   #--------------------------------------------------------------------------
  605.   # ● 查询此食谱是否可用
  606.   #--------------------------------------------------------------------------
  607.   def enable?(item)
  608.     $game_party.usable?(item) && @cookbook.item_enough?(item)
  609.   end
  610.   #--------------------------------------------------------------------------
  611.   # ● 生成物品列表
  612.   #--------------------------------------------------------------------------
  613.   def make_item_list
  614.     @data = []
  615.     return if @cookbook== nil
  616.     tmp1 = []
  617.     tmp2 = []
  618.     $data_items.each do |item|
  619.       tmp1.push([item, 0]) if item && !item.name.empty? && @cookbook.resource?(item)
  620.       tmp2.push([item, 1]) if item && !item.name.empty? && @cookbook.output?(item)
  621.     end
  622.     if tmp1.size > 0 && tmp2.size > 0
  623.       @data.push(["需要材料:",0])
  624.       @data += tmp1
  625.       @data.push(["可以获得:",1])
  626.       @data += tmp2
  627.     end
  628.   end
  629.   #--------------------------------------------------------------------------
  630.   # ● 返回上一个选择的位置
  631.   #--------------------------------------------------------------------------
  632.   def select_last
  633.     select(0)
  634.   end
  635.   #--------------------------------------------------------------------------
  636.   # ● 绘制项目
  637.   #--------------------------------------------------------------------------
  638.   def draw_item(index)
  639.     item = @data[index]
  640.     if item
  641.       rect = item_rect(index)
  642.       rect.width -= 4
  643.       if item[0].is_a?(RPG::Item)
  644.         draw_item_name(item, rect.x, rect.y, enable?(item[0]))
  645.         draw_item_number(rect, item[0])
  646.       else
  647.         draw_input_output(item, rect.x, rect.y)
  648.       end
  649.     end
  650.   end
  651.   #--------------------------------------------------------------------------
  652.   # ● 绘制物品名称
  653.   #     enabled : 有效的标志。false 的时候使用半透明效果绘制
  654.   #--------------------------------------------------------------------------
  655.   def draw_item_name(item, x, y, enabled = true, width = 172)
  656.     return unless item
  657.     text = item[0].name + "*" + String(@cookbook.amount(item[0], item[1]))
  658.     draw_icon(item[0].icon_index, x, y, enabled)
  659.     change_color(normal_color, enable?(item[0]))
  660.     draw_text(x + 24, y, width, line_height, text)
  661.   end
  662.   #--------------------------------------------------------------------------
  663.   # ● 绘制输入和产出
  664.   #--------------------------------------------------------------------------
  665.   def draw_input_output(item, x, y, enabled = false, width = 172)
  666.     return unless item
  667.     if item[1] == 0
  668.       text = "[需要]"
  669.     else
  670.       text = "[可以获得]"
  671.     end
  672.     change_color(normal_color, @cookbook.enough?)
  673.     draw_text(x , y, width, line_height, text)
  674.   end
  675.   #--------------------------------------------------------------------------
  676.   # ● 绘制物品个数
  677.   #--------------------------------------------------------------------------
  678.   def draw_item_number(rect, item)
  679.     draw_text(rect, sprintf("现有%2d", $game_party.item_number(item)), 2)
  680.   end
  681.   #--------------------------------------------------------------------------
  682.   # ● 刷新
  683.   #--------------------------------------------------------------------------
  684.   def refresh
  685.     make_item_list
  686.     create_contents
  687.     draw_all_items
  688.   end
  689.   #--------------------------------------------------------------------------
  690.   # ● 设置食谱的材料
  691.   #--------------------------------------------------------------------------
  692.   def set_item(item)
  693.     @cookbook = item
  694.     refresh
  695.   end
  696. end
复制代码
每添加一个制造的类型,最上面的类别菜单就会多一项。
添加类型的方法是:$game_party.add_cook_type(类别名称,类别介绍, 类别状态-默认false)
举例:$game_party.add_cook_type("制药","调配药品", true)

添加配方的方法:$game_party.add_cookbook(配方名称, 配方介绍, 配方类别名称,材料的二维数组,产出物的二维数组,true)
举例:$game_party.add_cookbook("初级补血药水配方", "用赤血草制作初级补血药水", "制药",[[18,2],[3,4],[2,5]],[[1,1],[44,5]],true)
二维数组里面,每一个[m,n]里的m是物品id,n是需要物品的数量。理论上来说加几个不同物品都是没问题的。但是显示材料的窗口会显示不下。。

调用窗口的方法:SceneManager.call(Scene_Cook)


点评

把第37行,[url=home.php?mod=space&uid=370741]以及[/url]去掉~~  发表于 2013-8-28 20:08
第37行, [url=home.php?mod=space&uid=370741]@Index[/url] = index,这句话会报错  发表于 2013-8-28 16:48

点击签名档去一个神奇的地方
回复

使用道具 举报

梦石
1
星屑
7574
在线时间
2650 小时
注册时间
2013-8-23
回帖
2152

开拓者

 楼主| 发表于 2013-8-28 16:43:46 | 显示全部楼层
调用窗口的方法:SceneManager.call(Scene_Cook)

新建一个事件,然后选择自动执行,插入脚本SceneManager.call(Scene_Cook),就可以在菜单栏中打开了吗?
回复

使用道具 举报

梦石
1
星屑
7574
在线时间
2650 小时
注册时间
2013-8-23
回帖
2152

开拓者

 楼主| 发表于 2013-8-28 18:27:50 | 显示全部楼层
本帖最后由 鑫晴 于 2013-8-28 18:31 编辑

                                                                                                    ◆ 连贴 ◆
  
                                                                       @江户川洛奇                                             



                                                                                              那个脚本用不了。


                                   
情况一:当完整的复制粘贴过去后,F12运行,弹出错误:
                  

                                                          21.png


                    


  情况二:当删除提示错误的那句
         
  1. [url=home.php?mod=space&uid=370741]@Index[/url] = index
复制代码



                  再次运行,又弹出个错误:
                     
                                     12.png

              






                                                                               {:2_271:}请问要怎么解决?









点评

还是不行....T T  发表于 2013-8-28 20:16
把第37行,[url=home.php?mod=space&uid=370741]以及[/url]去掉~~ @Index不要去掉~~  发表于 2013-8-28 20:09
回复

使用道具 举报

梦石
0
星屑
407
在线时间
1291 小时
注册时间
2013-1-12
回帖
3349

贵宾

发表于 2013-8-29 04:54:17 | 显示全部楼层
試試白魔的
  1. #==============================================================================
  2. # ■ RGSS3 合成 ver 1.01
  3. #------------------------------------------------------------------------------
  4. #  配布元:
  5. #     白の魔 [url]http://izumiwhite.web.fc2.com/[/url]
  6. #
  7. #  利用規約:
  8. #     RPGツクールVXの正規の登録者のみご利用になれます。
  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 = false #カテゴリウィンドウに「武器」の項目を表示
  23.   Category_a = false #カテゴリウィンドウに「防具」の項目を表示
  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]  = [0,  ["I",4,1], ["I",5,1]]

  38.   #武器の合成レシピ
  39.    W_recipe[2]  = [40,   ["A",1,2]]
  40.   #防具の合成レシピ  
  41.   A_recipe[2]  = [40,   ["A",1,2]]
  42. end


  43. #==============================================================================
  44. # ■ WD_itemsynthesis
  45. #------------------------------------------------------------------------------
  46. #  アイテム合成用の共通メソッドです。
  47. #==============================================================================

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

  134. end

  135. class Game_Interpreter
  136.   include WD_itemsynthesis
  137. end

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


  156. #==============================================================================
  157. # ■ Scene_ItemSynthesis
  158. #------------------------------------------------------------------------------
  159. #  合成画面の処理を行うクラスです。
  160. #==============================================================================

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

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


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

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


  674. #==============================================================================
  675. # ■ Window_ItemSynthesisMaterial
  676. #------------------------------------------------------------------------------
  677. #  合成画面で、合成に必要な素材を表示するウィンドウです。
  678. #==============================================================================

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


  757. #==============================================================================
  758. # ■ Window_ItemSynthesisNumber
  759. #------------------------------------------------------------------------------
  760. #  合成画面で、合成するアイテムの個数を入力するウィンドウです。
  761. #==============================================================================

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


  793. #==============================================================================
  794. # ■ Window_ItemSynthesisCategory
  795. #------------------------------------------------------------------------------
  796. #  合成画面で、通常アイテムや装備品の分類を選択するウィンドウです。
  797. #==============================================================================

  798. class Window_ItemSynthesisCategory < Window_ItemCategory
  799.   #--------------------------------------------------------------------------
  800.   # ● 桁数の取得
  801.   #--------------------------------------------------------------------------
  802.   def col_max
  803.     i = 1
  804. #~     i += 1 if WD_itemsynthesis_ini::Category_i
  805. #~     i += 1 if WD_itemsynthesis_ini::Category_w
  806. #~     i += 1 if WD_itemsynthesis_ini::Category_a
  807. #~     i += 1 if WD_itemsynthesis_ini::Category_k
  808.     return i
  809.   end
  810.   #--------------------------------------------------------------------------
  811.   # ● コマンドリストの作成
  812.   #--------------------------------------------------------------------------
  813.   def make_command_list
  814.     add_command(Vocab::item,     :item)     if WD_itemsynthesis_ini::Category_i
  815.     add_command(Vocab::weapon,   :weapon)   if WD_itemsynthesis_ini::Category_w
  816.     add_command(Vocab::armor,    :armor)    if WD_itemsynthesis_ini::Category_a
  817.     add_command(Vocab::key_item, :key_item) if WD_itemsynthesis_ini::Category_k
  818.   end
  819. end


  820. #==============================================================================
  821. # ■ Window_ItemSynthesisNumber
  822. #------------------------------------------------------------------------------
  823. #  合成画面で、切替を表示するウィンドウです。
  824. #==============================================================================

  825. class Window_ItemSynthesisChange < Window_Base
  826.   #--------------------------------------------------------------------------
  827.   # ● オブジェクト初期化
  828.   #--------------------------------------------------------------------------
  829.   def initialize(x, y, width, height)
  830.     super(x, y, width, height)
  831.     refresh
  832.   end
  833.   #--------------------------------------------------------------------------
  834.   # ● リフレッシュ
  835.   #--------------------------------------------------------------------------
  836.   def refresh
  837.     contents.clear
  838.     text = "← → :切換"
  839.     draw_text(0, 0, contents_width, line_height, text, 1)
  840.   end
  841. end



  842. class Window_MenuCommand < Window_Command  
  843.   alias itemSynthesis_add_main_commands add_main_commands
  844.   def add_main_commands
  845.       itemSynthesis_add_main_commands
  846.       add_command("制作", :ItemSynthesis, main_commands_enabled)
  847.   end
  848. end   
  849. class Scene_Menu < Scene_MenuBase
  850.    alias itemSynthesis_create_command_window create_command_window
  851.    def create_command_window
  852.        itemSynthesis_create_command_window  
  853.        @command_window.set_handler(:ItemSynthesis,     method(:Item_Synthesis))
  854.    end
  855.    def Item_Synthesis
  856.        SceneManager.call(Scene_ItemSynthesis)
  857.    end
  858. end   
复制代码


已經弄好加入菜單了~
使用方法:
如果懂漢字&進的去可以看這裡:http://izumiwhite.web.fc2.com/rgss3/rgss3_004.html
在腳本算是前面的地方可以設置合成公式  我相信你的程度 你應該懂 (不懂也請自己弄懂)
然後合成不是全開的  要用腳本句 (事件頁第三頁) 填寫來開啟
公式如下:
i_recipe_switch_on(n)        n号道具追加
i_recipe_switch_off(n)        n号道具削除
w_recipe_switch_on(n)        n号武器追加
w_recipe_switch_off(n)        n号武器削除
a_recipe_switch_on(n)        n号防具追加
a_recipe_switch_off(n)        n号防具削除
recipe_all_switch_on                全部追加
recipe_all_switch_off                全部削除


回复

使用道具 举报

梦石
0
星屑
600
在线时间
1118 小时
注册时间
2012-12-24
回帖
761
发表于 2013-8-29 09:12:31 | 显示全部楼层
  1. #==============================================================================
  2. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  3. # 欢迎访问www.66RPG.com
  4. # 梦想世界,在你手中
  5. #==============================================================================  
  6. #
  7. # Sample master list for crafting script (物品分类增强版) v1.1
  8. # written by Deke
  9. # 增强:叶子
  10. #
  11. # 12-30-2005 v1.0
  12. # 8-17-2006 v1.1
  13. # 修正了返回界面时不显示成品的BUG
  14. # 修正了材料大于8个不显示的BUG
  15. # 描绘物品美化
  16. # 自动检测能否合成
  17. #============================================================================================
  18. # 简介:
  19. # 这是一个很不错的合成物品系统,可以通过游戏的过程,不断学习可以合成的
  20. # 物品方法。
  21. # ------
  22. # 增强版补充说明:
  23. # 在这个增强版中,可以对成品进行手动分类。
  24. # 成品增加了一个分类属性。
  25. # 这个分类纯粹是按自己的意愿,没有规定第几类必须是什么。
  26. # 召唤特定分类的界面,就只会看到特定分类的成品。
  27. #
  28. # 例如:
  29. # 使用脚本$scene = Scene_Craft.new(1),
  30. # 出来的界面就只会显示成品分类为1的东西
  31. # 同样道理,使用脚本$scene = Scene_Craft.new(2),
  32. # 出来的界面就只会显示成品分类为2的东西
  33. #
  34. # 如果使用脚本$scene = Scene_Craft.new或$scene = Scene_Craft.new(0)来召唤界面
  35. # 就可以看到所有成品。
  36. #
  37. # 注意:不要弄混淆“成品种类”和“成品分类”
  38. # 成品种类是指成品是普通物品(0),防具(1)或武器(2)
  39. # 成品分类是指此物品的自定义分类
  40. #
  41. #
  42. # 使用方法:
  43. # 1、召唤界面:使用脚本$scene = Scene_Craft.new(分类的数字)
  44. # 例如:使用脚本$scene = Scene_Craft.new(1),出来分类1的界面
  45. #
  46. # 2、学习合成:$game_party.learn_recipe(合成项目)
  47. #
  48. #  2.1、其实这个脚本可以使同一成品有不同配方
  49. #
  50. #    就这样说可能解释得不清楚,先来解释一下脚本学习配方的原理:
  51. #    $game_party.learn_recipe(合成项目)的处理过程并不是直接学习这个配方,
  52. #    而是在配方库中找到和合成项目成品相同的配方。
  53. #
  54. #    如果配方库中有两个配方成品相同的话,配方版本就变得重要。
  55. #    $game_party.learn_recipe(合成项目,配方版本)
  56. #    配方版本为1的话,学到的配方就是@recipe_list[xx]中与合成项目成品相同且数字最小的配方
  57. #    配方版本为2的话,学到的配方就是数字第二小的配方
  58. #    在上面这个脚本语句中,不填配方版本的话就默认为1
  59. #
  60. #  2.2、忘记配方:$game_party.forget_recipe(合成项目)
  61. #   2.21、同样道理,这个语句也可以写配方版本
  62. #    $game_party.forget_recipe(合成项目,配方版本)
  63. #    配方版本定义见2.1
  64. #
  65. #  2.3、配方版本不能乱填!例如游戏中某一个配方的成品是唯一的,与所有其它配方的成品都不相同
  66. #   那么学习的时候就不用填配方版本。
  67. #   如果这时在配方版本填了2的话,就有可能学不到或者忘不了(-_-||)
  68. #   
  69. #
  70. # 3、合成定义:
  71. # 这个合成脚本可以定义两种合成物品。一种是预先定义好了的,就像下面这样,
  72. # 直接写在这里就可以,另一种是在学习之前现场定义。
  73. #
  74. # 4、举例
  75. #  4.1、学会recipe_list[1]定义的合成:$game_party.learn_recipe($game_temp.recipe_list[1])
  76. #       注意,一行如果输入不下,在(的后面或[的后面按回车换行,否则可能出错
  77. #
  78. #  4.2、在游戏中临时定义一种合成,让玩家学会。使用事件中的脚本如下,   
  79. #  脚本:
  80. #    材料 = [$game_variables[1],$game_variables[2]]  #——材料编号是变量1、2的编号
  81. #    材料种类 = [0,0]                                #——材料是物品
  82. #    材料数量 = [$game_variables[3],$game_variables[4]]  #——需要材料数量是变量3、4的编号
  83. #    成品 = $game_variables[5]                       #——获得结果编号是5
  84. #    成品种类 = 1                                    #——成品是防具类
  85. #    成品分类 = 1                                    #——这一项不写的话默认为0
  86. #    $game_party.learn_recipe(Game_Recipe.new(材料,材料种类,材料数量,成品,成品种类,成品分类))
  87. #    上面这条语句的成品分类这一项不写也行,这样它就默认为0了。
  88. #    (也就是此物品没有分类,不会在分类菜单中出现)
  89. #    省略成品分类的脚本语句可以像下面这样写:
  90. #    $game_party.learn_recipe(Game_Recipe.new(材料,材料种类,材料数量,成品,成品种类))
  91. #
  92. #===========================================================================================
  93. class Game_Temp
  94.   attr_reader :recipe_list  
  95.   alias crafting_temp_initialize initialize
  96.   def initialize
  97.     crafting_temp_initialize
  98.     @recipe_list=[]
  99.     get_recipe_list
  100.   end  
  101.   def get_recipe_list   
  102.     ##########################################################################
  103.     # 1 号合成物品设定 (物品小药水×2 + 中药水 = 大药水) 成品分类:1
  104.     ##########################################################################
  105.     材料 = [1, 2]             # 需要材料的数据库编号
  106.     材料种类 = [0, 0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
  107.     材料数量 = [2, 1]         # 需要材料的数量
  108.     成品 = 3                  # 获得物品编号
  109.     成品种类 = 0              # 获得物品种类,0是普通物品,1是防具,2是武器
  110.     成品分类 = 1              # 获得成品分类
  111.     @recipe_list[1] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
  112.    
  113.     ##########################################################################
  114.     # 2 号合成物品设定 (武器铜剑3、铁剑2、钢剑1 = 密切斯特剑) 成品分类:2
  115.     ##########################################################################
  116.     材料 = [1, 2, 3]          # 需要材料的数据库编号
  117.     材料种类 = [2, 2, 2]      # 需要材料的种类,0是普通物品,1是防具,2是武器
  118.     材料数量 = [3, 2, 1]      # 需要材料的数量
  119.     成品 = 4                  # 获得物品编号
  120.     成品种类 = 2              # 获得物品种类,0是普通物品,1是防具,2是武器
  121.     成品分类 = 2              # 获得成品分类
  122.     @recipe_list[2] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
  123.    
  124.     ##########################################################################
  125.     # 3 号合成物品设定 (物品力量之石×2 + 防具钢盾×1 = 密切斯特盾) 成品分类:3
  126.     ##########################################################################
  127.     材料 = [13, 3]            # 需要材料的数据库编号
  128.     材料种类 = [0, 1]         # 需要材料的种类,0是普通物品,1是防具,2是武器
  129.     材料数量 = [2, 1]         # 需要材料的数量
  130.     成品 = 4                  # 获得物品编号
  131.     成品种类 = 1              # 获得物品种类,0是普通物品,1是防具,2是武器
  132.     成品分类 = 3              # 获得成品分类
  133.     @recipe_list[3] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
  134.    
  135.     ##########################################################################
  136.     # 4 号合成物品设定 成品分类:3
  137.     ##########################################################################
  138.     材料 = [1,2,3,4,5,6,7,8,9,10]            # 需要材料的数据库编号
  139.     材料种类 = [0,0,0,0,0,0,0,0,0,0]         # 需要材料的种类,0是普通物品,1是防具,2是武器
  140.     材料数量 = [1,1,1,1,1,1,1,1,1,1]         # 需要材料的数量
  141.     成品 = 28                  # 获得物品编号
  142.     成品种类 = 1              # 获得物品种类,0是普通物品,1是防具,2是武器
  143.     成品分类 = 3              # 获得成品分类
  144.     @recipe_list[4] = Game_Recipe.new(材料,材料种类, 材料数量,成品,成品种类,成品分类)
  145.    
  146.   end # of get_recipe_list method
  147. end # of updates to Game_Temp Class

  148. #================================
  149. # CRAFTING PROGRAM
  150. #----------------------------------------------------------------
  151. #-written by Deke
  152. #-yes_no window code created by Phsylomortis
  153. #----------------------------------------------------------------
  154. #================================

  155. #updates to Game_Party class

  156. class Game_Party
  157.   
  158.   attr_accessor       :recipes
  159.   
  160.   alias crafting_party_initialize initialize
  161.   
  162.   def initialize
  163.     crafting_party_initialize
  164.     @recipes=[]
  165.   end
  166.   
  167.   #----------------------------------------------------------------------
  168.   def know?(recipe, version = 1)
  169.     unless recipe.is_a?(Game_Recipe)
  170.       recipe = get_recipe_from_master_list(recipe, version)
  171.     end
  172.     return $game_party.recipes.include?(recipe)
  173.   end
  174.   
  175. #----------------------------------------------------------------------
  176.   def learn_recipe(recipe , version = 1)
  177.     unless recipe.is_a?(Game_Recipe)
  178.       recipe = get_recipe_from_master_list(recipe, version)
  179.     end
  180.     if recipe.is_a?(Game_Recipe)
  181.       unless know?(recipe)
  182.         @recipes.push(recipe)
  183.       end
  184.     end
  185.   end
  186.   
  187. #----------------------------------------------------------------------
  188.   def forget_recipe(recipe , version = 1)
  189.     if !recipe.is_a?(Game_Recipe)
  190.       recipe = get_recipe_from_master_list(recipe, version)
  191.     end
  192.     if recipe.is_a?(Game_Recipe)
  193.       for i in 0...@recipes.size
  194.         if recipe == @recipes[i]
  195.           index = i
  196.           break
  197.         end
  198.       end
  199.       if index != nil
  200.         @recipes.delete(@recipes[index])
  201.       end
  202.     end
  203.   end
  204.   
  205. #----------------------------------------------------------------------
  206.   def get_recipe_from_master_list(item, version)
  207.     index = nil
  208.     for i in 0...$game_temp.recipe_list.size
  209.       if item[0] == $game_temp.recipe_list[i].result and item[1] ==$game_temp.recipe_list[i].result_type
  210.         version -= 1
  211.         if version == 0
  212.           index = i
  213.           break
  214.         end
  215.       end
  216.     end
  217.     if index.is_a?(Integer)
  218.       return ($game_temp.recipe_list[index])
  219.     else
  220.       return false
  221.     end
  222.   end
  223.   
  224. end # of Game_Party updates

  225. #================================
  226. class Game_Recipe

  227.   attr_reader :ingredients
  228.   attr_reader :quantities
  229.   attr_reader :result
  230.   attr_reader :result_type
  231.   attr_reader :ingredient_types
  232.   attr_reader :craft_type  #物品分类
  233.   
  234. #----------------------------------------------------------------------
  235.   def initialize( ingredients, ingredient_types, quantities, result, result_type, craft_type=0)
  236.     @ingredients = ingredients
  237.     @ingredient_types = ingredient_types
  238.     @quantities = quantities
  239.     @result = result
  240.     @result_type = result_type
  241.     @craft_type = craft_type
  242.   end
  243.   
  244. #----------------------------------------------------------------------
  245.   def name
  246.     case @result_type
  247.       when 0
  248.         name = $data_items[@result].name
  249.       when 1
  250.         name = $data_armors[@result].name
  251.       when 2
  252.         name = $data_weapons[@result].name
  253.     end
  254.     return name
  255.   end
  256.   
  257. #----------------------------------------------------------------------

  258.   def item
  259.     case @result_type
  260.       when 0
  261.         item = $data_items[@result]
  262.       when 1
  263.         item = $data_armors[@result]
  264.       when 2
  265.         item = $data_weapons[@result]
  266.     end
  267.     return item
  268.   end

  269. #----------------------------------------------------------------------
  270.   def have
  271.     have_all = true
  272.     for i in 0...@ingredients.size
  273.       case @ingredient_types[i]
  274.         when 0
  275.           if $game_party.item_number(@ingredients[i]) < @quantities[i]
  276.             have_all=false
  277.           end
  278.         when 1
  279.           if $game_party.armor_number(@ingredients[i]) < @quantities[i]
  280.             have_all=false
  281.           end
  282.         when 2
  283.           if $game_party.weapon_number(@ingredients[i]) < @quantities[i]
  284.             have_all=false
  285.           end
  286.       end
  287.     end
  288.     return have_all
  289.   end

  290. #----------------------------------------------------------------------
  291.   def decrement
  292.     for i in 0...@ingredients.size
  293.       case @ingredient_types[i]
  294.       when 0
  295.         $game_party.lose_item(@ingredients[i], @quantities[i])
  296.       when 1
  297.         $game_party.lose_armor(@ingredients[i], @quantities[i])
  298.       when 2
  299.         $game_party.lose_weapon(@ingredients[i], @quantities[i])
  300.       end
  301.     end
  302.   end

  303. #----------------------------------------------------------------------
  304.   def make
  305.     if have
  306.       case @result_type
  307.       when 0
  308.         $game_party.gain_item(@result, 1)
  309.       when 1
  310.         $game_party.gain_armor(@result, 1)
  311.       when 2
  312.         $game_party.gain_weapon(@result, 1)
  313.       end
  314.       decrement
  315.     end
  316.   end
  317.   
  318. #----------------------------------------------------------------------
  319.   def == (recipe)
  320.     if recipe.is_a?(Game_Recipe)
  321.       equal = true
  322.       if recipe.ingredients != self.ingredients
  323.         equal = false
  324.       end
  325.       if recipe.ingredient_types != self.ingredient_types
  326.         equal = false
  327.       end
  328.       if recipe.quantities != self.quantities
  329.         equal = false
  330.       end
  331.       if recipe.result != self.result
  332.         equal=false
  333.       end
  334.       if recipe.result_type != self.result_type
  335.         equal = false
  336.       end
  337.     else
  338.       equal = false
  339.     end
  340.     return equal
  341.   end
  342.   
  343. end # of Game_Recipe class

  344. #===================================

  345. class Window_Craft < Window_Selectable
  346.   attr_reader :data #声明数据
  347.   #--------------------------------------------------------------------------
  348.   def initialize(craft_type=0)
  349.     @craft_type = craft_type
  350.     super(0, 64, 240, 416)
  351.     @column_max = 1
  352.     refresh
  353.     self.index = 0
  354.   end

  355.   #--------------------------------------------------------------------------
  356.   def recipe
  357.     return @data[self.index]
  358.   end

  359.   #--------------------------------------------------------------------------
  360.   def refresh
  361.     if self.contents != nil
  362.       self.contents.dispose
  363.       self.contents = nil
  364.     end
  365.     @data = []
  366.     for i in 0...$game_party.recipes.size
  367.        #@craft_type为0时就显示全部物品
  368.        #不为0时就显示对应物品
  369.       if @craft_type == 0
  370.         @data.push($game_party.recipes[i])
  371.       elsif $game_party.recipes[i].craft_type == @craft_type
  372.         @data.push($game_party.recipes[i])
  373.       end
  374.     end
  375.     @item_max = @data.size
  376.     if @item_max > 0
  377.       self.contents = Bitmap.new(width - 32, row_max * 32)
  378.       self.contents.font.name = "黑体" # = "黑体"
  379.       self.contents.font.size = 18 # = 18
  380.       for i in 0...@item_max
  381.         x = 16
  382.         y = i * 32
  383.         able = true
  384.         for ingredient in 0...@data[i].ingredients.size
  385.           case @data[i].ingredient_types[ingredient]
  386.           when 0
  387.             count = $game_party.item_number(@data[i].ingredients[ingredient])
  388.           when 1
  389.             count = $game_party.armor_number(@data[i].ingredients[ingredient])
  390.           when 2
  391.             count = $game_party.weapon_number(@data[i].ingredients[ingredient])
  392.           end
  393.           if count < @data[i].quantities[ingredient]
  394.             able = false
  395.             break
  396.           end
  397.         end
  398.         draw_item_name(@data[i].item, x, y, able)
  399.       end
  400.     end
  401.   end

  402.   #--------------------------------------------------------------------------
  403.   #def draw_item(index)
  404.   #  recipe = @data[index]
  405.   #  self.contents.font.color = recipe.have ? normal_color : disabled_color
  406.   #  x = 16
  407.   #  y = index * 32
  408.   #  self.contents.draw_text(x , y, self.width-32, 32, recipe.name, 0)
  409.   #end
  410.   
  411.   #--------------------------------------------------------------------------
  412.   # ● 描绘物品名
  413.   #     item : 物品
  414.   #     x    : 描画目标 X 坐标
  415.   #     y    : 描画目标 Y 坐标
  416.   #--------------------------------------------------------------------------
  417.   def draw_item_name(item, x, y, able = true)
  418.     if item == nil
  419.       return
  420.     end
  421.     if !able
  422.       self.contents.font.color = disabled_color
  423.     end
  424.     bitmap = RPG::Cache.icon(item.icon_name)
  425.     self.contents.blt(x, y + 4, bitmap, Rect.new(0, 0, 24, 24))
  426.     self.contents.draw_text(x + 28, y, 212, 32, item.name)
  427.     self.contents.font.color = normal_color
  428.   end
  429.   
  430.   #--------------------------------------------------------------------------
  431.   def update_help
  432.     current_recipe = recipe
  433.     if current_recipe.is_a?(Game_Recipe)
  434.     case current_recipe.result_type
  435.       when 0
  436.         description = $data_items[current_recipe.result].description
  437.       when 1
  438.         description = $data_armors[current_recipe.result].description
  439.       when 2
  440.         description = $data_weapons[current_recipe.result].description
  441.       end
  442.     else
  443.       description = ""
  444.     end
  445.     @help_window.set_text(description)
  446.     @help_window.update
  447.   end
  448.   
  449. end # of Window_Craft

  450. #=======================================
  451. class Window_CraftResult < Window_Base

  452.   #--------------------------------------------------------------------------
  453.   def initialize
  454.     super(240, 64, 400, 184)
  455.     self.contents = Bitmap.new(width - 32, height - 32)
  456.     self.contents.font.name = "黑体" # = $fontface.is_a?(String) ? $fontface : $defaultfonttype
  457.     self.contents.font.size = 18 # = 20
  458.     @result = nil
  459.     @type = nil
  460.   end

  461.   #--------------------------------------------------------------------------
  462.   def refresh
  463.     self.contents.clear
  464.     case @type
  465.       when 0
  466.         item = $data_items[@result]
  467.         if item.recover_hp_rate > item.recover_hp
  468.           hp_string = "HP回复率:"
  469.           hp_stat = item.recover_hp_rate
  470.         else
  471.           hp_string = "HP回复量:"
  472.           hp_stat = item.recover_hp
  473.         end
  474.         if item.recover_sp_rate > item.recover_sp
  475.           sp_string = "SP回复率:"
  476.           sp_stat = item.recover_sp_rate
  477.         else
  478.           sp_string = "SP回复量:"
  479.           sp_stat = item.recover_sp
  480.         end
  481.         @strings = [hp_string, sp_string, "物理防御:" , "魔法防御:", "命中率:", "分散度:"]
  482.         @stats = [hp_stat, sp_stat, item. pdef_f, item.mdef_f, item.hit, item.variance,
  483.                        $game_party.item_number(@result)]
  484.         @bitmap = RPG::Cache.icon(item.icon_name)
  485.       when 1
  486.         item = $data_armors[@result]
  487.         @strings = ["物理防御:", "魔法防御:", "回避修正:", "力量增加:", "灵巧增加:",
  488.                        "速度增加:", "魔力增加:"]
  489.         @stats = [item.pdef, item.mdef, item.eva, item.str_plus, item.dex_plus,
  490.                     item.agi_plus, item.int_plus, $game_party.armor_number(@result) ]
  491.         @bitmap = RPG::Cache.icon(item.icon_name)
  492.       when 2
  493.         item = $data_weapons[@result]
  494.         @strings =["攻击力:", "物理防御:", "魔法防御:", "力量增加:", "灵巧增加:",
  495.                     "速度增加:", "魔力增加:"]
  496.         @stats = [item.atk, item.pdef, item.mdef, item.str_plus, item.dex_plus,
  497.                     item.agi_plus, item.int_plus, $game_party.weapon_number(@result) ]
  498.         @bitmap = RPG::Cache.icon(item.icon_name)
  499.     end
  500.     for i in 0...@strings.size
  501.       x = i%2 * 184
  502.       y = i /2 *28 +32
  503.       self.contents.font.color = normal_color
  504.       self.contents.draw_text(x,y,100, 28,@strings[i])
  505.       self.contents.font.color = system_color
  506.       self.contents.draw_text(x + 110, y, 45, 28, @stats[i].to_s)
  507.     end
  508.     self.contents.blt(0, 0, @bitmap, Rect.new(0, 0, 24, 24), 255)
  509.     self.contents.font.color= normal_color
  510.     self.contents.draw_text(40, 0, 300, 28, "待合成物品的现有数量:")
  511.     self.contents.font.color = system_color
  512.     count = @stats[@stats.size - 1].to_s
  513.     self.contents.draw_text(294, 0, 45, 28, count )
  514.   end
  515.    
  516. #----------------------------------------------------------------------
  517.   def set_result(result , type)
  518.     @result = result
  519.     @type = type
  520.     refresh
  521.   end

  522. end #of Window_CraftResult

  523. #=======================================
  524. class Window_CraftIngredients < Window_Base

  525.   #--------------------------------------------------------------------------
  526.   def initialize
  527.     super(240, 248, 400, 232)
  528.     self.contents = Bitmap.new(width - 32, height - 32)
  529.     self.contents.font.name = "黑体" # = $fontface.is_a?(String) ? $fontface : $defaultfonttype
  530.     self.contents.font.size = 18 # = 20
  531.     @ingredients = []
  532.     @types = []
  533.     @quantities = []
  534.     @item = nil
  535.     @count = 0
  536.     @counter = 0
  537.     @real_oy = 0
  538.   end

  539.   #--------------------------------------------------------------------------
  540.   def refresh
  541.     @counter = 0
  542.     self.contents.clear
  543.     self.contents = Bitmap.new(width - 32, @ingredients.size * 26)
  544.     for i in 0...@ingredients.size
  545.       case @types[i]
  546.       when 0
  547.         @item = $data_items[@ingredients[i]]
  548.         @count = $game_party.item_number(@ingredients[i])
  549.       when 1
  550.         @item = $data_armors[@ingredients[i]]
  551.         @count = $game_party.armor_number(@ingredients[i])
  552.       when 2
  553.         @item = $data_weapons[@ingredients[i]]
  554.         @count = $game_party.weapon_number(@ingredients[i])
  555.       end
  556.       y = i *26
  557.       self.contents.blt(0, y, RPG::Cache.icon(@item.icon_name), Rect.new(0, 0, 24, 24), 255)
  558.       self.contents.font.color = @count >= @quantities[i] ? normal_color : disabled_color
  559.       self.contents.draw_text(30, y, 280, 28, @item.name)
  560.       self.contents.draw_text(300, y, 45, 28, @quantities[i].to_s)
  561.       self.contents.font.color = system_color
  562.       self.contents.draw_text(245, y, 45, 28, @count.to_s )     
  563.     end
  564.   end
  565.       
  566.   #--------------------------------------------------------------------------
  567.   def set_ingredients(ingredients , types, quantities)
  568.     @ingredients = ingredients
  569.     @types = types
  570.     @quantities = quantities
  571.     refresh
  572.     if @ingredients.size > 7
  573.       self.oy = -52
  574.       @real_oy = 0
  575.     else
  576.       self.oy = 0
  577.     end
  578.   end

  579.   def update
  580.     super
  581.     @counter += 1
  582.     if @ingredients.size > 7 and @counter > 30
  583.       @real_oy = (@real_oy + 1) % ((@ingredients.size - 3) * 26)
  584.       self.oy = @real_oy - 52
  585.     end
  586.   end
  587.    
  588. end # of Window_CraftIngredients

  589. #======================================
  590. class Scene_Craft

  591.   #--------------------------------------------------------------------------
  592.   # @craft_type:物品种类,0就是全部
  593.   def initialize(craft_type=0,craft_index=0)
  594.     @craft_index=craft_index
  595.     @craft_type = craft_type
  596.   end
  597.   
  598.   #--------------------------------------------------------------------------
  599.   def main
  600.     @craft_window = Window_Craft.new(@craft_type)
  601.     @craft_window.index=@craft_index
  602.     @confirm_window = Window_Base.new(120, 188, 400, 64)
  603.     @confirm_window.contents = Bitmap.new(368, 32)
  604.     @confirm_window.contents.font.name = "黑体"
  605.     @confirm_window.contents.font.size = 20
  606.     @help_window = Window_Help.new
  607.     @craft_window.help_window = @help_window
  608.     @result_window=Window_CraftResult.new
  609.     @ingredients_window=Window_CraftIngredients.new
  610.     if @craft_window.data.size > 0 #本类窗口物品大于0的话
  611.       @result_window.set_result(@craft_window.recipe.result, @craft_window.recipe.result_type)
  612.       @ingredients_window.set_ingredients(@craft_window.recipe.ingredients,
  613.                                                           @craft_window.recipe.ingredient_types,
  614.                                                           @craft_window.recipe.quantities)
  615.     end
  616.     @yes_no_window = Window_Command.new(100, ["确定", "放弃"])
  617.     @confirm_window.visible = false
  618.     @confirm_window.z = 1500
  619.     @yes_no_window.visible = false
  620.     @yes_no_window.active = false
  621.     @yes_no_window.index = 1
  622.     @yes_no_window.x = 270
  623.     @yes_no_window.y = 252
  624.     @yes_no_window.z = 1500
  625.     @label_window = Window_Base.new(450,200,190,52)
  626.     @label_window.contents=Bitmap.new(@label_window.width - 32,@label_window.height - 32)
  627.     @label_window.contents.font.size=20
  628.     @label_window.contents.font.color = @label_window.normal_color
  629.     @label_window.contents.font.name = "黑体"
  630.     @label_window.contents.draw_text(0, 0, @label_window.contents.width, 20, "  现有   需要")
  631.     Graphics.transition
  632.     loop do
  633.       Graphics.update
  634.       Input.update
  635.       update
  636.       if $scene != self
  637.         break
  638.       end
  639.     end
  640.     Graphics.freeze
  641.     @help_window.dispose
  642.     @craft_window.dispose
  643.     @result_window.dispose
  644.     @ingredients_window.dispose
  645.     @confirm_window.dispose
  646.     @yes_no_window.dispose
  647.     @label_window.dispose
  648.   end

  649.   #--------------------------------------------------------------------------
  650.   def update
  651.     @craft_window.update
  652.     @ingredients_window.update
  653.     if @craft_window.active
  654.       update_craft
  655.       return
  656.     end
  657.     if @yes_no_window.active
  658.       confirm_update
  659.       return
  660.     end
  661.   end

  662.   #--------------------------------------------------------------------------
  663.   def update_craft
  664.     if Input.dir4 != 0
  665.       if @craft_window.data.size > 0 #本类窗口物品大于0的话
  666.         @result_window.set_result(@craft_window.recipe.result, @craft_window.recipe.result_type)
  667.         @ingredients_window.set_ingredients(@craft_window.recipe.ingredients,
  668.                                                            @craft_window.recipe.ingredient_types,
  669.                                                            @craft_window.recipe.quantities)
  670.       end
  671.     end
  672.     if Input.trigger?(Input::B)
  673.       $game_system.se_play($data_system.cancel_se)
  674.       $scene = Scene_Map.new
  675.       return
  676.     end
  677.     if Input.trigger?(Input::C) and $game_party.recipes.size != 0
  678.       @recipe = @craft_window.recipe
  679.       if @recipe != nil
  680.         if @recipe.have
  681.           @yes_no_window.active = true
  682.           @craft_window.active = false
  683.         else
  684.           $game_system.se_play($data_system.buzzer_se)
  685.           return
  686.         end
  687.       else
  688.         $game_system.se_play($data_system.buzzer_se)
  689.         return
  690.       end
  691.     end
  692.   end

  693.   #--------------------------------------------------------------------------
  694.   def confirm_update
  695.     @craft_index = @craft_window.index
  696.     @confirm_window.visible = true
  697.     @confirm_window.z = 1500
  698.     @yes_no_window.visible = true
  699.     @yes_no_window.active = true
  700.     @yes_no_window.z = 1500
  701.     @yes_no_window.update
  702.     string = "合成 " + @recipe.name + "?"
  703.     cw = @confirm_window.contents.text_size(string).width
  704.     center = @confirm_window.contents.width/2 - cw /2
  705.     unless @drawn
  706.       @confirm_window.contents.draw_text(center, 0, cw, 30, string)
  707.       @drawn = true
  708.     end
  709.     if Input.trigger?(Input::C)
  710.       if @yes_no_window.index == 0
  711.         $game_system.se_play($data_system.decision_se)
  712.         @recipe.make
  713.         $game_system.se_play($data_system.save_se)
  714.         $scene=Scene_Craft.new(@craft_type,@craft_index)
  715.       else
  716.         $game_system.se_play($data_system.cancel_se)
  717.         $scene=Scene_Craft.new(@craft_type,@craft_index)
  718.       end
  719.     end
  720.     if Input.trigger?(Input::B)
  721.       $game_system.se_play($data_system.cancel_se)
  722.       $scene=Scene_Craft.new(@craft_type,@craft_index)
  723.     end
  724.   end

  725. end # of Scene_Craft

  726. #==============================================================================
  727. # 本脚本来自www.66RPG.com,使用和转载请保留此信息
  728. # 欢迎访问www.66RPG.com
  729. # 梦想世界,在你手中
  730. #==============================================================================
复制代码
用这个看看吧,这个应该可以了
脚本说明在28-90行
如果添加物品合成的种类,就可以仿照102-144行
应该不麻烦把

点评

囧.我就是不会改Scene_Menu的菜单,不知道【add_command("制作", --> :这里不知填什么<-- 】  发表于 2013-8-29 12:16
对了,你如果要在菜单栏中打开的话,你要在Scene_Menu里面修改了  发表于 2013-8-29 09:22

点击签名档去一个神奇的地方
回复

使用道具 举报

梦石
1
星屑
7574
在线时间
2650 小时
注册时间
2013-8-23
回帖
2152

开拓者

 楼主| 发表于 2013-8-29 13:38:40 | 显示全部楼层
本帖最后由 鑫晴 于 2013-8-29 13:46 编辑
76213585 发表于 2013-8-29 04:54
試試白魔的
#==============================================================================
# ■ RGSS ...


          可以弹出制作页面了,可是功能却用不了。也许是我设置的问题。

                    


            当我打开全部开关也就是 recipe_all_switch_on 的时候,弹出这么一个错误:


4.png





                     也就是这句:if @Money >= recipe[0]






                     当我打开个别的开关也就是   ( w/a ) i_recipe_switch_on(n)  n=1 / n=0的时候 .

                                               

                                                     也是弹出上面那个错误。


↓.....这是加工厂....↓


6.png









         没打开开关的时候......





2.png




5.png


     



           什么都没有.....(这必须没有.....)




                    也不能切换到【装备】、【防具】的页面,只有一个【道具】、






   
                   是我设置有问题吗?



                                  事件脚本设置:


8.png



9.png







10.png
回复

使用道具 举报

梦石
0
星屑
407
在线时间
1291 小时
注册时间
2013-1-12
回帖
3349

贵宾

发表于 2013-8-30 02:30:55 | 显示全部楼层
鑫晴 发表于 2013-8-28 22:38
可以弹出制作页面了,可是功能却用不了。也许是我设置的问题。

                    

我自己改成只有道句的....  對不起......
我直接從我遊戲拿过來的  給你个原碼....

  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 = true #カテゴリウィンドウに「大事なもの」の項目を表示
  25.   
  26.   I_recipe = [] #この行は削除しないこと
  27.   W_recipe = [] #この行は削除しないこと
  28.   A_recipe = [] #この行は削除しないこと
  29.   
  30.   #以下、合成レシピ。
  31.   #例: I_recipe[3]  = [100, ["I",1,1], ["W",2,1], ["A",2,2], ["A",3,1]]
  32.   #と記載した場合、ID3のアイテムの合成必要は、100G。
  33.   #必要な素材は、ID1のアイテム1個、ID2の武器1個、ID2の防具2個、ID3の防具1個
  34.   #となる。
  35.   #-------------------------------------------------------------------------------------
  36.   #アイテムの合成レシピ
  37.   I_recipe[9]  = [0,  ["I",5,1], ["I",43,3]]

  38.   #武器の合成レシピ
  39.   W_recipe[1]  = [50,  ["I",10,5]]
  40.   
  41.   #-------------------------------------------------------------------------------------
  42.   #防具の合成レシピ  
  43.   A_recipe[1]  = [50,   ["I",10,6]]
  44. end


  45. #==============================================================================
  46. # ■ WD_itemsynthesis
  47. #------------------------------------------------------------------------------
  48. #  アイテム合成用の共通メソッドです。
  49. #==============================================================================

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

  136. end

  137. class Game_Interpreter
  138.   include WD_itemsynthesis
  139. end

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


  158. #==============================================================================
  159. # ■ Scene_ItemSynthesis
  160. #------------------------------------------------------------------------------
  161. #  合成画面の処理を行うクラスです。
  162. #==============================================================================

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

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


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

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


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

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


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

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


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

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


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

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

点评

谢谢!  发表于 2013-8-30 07:07

评分

参与人数 1星屑 +200 收起 理由
taroxd + 200 认可答案

查看全部评分


回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部