TheoAllen

Theo - Crafting v1.1c

Mar 30th, 2014
267
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 21.22 KB | None | 0 0
  1. # =============================================================================
  2. # TheoAllen - (Fallout Like) Crafting System
  3. # Version : 1.1c
  4. # Contact : www.rpgmakerid.com (or) http://theolized.blogspot.com
  5. # (This script documentation is written in informal indonesian language)
  6. # =============================================================================
  7. ($imported ||= {})[:Theo_Crafting] = true
  8. # =============================================================================
  9. # Change Logs:
  10. # -----------------------------------------------------------------------------
  11. # 2014.03.30 - Bugfix crashed when selected empty craft menu
  12. # 2013.08.25 - Bugfix disable req text isn't working
  13. # 2013.08.22 - Bugfix at amount of item crafting
  14. #            - Added show condition
  15. #            - Added custom name
  16. # 2013.08.20 - Finished script
  17. # 2013.08.19 - Started script
  18. # =============================================================================
  19. =begin
  20.  
  21.   ---------------------------------------------------------------------------
  22.   Perkenalan :
  23.   Script ini ngebikin kamu bisa bikin item berdasar resep dan bahannya
  24.  
  25.   ---------------------------------------------------------------------------
  26.   Cara penggunaan :
  27.   ---------------------------------------------------------------------------
  28.   Pasang script ini dibawah material namun diatas main
  29.   Untuk script call ke menu craftingnya, kamu bisa gunain kek gini :
  30.  
  31.   enter_crafting
  32.  
  33.   ---------------------------------------------------------------------------
  34.   Notetags (UntukItems/Armors/Weapons):
  35.   ---------------------------------------------------------------------------
  36.   -----------------------------------
  37.   Level : Easy
  38.   -----------------------------------
  39.   <add item recipe: id,jumlah>
  40.   <add armor recipe: id,jumlah>
  41.   <add weapon recipe: id,jumlah>
  42.   ^
  43.   Notetag untuk menentukan resep dari sebuah item/armor/weapon. Dimana id
  44.   adalah id resep itu di database. Dan jumlah adalah jumlah minimal yang harus
  45.   dimiliki player
  46.  
  47.   <craft name: text>
  48.   ^
  49.   Notetag ini untuk mengganti nama item sementara. Semisal dalam list, potion
  50.   akan ditulis dengan "Craft Potions". Namun setelah jadi itemnya akan jadi
  51.   potion
  52.  
  53.   -----------------------------------
  54.   Level : Medium - Hard
  55.   (kalo ga paham ga usah coba2 make)
  56.   -----------------------------------
  57.   <craft require>
  58.   script
  59.   </craft require>
  60.   ^
  61.   Notetag ini untuk menentukan apakah item tersebut bisa dibikin ato ngga
  62.   ditentukan berdasar script. Jika kamu make banyak baris, semuanya akan
  63.   diitung sebagai satu baris. Untuk instruksi script call yg bisa dipake gw
  64.   tulis terpisah.
  65.  
  66.   Kesalahan penulisan bisa nyebab'in error. Jadi kalo semisal kamu pengen ngasi
  67.   requirement tertentu, mending langsung tanya gw aja ato scripter laen.
  68.  
  69.   <craft req text>
  70.   some text here
  71.   </craft req text>
  72.   ^
  73.   Notetag ini untuk representasi dari script call diatas. Misalnya kamu tulis
  74.   requirement item untuk crafting itu butuh silver hammer, kamu bisa tulis
  75.   kek gini :
  76.  
  77.   <craft req text>
  78.   This items need a silver hammer
  79.   to make
  80.   </craft req text>
  81.  
  82.   <craft show eval>
  83.   script
  84.   </craft show eval>
  85.   ^
  86.   Notetag ini untuk keperluan apakah item tersebut masuk dalam list ato ngga.
  87.   Semisal, sebelum kamu bisa crafting elixir, kamu harus belajar ngeramu dulu.
  88.   Setelah selese belajar, kamu akhirnya bisa crafting elixir.
  89.  
  90.   ---------------------------------------------------------------------------
  91.   Terms of Use :
  92.   ---------------------------------------------------------------------------
  93.   Credit gw, TheoAllen. Kalo semisal u bisa ngedit2 script gw trus jadi lebih
  94.   keren, terserah. Ane bebasin. Asal ngga ngeklaim aja. Kalo semisal mau
  95.   dipake buat komersil, jangan lupa, gw dibagi gratisannya.  
  96.  
  97. =end
  98. # =============================================================================
  99. # Konfigurasi :
  100. # =============================================================================
  101. module THEO
  102.   module Craft
  103.  
  104.   # --------------------------------------------------------------------------
  105.   # Settingan umum
  106.   # --------------------------------------------------------------------------
  107.     MainMenu        = true
  108.   # Set true kalo kamu pengen dalam main menu bisa akses crafting
  109.  
  110.     DisplayReqText  = true
  111.   # Set false kalo kamu pengen ngilangin tulisan requirement sbelum resep
  112.   # di window status sebelah kanan
  113.  
  114.   # --------------------------------------------------------------------------
  115.   # Settingan vokab
  116.   # --------------------------------------------------------------------------
  117.     VocabMenu      = "Craft"          # Command buat main menu (kalo kamu make)
  118.     VocabNoReq     = "- None -"       # Kalo ngga ada requirement khusus
  119.     VocabRequire   = "Requirement :"  # Vokab requirement
  120.     VocabRecipes   = "Recipes : "     # Vokab resep
  121.     VocabInventory = "Inventory: "    # Vokab buat inventory
  122.    
  123.   # --------------------------------------------------------------------------
  124.   # Lainnya
  125.   # --------------------------------------------------------------------------
  126.     Text_Buffer_x = 12
  127.   # Jarak tambahan text dari samping kiri
  128.  
  129.     AmountSize = 250
  130.   # Lebar window amount
  131.  
  132.   end
  133. end
  134. # =============================================================================
  135. # Akhir dari konfig :
  136. # =============================================================================
  137. module THEO
  138.   module Craft
  139.     def self.items
  140.       items = $data_items + $data_armors + $data_weapons
  141.       items.compact!
  142.       items.select {|item| item.can_be_crafted? }
  143.     end
  144.   end
  145. end
  146. # =============================================================================
  147. # ▼ RPG::BaseItem
  148. # =============================================================================
  149. class RPG::BaseItem
  150.   attr_accessor :item_recipes
  151.   attr_accessor :armor_recipes
  152.   attr_accessor :weapon_recipes
  153.   attr_accessor :enable_cond
  154.   attr_accessor :enable_text
  155.   attr_accessor :show_cond
  156.   attr_accessor :craft_name
  157.   attr_accessor :craft_key  # For future planned feature
  158.  
  159.   def load_recipes
  160.     @item_recipes = {}
  161.     @armor_recipes = {}
  162.     @weapon_recipes = {}
  163.     @show_cond = @enable_cond = "true"
  164.     @enable_text = []
  165.     @craft_name = ""
  166.     @craft_key = ""
  167.     read_craft_cond = read_craft_txt = read_craft_show = false
  168.     self.note.split(/[\r\n]+/).each do |line|
  169.       case line
  170.       when /<(?:ADD_ITEM_RECIPE|add item recipe): (.*)>/i
  171.         str = $1.scan(/\d+/)
  172.         @item_recipes[str[0].to_i] = str[1].to_i
  173.       when /<(?:ADD_ARMOR_RECIPE|add armor recipe): (.*)>/i
  174.         str = $1.scan(/\d+/)
  175.         @armor_recipes[str[0].to_i] = str[1].to_i
  176.       when /<(?:ADD_WEAPON_RECIPE|add WEAPON recipe): (.*)>/i
  177.         str = $1.scan(/\d+/)
  178.         @weapon_recipes[str[0].to_i] = str[1].to_i
  179.       when /<(?:CRAFT_REQUIRE|craft require)>/i
  180.         read_craft_cond = true
  181.         @enable_cond = ""
  182.       when /<\/(?:CRAFT_REQUIRE|craft require)>/i
  183.         read_craft_cond = false
  184.       when /<(?:CRAFT_REQ_TEXT|craft req text)>/i
  185.         read_craft_txt = true
  186.       when /<\/(?:CRAFT_REQ_TEXT|craft req text)>/i
  187.         read_craft_txt = false
  188.       when /<(?:CRAFT_SHOW_EVAL|craft show eval)>/i
  189.         read_craft_show = true
  190.         @show_cond = ""
  191.       when /<\/(?:CRAFT_SHOW_EVAL|craft show eval)>/i
  192.         read_craft_show = false
  193.       when /<(?:CRAFT_NAME|craft name): (.*)>/i
  194.         @craft_name = $1.to_s
  195.       when /<(?:CRAFT_KEY|craft key): [ ]*(.*)>/i
  196.         @craft_key = $1.to_s
  197.       else
  198.         if read_craft_cond
  199.           @enable_cond += line
  200.         end
  201.         if read_craft_txt
  202.           @enable_text.push(line)
  203.         end
  204.         if read_craft_show
  205.           @show_cond += line
  206.         end
  207.       end
  208.     end
  209.   end
  210.  
  211.   def recipes
  212.     [@item_recipes, @armor_recipes, @weapon_recipes]
  213.   end
  214.  
  215.   # ---------------------------------------------------------------------------
  216.   # If the error is directed you to this line. It's possible that you wrote
  217.   # craft requirement formula in a wrong way. Not this script mistake
  218.   # ---------------------------------------------------------------------------
  219.   def craft_possible?
  220.     return eval(@enable_cond) && can_be_crafted?
  221.   end
  222.  
  223.   def show_possible?
  224.     return eval(@show_cond)
  225.   end
  226.   # ---------------------------------------------------------------------------
  227.   # Determine if item can be crafted
  228.   # ---------------------------------------------------------------------------
  229.   def can_be_crafted?
  230.     recipes.any? {|recipe| !recipe.empty?} && show_possible?
  231.   end
  232.  
  233. end
  234. # =============================================================================
  235. # ▼ DataManager
  236. # =============================================================================
  237. class << DataManager
  238.  
  239.   alias theo_recipe_craft_load_db load_database
  240.   def load_database
  241.     theo_recipe_craft_load_db
  242.     load_item_recipes
  243.   end
  244.  
  245.   def load_item_recipes
  246.     ($data_items+$data_armors+$data_weapons).compact.each do |db|
  247.       db.load_recipes
  248.     end
  249.   end
  250.  
  251. end
  252. # =============================================================================
  253. # ▼ Window_CraftList
  254. # =============================================================================
  255. class Window_CraftList < Window_ItemList
  256.  
  257.   def initialize(x,y,w,h,key)
  258.     @key = key
  259.     super(x,y,w,h)
  260.     refresh
  261.   end
  262.  
  263.   def col_max
  264.     return 1
  265.   end
  266.  
  267.   def status_window=(window)
  268.     @status_window = window
  269.     update_help
  270.   end
  271.  
  272.   def item_number_window=(window)
  273.     @inum_window = window
  274.     update_help
  275.   end
  276.  
  277.   def update_help
  278.     super
  279.     @status_window.set_item(item) if @status_window
  280.     @inum_window.set_item(item) if @inum_window
  281.   end
  282.  
  283.   def make_item_list
  284.     @data = []
  285.     items = THEO::Craft.items
  286.     items.each do |item|
  287.       @data.push(item) if @key.empty? || item.craft_key == @key
  288.     end
  289.   end
  290.  
  291.   def enable?(item)
  292.     item && item.craft_possible? && has_recipes?(item) && has_free_slot?(item)
  293.   end
  294.  
  295.   def has_free_slot?(item)
  296.     $game_party.item_number(item) < $game_party.max_item_number(item)
  297.   end
  298.  
  299.   def has_recipes?(item)
  300.     result1 = check_recipe(item.recipes[0], $data_items)
  301.     result2 = check_recipe(item.recipes[1], $data_armors)
  302.     result3 = check_recipe(item.recipes[2], $data_weapons)
  303.     return result1 && result2 && result3
  304.   end
  305.  
  306.   def check_recipe(recipes, data)
  307.     return true if recipes.empty?
  308.     return recipes.all? {|recipe|
  309.       $game_party.item_number(data[recipe[0]]) >= recipe[1]}
  310.   end
  311.  
  312.   def draw_item_name(item, x, y, enabled = true, width = 172)
  313.     return unless item
  314.     draw_icon(item.icon_index, x, y, enabled)
  315.     change_color(normal_color, enabled)
  316.     name = item.craft_name.empty? ? item.name : item.craft_name
  317.     draw_text(x + 24, y, width, line_height, name)
  318.   end
  319.  
  320.   def draw_item_number(rect, item)
  321.     return unless $imported[:Theo_LimInventory]
  322.     return unless THEO::LimInv::Display_ItemSize
  323.     draw_text(rect, sprintf(":%2d", item.inv_size), 2)
  324.   end
  325.  
  326. end
  327. # =============================================================================
  328. # ▼ Window_CraftStatus
  329. # =============================================================================
  330. class Window_CraftStatus < Window_Base
  331.  
  332.   def set_item(item)
  333.     @item = item
  334.     refresh
  335.   end
  336.  
  337.   def refresh
  338.     contents.clear
  339.     return unless @item
  340.     @line_count = 0
  341.     draw_requirement
  342.     draw_recipes
  343.   end
  344.  
  345.   def draw_requirement
  346.     return unless THEO::Craft::DisplayReqText
  347.     change_color(system_color)
  348.     draw_text(line_rect(4),THEO::Craft::VocabRequire)
  349.     increase_line_count
  350.     if !@item.enable_text.empty?
  351.       change_color(normal_color, @item.craft_possible?)
  352.       @item.enable_text.each do |text|
  353.         draw_text(line_rect(buff_x),text)
  354.         increase_line_count
  355.       end
  356.       increase_line_count
  357.     else
  358.       change_color(normal_color)
  359.       draw_text(line_rect(buff_x),THEO::Craft::VocabNoReq)
  360.       2.times { increase_line_count }
  361.     end
  362.   end
  363.  
  364.   def draw_recipes
  365.     change_color(system_color)
  366.     draw_text(line_rect(4),THEO::Craft::VocabRecipes)
  367.     change_color(normal_color)
  368.     increase_line_count
  369.     draw_recipe(@item.recipes[0], $data_items)
  370.     draw_recipe(@item.recipes[1], $data_armors)
  371.     draw_recipe(@item.recipes[2], $data_weapons)
  372.   end
  373.  
  374.   def draw_recipe(hash, items)
  375.     hash.each do |id,amount|
  376.       item_num = $game_party.item_number(items[id])
  377.       enable = item_num >= amount
  378.       change_color(normal_color, enable)
  379.       rect = line_rect(buff_x + 24)
  380.       text = sprintf("%s (%d/%d)",items[id].name, item_num, amount)
  381.       draw_text(rect, text)
  382.       draw_icon(items[id].icon_index, buff_x, @line_count, enable)
  383.       increase_line_count
  384.     end
  385.   end  
  386.  
  387.   def line_rect(xpos = 0)
  388.     Rect.new(xpos,@line_count,contents.width-xpos,line_height)
  389.   end
  390.  
  391.   def increase_line_count
  392.     @line_count += line_height
  393.   end
  394.  
  395.   def buff_x
  396.     THEO::Craft::Text_Buffer_x
  397.   end
  398.  
  399. end
  400. # =============================================================================
  401. # ▼ Window_CraftAmount
  402. # =============================================================================
  403. class Window_CraftAmount < Window_Base
  404.   attr_accessor :inv_window
  405.   attr_accessor :ok_handler
  406.   attr_accessor :cancel_handler
  407.   attr_reader :amount
  408.  
  409.   def initialize
  410.     super(0,0,window_width,fitting_height(1))
  411.     self.openness = 0
  412.     to_center
  413.     @amount = 0
  414.     @max = 0
  415.     @item = nil
  416.   end
  417.  
  418.   def window_width
  419.     return THEO::Craft::AmountSize
  420.   end
  421.  
  422.   def to_center
  423.     self.x = (Graphics.width - width)/2
  424.     self.y = (Graphics.height - height)/2
  425.   end
  426.  
  427.   def set(item, max)
  428.     change_amount(0,true)
  429.     @item = item
  430.     @max = max
  431.     open
  432.     refresh
  433.   end
  434.  
  435.   def refresh
  436.     contents.clear
  437.     return unless @item
  438.     draw_item_name(@item,0,0,true,contents.width)
  439.     draw_amount
  440.   end
  441.  
  442.   def draw_amount
  443.     text = sprintf("%d/%d",@amount,@max)
  444.     draw_text(0,0,contents.width,line_height,text,2)
  445.   end
  446.  
  447.   def update
  448.     super
  449.     if open?
  450.       change_amount(1) if Input.repeat?(:RIGHT)
  451.       change_amount(-1) if Input.repeat?(:LEFT)
  452.       change_amount(10) if Input.repeat?(:UP)
  453.       change_amount(-10) if Input.repeat?(:DOWN)
  454.       call_ok if Input.trigger?(:C)
  455.       call_cancel if Input.trigger?(:B)
  456.     end
  457.   end
  458.  
  459.   def change_amount(number, instant = false)
  460.     if instant
  461.       @amount = number
  462.     else
  463.       Sound.play_cursor
  464.       @amount = [[@amount + number,0].max,@max].min
  465.     end
  466.     refresh
  467.     @inv_window.amount = @amount if @inv_window
  468.   end
  469.  
  470.   def call_ok
  471.     Sound.play_ok
  472.     ok_handler.call
  473.     change_amount(0,true)
  474.     close
  475.   end
  476.  
  477.   def call_cancel
  478.     Sound.play_cancel
  479.     cancel_handler.call
  480.     change_amount(0,true)
  481.     close
  482.   end
  483.  
  484. end
  485. # =============================================================================
  486. # ▼ Window_CraftFooter
  487. # =============================================================================
  488. class Window_CraftFooter < Window_Base
  489.  
  490.   def initialize
  491.     super(0,0,Graphics.width,fitting_height(1))
  492.     self.y = Graphics.height - height
  493.     @amount = 0
  494.     @item = nil
  495.     refresh
  496.   end
  497.  
  498.   def amount=(amount)
  499.     @amount = amount
  500.     refresh
  501.   end
  502.  
  503.   def refresh
  504.     contents.clear
  505.     change_color(system_color)
  506.     draw_text(0,0,contents.width,line_height,THEO::Craft::VocabInventory)
  507.     change_color(normal_color)
  508.     return unless @item
  509.     if $imported[:Theo_LimInventory]
  510.       draw_inv_slot(0,0)
  511.     else
  512.       draw_item_number
  513.     end
  514.   end
  515.  
  516.   def draw_inv_slot(x,y,width = contents.width,align = 2)
  517.     total = $game_party.total_inv_size + @amount*@item.inv_size
  518.     total -= calculate_lose_item
  519.     txt = sprintf("%d/%d", total, $game_party.inv_max)
  520.     color = THEO::LimInv::NearMaxed_Color
  521.     near_max = total.to_f/$game_party.inv_max >=
  522.       (100 - THEO::LimInv::NearMaxed_Percent).to_f / 100
  523.     if near_max
  524.       change_color(text_color(color))
  525.     else
  526.       change_color(normal_color)
  527.     end
  528.     draw_text(x,y,width,line_height,txt,align)
  529.     change_color(normal_color)
  530.   end
  531.  
  532.   def draw_item_number
  533.     txt = sprintf("%d/%d",@amount + $game_party.item_number(@item),
  534.       $game_party.max_item_number(@item))
  535.     draw_text(0,0,contents.width,line_height,txt,2)
  536.   end
  537.  
  538.   def set_item(item)
  539.     @item = item
  540.     refresh
  541.   end
  542.  
  543.   def calculate_lose_item
  544.     result = 0
  545.     @item.recipes[0].each do |id,amount|
  546.       data = $data_items[id]
  547.       amount *= @amount
  548.       result += amount
  549.     end
  550.     @item.recipes[1].each do |id,amount|
  551.       data = $data_armors[id]
  552.       amount *= @amount
  553.       result += amount
  554.     end
  555.     @item.recipes[2].each do |id,amount|
  556.       data = $data_weapons[id]
  557.       amount *= @amount
  558.       result += amount
  559.     end
  560.     return result
  561.   end
  562.  
  563. end
  564. # =============================================================================
  565. # ▼ Game_Interpreter
  566. # =============================================================================
  567. class Game_Interpreter
  568.  
  569.   # ----------------------------------------------
  570.   # key is just for my future planned feature
  571.   # ----------------------------------------------
  572.   def enter_crafting(key = "")
  573.     SceneManager.call(Scene_ItemCrafting)
  574.     SceneManager.scene.prepare(key)
  575.     Fiber.yield
  576.   end
  577.  
  578. end
  579. # =============================================================================
  580. # ▼ Window_MenuCommand
  581. # =============================================================================
  582. class Window_MenuCommand < Window_Command
  583.  
  584.   alias theo_craft_ori_cmd add_original_commands
  585.   def add_original_commands
  586.     theo_craft_ori_cmd
  587.     return unless THEO::Craft::MainMenu
  588.     add_command(THEO::Craft::VocabMenu, :craft)
  589.   end
  590.  
  591. end
  592. # =============================================================================
  593. # ▼ Scene_Menu
  594. # =============================================================================
  595. class Scene_Menu < Scene_MenuBase
  596.  
  597.   alias theo_craft_cmnd_window create_command_window
  598.   def create_command_window
  599.     theo_craft_cmnd_window
  600.     @command_window.set_handler(:craft, method(:enter_crafting))
  601.   end
  602.  
  603.   def enter_crafting
  604.     SceneManager.call(Scene_ItemCrafting)
  605.     SceneManager.scene.prepare("")
  606.   end
  607.  
  608. end
  609. # =============================================================================
  610. # ▼ Scene_ItemCrafting
  611. # =============================================================================
  612. class Scene_ItemCrafting < Scene_MenuBase
  613.  
  614.   def prepare(key)
  615.     @key = key
  616.   end
  617.  
  618.   def start
  619.     super
  620.     create_help_window
  621.     create_craftfooter_window
  622.     create_craftlist_window
  623.     create_craftstatus_window
  624.     create_craftamount_window
  625.   end
  626.  
  627.   def create_craftfooter_window
  628.     @craft_footer = Window_CraftFooter.new
  629.   end
  630.  
  631.   def create_craftlist_window
  632.     wy = @help_window.height
  633.     ww = Graphics.width/2
  634.     wh = Graphics.height - wy - @craft_footer.height
  635.     @craft_list = Window_CraftList.new(0,wy,ww,wh,@key)
  636.     @craft_list.set_handler(:ok, method(:on_craft_ok))
  637.     @craft_list.set_handler(:cancel, method(:return_scene))
  638.     @craft_list.help_window = @help_window
  639.     @craft_list.item_number_window = @craft_footer
  640.     @craft_list.activate
  641.     @craft_list.select(0)
  642.   end
  643.  
  644.   def create_craftstatus_window
  645.     wx = @craft_list.width
  646.     wy = @craft_list.y
  647.     ww = @craft_list.width
  648.     wh = @craft_list.height
  649.     @craft_status = Window_CraftStatus.new(wx,wy,ww,wh)
  650.     @craft_list.status_window = @craft_status
  651.   end
  652.  
  653.   def create_craftamount_window
  654.     @craft_amount = Window_CraftAmount.new
  655.     @craft_amount.ok_handler = method(:on_amount_ok)
  656.     @craft_amount.cancel_handler = method(:on_amount_cancel)
  657.     @craft_amount.inv_window = @craft_footer
  658.   end
  659.  
  660.   def on_craft_ok
  661.     @craft_amount.set(item, item_max)
  662.   end
  663.  
  664.   def on_amount_ok
  665.     $game_party.gain_item(item, @craft_amount.amount)
  666.     lose_recipes
  667.     @craft_status.refresh
  668.     @craft_list.refresh
  669.     @craft_list.activate
  670.   end
  671.  
  672.   def on_amount_cancel
  673.     @craft_list.activate
  674.   end
  675.  
  676.   def item
  677.     @craft_list.item
  678.   end
  679.  
  680.   def item_max
  681.     ary = []
  682.     item.recipes[0].each do |id,amount|
  683.       data = $data_items[id]
  684.       ary.push($game_party.item_number(data)/amount)
  685.     end
  686.     item.recipes[1].each do |id,amount|
  687.       data = $data_armors[id]
  688.       ary.push($game_party.item_number(data)/amount)
  689.     end
  690.     item.recipes[2].each do |id,amount|
  691.       data = $data_weapons[id]
  692.       ary.push($game_party.item_number(data)/amount)
  693.     end
  694.     max_item = $game_party.max_item_number(item)
  695.     inum = $game_party.item_number(item)
  696.     return [ary.min , max_item - inum].min
  697.   end
  698.  
  699.   def lose_recipes
  700.     item.recipes[0].each do |id,amount|
  701.       data = $data_items[id]
  702.       amount *= @craft_amount.amount
  703.       $game_party.lose_item(data,amount)
  704.     end
  705.     item.recipes[1].each do |id,amount|
  706.       data = $data_armors[id]
  707.       amount *= @craft_amount.amount
  708.       $game_party.lose_item(data,amount)
  709.     end
  710.     item.recipes[2].each do |id,amount|
  711.       data = $data_weapons[id]
  712.       amount *= @craft_amount.amount
  713.       $game_party.lose_item(data,amount)
  714.     end
  715.   end
  716.  
  717. end
Advertisement
Add Comment
Please, Sign In to add comment