Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================#
- # #*********************************# #
- # #*** By RPG MAKER VN Vs Falcao ***# *Trang RPG Maker Vn #
- # #*********************************# Thank You Falcao #
- # Hệ Thống Chế Tạo Đồ Vật Và Vật Phẩm #
- # RMVXACE Script Này Được Dùng Free. Ngày : 7/20/2017 #
- # #
- # Falcao RGSS site: http://falcaorgss.wordpress.com #
- # RPG Maker VN site: https://rpgmakervn.blogspot.com #
- #==============================================================================#
- #-------------------------------------------------------------------------------
- # Cách Sử Dụng ?
- #
- # - Một Vài Hướng Dẫn Bên Dưới Hoặc Bạn Vào Blogger Để Coi Bài Hướng Dẫn
- # Cái Này Ko dành cho người tập mới vào.
- # - Hãy Like Và Share Trang Mình Nhé
- # Thank You .
- #
- # It is called Crafting
- #-------------------------------------------------------------------------------
- #-------------------------------------------------------------------------------
- # * Cập Nhật Có Gì Mới
- #
- # - Hệ thống kỹ năng Đầy đủ
- # - Hệ thống kỹ năng khai thác
- # - Sự kỳ diệu và khai thác Hệ thống san lấp mặt bằng
- # - Hệ thống giải thuật giả kim và chiết xuất toàn bộ
- # - Hệ Thống có thể tạo Weapons, Armors and Items
- # - Trong game tối đa hóa phép thuật và mức độ khai thác được kích hoạt
- # - Alchemy Hỗ trợ tối đa 20 thành phần
- # - Sự kỳ diệu và trích xuất, tốc độ, số lượng, cơ hội được kích hoạt
- # - Có Chức Năng công thức nấu ăn
- # - Cấp nhà máy trích xuất được kích hoạt
- # - Khôi phục cây cối được kích hoạt
- # - Bàn Chế Tạo
- # - Sáng tạo công thức linh hoạt và dễ dàng
- # - Dễ dàng sử dụng
- #-------------------------------------------------------------------------------
- # * Điều Khoản Và giấy phép
- # - Nhớ credit Falcao và credit RPG MAKER VN
- # - Bạn Có Thể sửa bất cứ thứ j bạn mún
- # - Bạn Được Chia sẻ
- # - Không loại bỏ tiêu đề của bất kỳ tập lệnh kịch bản nào
- # - Bạn được tự do sử dụng tập lệnh này trong các dự án phi thương mại,
- # cho mục đích thương mại
- # Gmail Liên Hệ : Khanhsunguj@gmail hoặc Falcao : falmc99@gmail.com
- =begin
- ===============================================================================
- * Script Manual
- *************************
- * Alchemy skill set up *
- Use the following script call to display the alchemy GUI
- SceneManager.call(Scene_Alchemy)
- You will see an empty GUI, the first thing you have to do is create a recipe
- in the database item section using the following notetags
- - Here a normal recipe set up
- <Output Item Type: Item>
- <Output Item Id: 2>
- <Output Item Chance: 50>
- <Output Item Quantity: 2>
- <Recipe Speed: 1.5>
- <Recipe Level: 1>
- <Recipe Item Mixs: 17, 18, 19>
- <Recipe Item Cost: 3, 2, 2>
- - Tags explanation
- <Output Item Type: Item>
- recipe output item type, it can be Item, Weapon or Armor
- <Output Item Id: 2>
- Item Type id you choose
- <Output Item Chance: 50>
- Chance to produce the item, it can be a number form 1 to 100 percent of chance
- <Output Item Quantity: 2>
- How many items you want to get when succes producing?
- <Recipe Speed: 1.5>
- production speed, it display a hud. it support decimals
- <Recipe Level: 1>
- Level of the recipe (if the player alchemy level is below he cant learn it)
- <Recipe Item Mixs: 17, 18, 19>
- Ingredients items ids required to produce the output item
- <Recipe Item Cost: 3, 2, 2>
- Quantity of item Mixs required to produce the Ouput item, MUST be in the same
- order of Item Mixs. In this case item id 17 require 3 or more, item id 18
- require 2 and item id 19 require 2.
- * IMPORTANT
- Once the game party gets the Item recipe, the game player has to learn the
- recipe from the inventory menu in order to be displayed in the alchemy GUI
- -------------------------------------
- * Extraction skill set up *
- In order to extract items plants, rocks or whatever you need, create an event
- with the following comment tags.
- Here a regular plant creation
- <extract_item: 19>
- <extract_quantity: 3>
- <extract_chance: 70>
- <extract_speed: 1.0>
- <extract_level: 1>
- <extract_times: 3>
- <extract_respawn: 10>
- Tags explanation
- <extract_item: 19>
- Which item id do you want to extract?
- <extract_quantity: 3>
- How many items will be extracted?
- <extract_chance: 70>
- Extraction success chance, it can be a number between 1 to 100 percent
- <extract_speed: 1.0>
- Extraction speed, it support decimals
- <extract_level: 1>
- item extraction level, if player extraction skill is below this level it cannot
- be extracted
- <extract_times: 3>
- How many times you want this plant to be extracted before dissapear?
- <extract_respawn: 10>
- Time in seconds this plant takes to respawn
- IMPORTANT NOTE!
- I strongly recomend to see this script demo examples for the correct usage of
- this complex system
- =end
- #===============================================================================
- # * Alchemy skill settings
- #===============================================================================
- module FalcaoAlchemy
- # After how many production times get a chance to level up
- ProductionTimesLevelUp = 3
- # Chance to level up when the production times match
- AlchemyLevelUpChance = 70
- # After how many party alchemy skill level above of Recipe level have a chance
- # to level up the alchemy skill. Example: Alchemy level = 20
- # Recipe level = 9, there are 11 levels above so party can not level up skill
- SeparateLevel = 10
- # Default alchemy maximun level (can be changed in game)
- DefaultMaxLevel = 100
- # Sound played when succes produce an item
- SuccesProduceSe = "Decision2"
- # Sound played when fail producing an item
- FailProduceSe = "Stare"
- # Sound played when succes level up the alchemy skill
- AlchemyLevelUpSe = "Raise1"
- end
- #===============================================================================
- # * Extraction skill settings
- #===============================================================================
- module FalExtract
- # After how many extraction times get a chance to level up
- ExtracTimesLevelUp = 4
- # Chance to level up when the production times match
- ExtracLevelUpChance = 80
- # After how many party extraction skill level above of Plant level have a
- # chance to level up the extraction skill. Example: Extraction level = 20
- # Plant level = 9, there are 11 levels above so party can not level up skill
- SeparateLevell = 5
- # Cấp Độ Tối Đa (can be changed in game)
- DefaultMaxLevel = 100
- # Animation id played while extracting
- ExAnimation = 111
- # Sound played when succes extrac an item
- SuccesExtractSe = "Item3"
- # Sound played when fail extract an item
- FailExtractSe = "Down1"
- # Sound played when level up extraction skill
- AlchemyLevelUpSe = "Raise1"
- #-----------------------------------------------
- def self.check_extracted_ones
- $game_map.events.values.each do |event|
- break if $game_party.ev_extdata[$game_map.map_id].nil?
- if !$game_party.ev_extdata[$game_map.map_id][event.id].nil?
- event.erase if $game_party.ev_extdata[$game_map.map_id][event.id][2]
- end
- end
- end
- end
- #Do you want to add the alchemy scene to the game menu? true / false
- FalcaoRGSS_AddAlchemy_to_menu = true
- #-----------------------------------------------------------------------------
- # * Script calls
- #
- # Use this script call only if you want to change the extraction and alchemy
- # levels manually
- #
- # $game_party.alchemy_maxlv(x) If you want to change the alchemy maximun level
- # in game change x for the new maximun level
- # $game_party.alchemy_lv = x if you want to change the current alchemy level
- # change x for the new level
- # $game_party.extraction_maxlv(x) Extraction max level, change x for the new
- # maximun level
- # $game_party.extract_lv = x Extraction current level, change x for any
- # integer
- #-------------------------------------------------------------------------------
- ($imported ||= {})['Falcao Mmorpg Alchemy And Extraction'] = 1.0
- #===============================================================================
- # * Falcao Alchemy skill END OF SETINGS
- #===============================================================================
- class RecipeData
- attr_accessor :recipes
- def initialize
- @recipes = {}
- @ingredients = {}
- register_values
- end
- def register_values
- for item in $data_items
- next if item.nil?
- id = item.recipedata("<Output Item Id: ")
- next if id.nil?
- type = item.recipedata("<Output Item Type: ", false)
- chance = item.recipedata("<Output Item Chance: ")
- quanti = item.recipedata("<Output Item Quantity: ")
- sp = item.recipedata("<Recipe Speed: ", true, true)
- lv = item.recipedata("<Recipe Level: ")
- mix = item.recipedata("<Recipe Item Mixs: ", false)
- @recipes[item.id] = [item.name, type, id, chance, quanti, sp, lv, item.id]
- @ingredients[item.id] = mix.split(",").map { |s| s.to_i }
- end
- end
- def recipes
- @recipes
- end
- def ingredients
- @ingredients
- end
- end
- class RPG::BaseItem
- def recipedata(comment, s=true, f=false)
- if @note =~ /#{comment}(.*)>/i
- return $1.to_f if f
- return s ? $1.to_i : $1.to_s.sub("\r","")
- end
- end
- def costitem
- if @costitemm.nil?
- @costitemm = {}
- if @note =~ /<Recipe Item Mixs: (.*)>/i
- key = $1.to_s.sub("\r","").split(",").map { |s| s.to_i }
- end
- if @note =~ /<Recipe Item Cost: (.*)>/i
- value = $1.to_s.sub("\r","").split(",").map { |s| s.to_i }
- end
- if key != nil
- index = 0
- key.each {|k|
- @costitemm[k] = value[index]
- index += 1}
- end
- return @costitemm
- else
- return @costitemm
- end
- end
- end
- class Game_Party < Game_Unit
- attr_reader :recipes
- attr_accessor :extract_data, :extract_lv, :extrat_count, :ev_extdata
- attr_accessor :alchemy_lv, :alchemy_count, :pop_windowdata
- attr_accessor :al_maxlv, :ex_maxlv
- alias falcaoalchemy_ini initialize
- def initialize
- @recipes = []
- @extract_lv = 1
- @extrat_count = 0
- @ev_extdata = {}
- @alchemy_lv = 1
- @alchemy_count = 0
- @al_maxlv = FalcaoAlchemy::DefaultMaxLevel
- @ex_maxlv = FalExtract::DefaultMaxLevel
- falcaoalchemy_ini
- end
- def alchemy_maxlv(lv)
- @al_maxlv = lv if lv >= @al_maxlv
- end
- def extraction_maxlv(lv)
- @ex_maxlv = lv if lv >= @ex_maxlv
- end
- def add_recipe(id)
- @recipes.push(id) unless @recipes.include?(id)
- end
- def pop_w(time, name, text)
- return unless @pop_windowdata.nil?
- @pop_windowdata = [time, text, name]
- end
- end
- class Game_Battler < Game_BattlerBase
- alias falcaoalchemy_mm_item consume_item
- def consume_item(item)
- if item.is_a?(RPG::Item) and !item.recipedata("<Output Item Id: ").nil?
- level = item.recipedata("<Recipe Level: ")
- if $game_party.alchemy_lv >= level
- $game_party.add_recipe(item.id)
- $game_party.pop_w(
- 180, 'Thông Báo', "Công Thức : #{item.name} Đã Học Xong!")
- else
- $game_party.gain_item(item, 1)
- $game_party.pop_w(
- 180,'Chú Ý',"Chế Tạo Cấp #{level} Để Học Cách Chế Tạo")
- Sound.play_buzzer
- end
- end
- falcaoalchemy_mm_item(item)
- end
- end
- #-------------------------------------------------------------------------------
- class Window_AlRecipes < Window_Selectable
- def initialize(x, y, w, h, rdata)
- super(x, y, w, h)
- @rdata = rdata
- refresh ; select(0)
- end
- def item() return @data[self.index] end
- def refresh
- self.contents.clear if self.contents != nil
- @data = []
- @rdata.recipes.each {|id, recipe| @data.push(recipe) if
- $game_party.recipes.include?(id)}
- @item_max = @data.size
- if @item_max > 0
- self.contents = Bitmap.new(width - 32, row_max * 26)
- for i in 0...@item_max
- draw_item(i)
- end
- end
- end
- def draw_item(index)
- item = @data[index]
- x, y = index % col_max * (90), index / col_max * 24
- self.contents.font.size = 18
- draw_icon($data_items[item[7]].icon_index, x, y)
- contents.draw_text(x + 25, y, self.width, 32, item[0])
- end
- def item_max
- return @item_max.nil? ? 0 : @item_max
- end
- end
- class Window_StartProducing < Window_HorzCommand
- def initialize(dark)
- @darked = dark
- super(200, 0)
- end
- def window_width() return 344 end
- def window_height() return 60 end
- def col_max
- return 2
- end
- def make_command_list
- add_command("Chế Tạo ", :start, @darked.items_ready?)
- add_command("Dừng", :stop)
- end
- def process_cancel
- @darked.meter > 0 ? return : super
- end
- end
- class FalcaoExtraction
- include FalExtract
- def initialize
- @col = [Color.new(180, 225, 245), Color.new(20, 160, 225), Color.new(0,0,0)]
- @running = false
- @anitimer = 0
- end
- def update
- update_extraction_trigger if Input.trigger?(:C)
- update_display_window if $game_party.extract_data != nil
- update_respawn
- end
- def update_respawn
- return if $game_party.ev_extdata[$game_map.map_id].nil?
- $game_map.events.values.each do |event|
- break if $game_party.ev_extdata[$game_map.map_id].nil?
- if !$game_party.ev_extdata[$game_map.map_id][event.id].nil?
- if $game_party.ev_extdata[$game_map.map_id][event.id][2]
- $game_party.ev_extdata[$game_map.map_id][event.id][1] -= 1 if
- $game_party.ev_extdata[$game_map.map_id][event.id][1] > 0
- if $game_party.ev_extdata[$game_map.map_id][event.id][1] == 0
- event.fading = [:fade_out, 60]
- $game_party.ev_extdata[$game_map.map_id].delete(event.id)
- if $game_party.ev_extdata[$game_map.map_id].empty?
- $game_party.ev_extdata.delete($game_map.map_id)
- end
- next
- end
- end
- end
- end
- end
- def update_display_window
- create_window
- if $game_party.extract_data[5] > 0
- $game_party.extract_data[5] -= 1
- if $game_party.extract_data[5] == 0
- $game_party.extract_data = nil
- dispose_window
- @running = false
- return
- end
- end
- return if $game_party.extract_data[5] > 0
- if @running
- if $game_party.extract_data[5] == 0
- refresh_contents
- $game_party.extract_data[4] += 1
- end
- if $game_party.extract_data[4] >= $game_party.extract_data[3] * 60
- $game_party.extract_data[5] = 60
- refresh_contents
- end
- end
- end
- def create_window
- return if !@ext_window.nil?
- @ext_window = Window_Base.new(544 / 2 - 200 / 2, 0, 260, 66)
- if $game_party.extract_lv >= $game_party.extract_data[6]
- @running = true
- end
- refresh_contents
- end
- def refresh_contents
- @ext_window.contents.clear
- @ext_window.contents.fill_rect(0, 10, 26, 38, Color.new(0, 0, 0, 68))
- item = $game_party.extract_data[0]
- @ext_window.draw_icon(item.icon_index, 1, 11)
- @ext_window.contents.font.size = 20
- @ext_window.contents.font.color = @ext_window.normal_color
- @ext_window.contents.font.shadow = true
- string = "Bạn Đang Nhặt " + item.name
- @ext_window.draw_text(-4, -6, @ext_window.width, 32, string, 1)
- @ext_window.contents.font.size = 15
- @ext_window.draw_text(0, 222, 26, 32, $game_party.extract_data[1].to_s, 1)
- @ext_window.contents.font.size = 15
- if @running
- if $game_party.extract_data[5] == 60
- r = rand(101)
- @ext_window.contents.font.color = Color.new(-255,225,-225, 255)
- if r <= $game_party.extract_data[2]
- $game_party.gain_item($game_party.extract_data[0],
- $game_party.extract_data[1])
- RPG::SE.new(SuccesExtractSe, 80,).play
- @ext_window.draw_text(-30, 20, @ext_window.width, 32, 'Nhặt Thành Công', 2)
- if $game_party.extrat_count == ExtracTimesLevelUp - 1
- r2 = rand(101)
- if r2 <= ExtracLevelUpChance
- leveling = true unless stop_growing?
- apply_extraction_growing
- end
- else
- $game_party.extrat_count += 1
- end
- @anitimer = 0
- else
- RPG::SE.new(FailExtractSe, 80,).play
- @ext_window.draw_text(-30, 20, @ext_window.width, 32, 'Nhặt Thất Bại', 2)
- end
- apply_variance
- @running = false
- end
- run_extractor if leveling.nil?
- else
- @ext_window.draw_text(0, 16, @ext_window.width, 32,
- "Phải Lên Cấp #{$game_party.extract_data[6]} Bắt Buộc", 1)
- Sound.play_buzzer
- s = "Yêu Cầu Nhặt Cấp #{$game_party.extract_data[6]} Cần Thiết "
- $game_party.pop_w(180, 'Nhắc Nhở', s)
- $game_party.extract_data[5] = 120
- end
- end
- def stop_growing?
- lv = $game_party.extract_data[6]
- return true if $game_party.extract_lv == $game_party.ex_maxlv
- return true unless $game_party.extract_lv <= lv + SeparateLevell - 1
- return false
- end
- # growing
- def apply_extraction_growing
- return if stop_growing?
- RPG::SE.new(AlchemyLevelUpSe, 80,).play
- $game_party.extract_lv += 1
- $game_party.extrat_count = 0
- @ext_window.draw_text(30, 20, @ext_window.width, 32,
- "Lên Cấp #{$game_party.extract_lv}!")
- end
- def apply_variance
- $game_party.ev_extdata[$game_map.map_id] = {} if
- $game_party.ev_extdata[$game_map.map_id].nil?
- event = $game_party.extract_data[7]
- times = event.check_ext("<extract_times: ")
- res = event.check_ext("<extract_respawn: ") * 60
- if $game_party.ev_extdata[$game_map.map_id][event.id].nil?
- $game_party.ev_extdata[$game_map.map_id][event.id] = [times, res, false]
- end
- $game_party.ev_extdata[$game_map.map_id][event.id][0] -= 1
- if $game_party.ev_extdata[$game_map.map_id][event.id][0] == 0
- event.fading = [:fade_in, 60]
- $game_party.ev_extdata[$game_map.map_id][event.id][2] = true
- end
- end
- def run_extractor
- x, y = 30, 30
- @ext_window.contents.fill_rect(x, y, 102, 12, @col[2])
- max = $game_party.extract_data[3] * 60
- meter = $game_party.extract_data[4]
- @ext_window.contents.fill_rect(x+1, y+1, 100 *meter / max, 5, @col[0])
- @ext_window.contents.fill_rect(x+1, y+6, 100 *meter / max, 5, @col[1])
- @anitimer += 1
- @anitimer = 0 if @anitimer == 6
- $game_party.extract_data[7].animation_id = ExAnimation if @anitimer == 2
- $game_player.pattern = 2
- end
- def dispose_window
- return if @ext_window.nil?
- @ext_window.dispose
- @ext_window = nil
- end
- def update_extraction_trigger
- return if $game_party.extract_data != nil
- $game_map.events.values.each do |event|
- next if event.fading[1] > 0
- next unless $game_player.in_front_ext?(event)
- item = event.check_ext("<extract_item: ")
- weapon = event.check_ext("<extract_weapon: ")
- armor = event.check_ext("<extract_weapon: ")
- if item != 0 then kind = $data_items[item]
- elsif weapon != 0 then kind = $data_weapons[weapon]
- elsif armor != 0 then kind = $data_armor[armor]
- end
- if kind != nil
- quantity = event.check_ext("<extract_quantity: ")
- chance = event.check_ext("<extract_chance: ")
- speed = event.check_ext("<extract_speed: ", false)
- lv = event.check_ext("<extract_level: ")
- $game_party.extract_data = [kind,quantity,chance,speed,meter=0, t=0,
- lv, event]
- break
- end
- end
- end
- def dispose
- dispose_window
- end
- end
- class Spriteset_Map
- alias falcaoextraction_create_p create_pictures
- def create_pictures
- falcaoextraction_create_p
- @falextraction = FalcaoExtraction.new
- end
- alias falcaoextraction_update update
- def update
- falcaoextraction_update
- @falextraction.update
- end
- alias falcaoextraction_dispose dispose
- def dispose
- falcaoextraction_dispose
- @falextraction.dispose
- end
- end
- class Game_Event < Game_Character
- attr_accessor :opacity, :erased, :fading
- def check_ext(comment, f=true)
- return 0 if @list.nil? or @list.size <= 0
- for item in @list
- if item.code == 108 or item.code == 408
- return f ? $1.to_i : $1.to_f if item.parameters[0] =~ /#{comment}(.*)>/i
- end
- end
- return 0
- end
- alias falcaoexts_ini initialize
- def initialize(map_id, event)
- @fading = [:fade_in, time=0]
- falcaoexts_ini(map_id, event)
- end
- alias falcaoexts_up update
- def update
- if @fading[1] > 0
- @fading[1] -= 1
- if @fading[0] == :fade_in
- @opacity -= 4 if @opacity >= 0
- erase if @fading[1] == 0
- elsif @fading[0] == :fade_out
- if @erased
- @erased = false
- refresh ; @opacity = 0
- end
- @opacity += 4 if @opacity <= 255
- end
- end
- falcaoexts_up
- end
- end
- class Game_Player < Game_Character
- attr_accessor :pattern
- def in_front_ext?(target)
- return true if @direction == 2 and @x == target.x and (@y+1) == target.y
- return true if @direction == 4 and (@x-1) == target.x and @y == target.y
- return true if @direction == 6 and (@x+1) == target.x and @y == target.y
- return true if @direction == 8 and @x == target.x and (@y-1) == target.y
- return false
- end
- def update_anime_pattern
- return if !$game_party.extract_data.nil?
- super
- end
- alias falcaoextraction_mov movable?
- def movable?
- return false if $game_party.extract_data != nil
- falcaoextraction_mov
- end
- alias falcaoext_perform_transfer perform_transfer
- def perform_transfer
- falcaoext_perform_transfer
- FalExtract.check_extracted_ones if $game_map.map_id != @new_map_id
- end
- end
- class << DataManager
- alias falcaoalchemy_mmo_load load_normal_database
- def DataManager.load_normal_database
- falcaoalchemy_mmo_load
- for item in $data_items
- next if item.nil?
- if item.recipedata("<Output Item Id: ") != nil
- item.name = item.name + " L#{item.recipedata("<Recipe Level: ")}"
- item.consumable = true
- item.scope = 0
- end
- end
- end
- alias falcaoalchemy_reloadmap reload_map_if_updated
- def DataManager.reload_map_if_updated
- falcaoalchemy_reloadmap
- FalExtract.check_extracted_ones if
- $game_system.version_id != $data_system.version_id
- end
- end
- # ingrediebnts
- class AlIngredients
- attr_accessor :meter
- def initialize(rdata)
- @ingredients = Window_Base.new(200, 60, 344, 266)
- @recipe = []
- @meter = 0
- @rdata = rdata
- end
- def refresh(recipe)
- @recipe = recipe
- @ingredients.contents.clear
- @ingredients.contents.font.size = 18 ; w = @ingredients.width
- @ingredients.contents.fill_rect(0, 24, w, 220, Color.new(0, 0, 0, 60))
- apply_color(1)
- @ingredients.draw_text(-16, -6, w, 32, 'Nguyên Liệu Cần Thiết', 1)
- draw_ingredients
- end
- def draw_ingredients
- manager = y = 0
- for i in ingredients
- item = $data_items[i]
- manager += 1
- (manager%2 == 0) ? x = 156 : y += 24
- x = 0 unless (manager%2 == 0)
- enable = $game_party.item_number(item) >= cost[item.id]
- enable ? apply_color(1) : apply_color(2)
- @ingredients.draw_icon(item.icon_index, x, y, enable)
- @ingredients.contents.font.size = 15
- number = $game_party.item_number(item)
- @ingredients.draw_text(x - 2, y + 6, 32, 32, number.to_s, 1)
- @ingredients.contents.font.size = 18
- @ingredients.draw_text(x + 24, y,212,32, item.name + " X#{cost[item.id]}")
- end
- end
- def items_ready?
- return false if @meter > 0
- combi = ingredients ; item = [] ; combi = [] if combi.nil?
- combi.each {|i|
- it =$data_items[i]; item << i if $game_party.item_number(it) >= cost[it.id]}
- item.size == combi.size
- end
- def apply_color(c)
- @ingredients.contents.font.color = @ingredients.normal_color if c == 1
- @ingredients.contents.font.color = Color.new(255,255,255,128) if c == 2
- end
- def ingredients
- return @rdata.ingredients[@recipe.last]
- end
- def dispose
- @ingredients.dispose
- end
- def update_index(recipe_index)
- @recipe_index = recipe_index
- end
- def cost
- return $data_items[@recipe_index].costitem
- end
- end
- #----------
- class Scene_Alchemy < Scene_MenuBase
- include FalcaoAlchemy
- def start
- super
- recipedata = RecipeData.new
- @col = [Color.new(180, 225, 245), Color.new(20, 160, 225), Color.new(0,0,0)]
- @meter = 0
- @infow = Window_Base.new(0, 0, 200, 60)
- @alstatus = Window_Base.new(0, 326, 200, 90)
- refresh_alstatus
- @infow.contents.font.size = 20
- @infow.draw_text(-16, 0, @infow.width, 32, 'Công Thức', 1)
- @recipes = Window_AlRecipes.new(0, 60, 200, 266, recipedata)
- @ngrewindow = AlIngredients.new(recipedata)
- update_rindex
- @oven = Window_Base.new(200, 326, 344, 90)
- @pop_timer = 0
- update_recipe
- @start_window = Window_StartProducing.new(@ngrewindow)
- update_cancel
- @start_window.set_handler(:start, method(:update_start))
- @start_window.set_handler(:stop, method(:update_stop))
- @start_window.set_handler(:cancel, method(:update_cancel))
- end
- def refresh_alstatus
- @alstatus.contents.clear
- @alstatus.contents.font.size = 18; w = @alstatus.width ; g = $game_party
- @alstatus.draw_icon(218, 0, 16) ; arr = [g.al_maxlv.to_s, g.ex_maxlv.to_s]
- @alstatus.draw_icon(482, 0, 40)
- @alstatus.draw_text(-16, -8, w, 32, 'Bản Thành Thạo ', 1)
- @alstatus.draw_text(26, 16, w, 32,"Chế Tạo Cấp : #{g.alchemy_lv}/" + arr[0])
- @alstatus.draw_text(26, 40, w, 32,"Nhặt Cấp : #{g.extract_lv}/" + arr[1])
- end
- def update_start
- @ngrewindow.meter = 1
- end
- def update_stop
- @ngrewindow.meter = 0
- @start_window.refresh
- @start_window.activate
- refresh_oven
- end
- def output_item
- item = @recipes.item
- kind = $data_items[item[2]] if item[1]=='Item' || item[1]=='item'
- kind = $data_weapons[item[2]] if item[1]=='Weapon' || item[1]=='weapon'
- kind = $data_armors[item[2]] if item[1]=='Armor' || item[1]=='armor'
- kind
- end
- def update_cancel
- @start_window.unselect
- @start_window.deactivate
- @recipes.activate
- end
- def refresh_ingredients
- @ngrewindow.refresh(@recipes.item)
- end
- def refresh_oven
- @oven.contents.clear
- @oven.contents.font.size = 18
- @oven.contents.fill_rect(0, 31, 31, 36, Color.new(0, 0, 0, 60))
- @oven.draw_text(-16, -6, @oven.width, 32, 'Thông Tin Chế Tạo', 1)
- if @pop_timer > 0
- @oven.contents.font.color = Color.new(255, 120, 0, 255)
- @oven.draw_text(0, -6, @oven.width, 32, @type)
- end
- @oven.contents.font.color = @oven.normal_color
- @oven.draw_icon(output_item.icon_index, 4, 34)
- @oven.contents.font.size = 15
- @oven.draw_text(0, 45, 33, 32, @recipes.item[4], 1)
- @oven.contents.font.size = 18
- @oven.draw_text(34, 23, 250, 32, output_item.name)
- @oven.draw_text(-26, 23, @oven.width, 32, 'Tỷ Lệ Thành Công ', 2)
- @oven.draw_text(-26, 40, @oven.width, 32, @recipes.item[3].to_s + '%', 2)
- x, y = 33, 52
- @oven.contents.fill_rect(x, y, 150, 12, @col[2])
- max = @recipes.item[5] * 60
- @oven.contents.fill_rect(x+1, y+1, 152 *@ngrewindow.meter / max, 5, @col[0])
- @oven.contents.fill_rect(x+1, y+6, 152 *@ngrewindow.meter / max, 5, @col[1])
- end
- def update_rindex
- @ngrewindow.update_index(@recipes.item[7]) unless @recipes.item.nil?
- end
- def update
- super
- update_rindex
- update_recipe
- SceneManager.return if Input.trigger?(:B) and @recipes.active
- update_selection if Input.trigger?(:C) and @recipes.active and
- !@recipes.item.nil?
- update_meter
- end
- def update_meter
- if @pop_timer > 0
- @pop_timer -= 1
- refresh_oven if @pop_timer == 0
- end
- if @ngrewindow.meter != 0
- @start_window.refresh if @ngrewindow.meter == 1
- @start_window.activate if @ngrewindow.meter == 1
- @ngrewindow.meter += 1
- refresh_oven
- if @ngrewindow.meter >= @recipes.item[5] * 60
- @ngrewindow.meter = 0
- random = rand(101)
- random <= @recipes.item[3] ? success_producing : fail_producing
- end
- end
- end
- def success_producing
- RPG::SE.new(SuccesProduceSe, 80,).play
- $game_party.gain_item(output_item, @recipes.item[4])
- @type = 'Thành Công!' ; @pop_timer = 50
- destroy_items
- apply_alchemy_growing
- end
- def apply_alchemy_growing
- return if $game_party.alchemy_lv == $game_party.al_maxlv
- return unless $game_party.alchemy_lv <= @recipes.item[6] + SeparateLevel - 1
- if $game_party.alchemy_count == ProductionTimesLevelUp - 1
- r2 = rand(101)
- if r2 <= AlchemyLevelUpChance
- $game_party.alchemy_lv += 1
- RPG::SE.new(AlchemyLevelUpSe, 80,).play
- $game_party.alchemy_count = 0
- refresh_alstatus
- end
- else
- $game_party.alchemy_count += 1
- end
- end
- def fail_producing
- RPG::SE.new(FailProduceSe, 80,).play
- @type = 'Thất Bại!' ; @pop_timer = 50
- destroy_items
- end
- def destroy_items
- c = $data_items[@recipes.item[7]].costitem
- @ngrewindow.ingredients.each {|i|$game_party.lose_item($data_items[i],c[i])}
- refresh_ingredients
- refresh_oven
- @ngrewindow.items_ready? ? update_start : @start_window.refresh
- end
- def update_selection
- Sound.play_ok
- @start_window.select(0)
- @start_window.activate
- @recipes.deactivate
- end
- def update_recipe
- return if @recipes.item.nil?
- if @recipe_index != @recipes.index
- @recipe_index = @recipes.index
- refresh_ingredients
- @start_window.refresh if !@start_window.nil?
- refresh_oven
- end
- end
- def terminate
- super
- @recipes.dispose
- @infow.dispose
- @ngrewindow.dispose
- @start_window.dispose
- @oven.dispose
- @alstatus.dispose
- end
- end
- # Input module update engine
- class << Input
- alias falcaoalchemy_mmo_update update
- def Input.update
- update_popwindow2 if !$game_party.nil? and !$game_party.pop_windowdata.nil?
- falcaoalchemy_mmo_update
- end
- # pop window global
- def update_popwindow2
- $game_party.pop_windowdata[0] -= 1 if $game_party.pop_windowdata[0] > 0
- if @temp_window.nil?
- tag = $game_party.pop_windowdata[2]
- string = $game_party.pop_windowdata[1] + tag
- width = (string.length * 9) - 10
- x, y = Graphics.width / 2 - width / 2, Graphics.height / 2 - 64 / 2
- @temp_window = Window_Base.new(x, y, width, 64)
- @temp_window.contents.font.size = 20
- @temp_window.z = 9999
- @temp_window.draw_text(-10, -6, width, 32, tag, 1)
- @temp_window.draw_text(-10,14, width, 32, $game_party.pop_windowdata[1],1)
- @current_scene = SceneManager.scene.class
- end
- if $game_party.pop_windowdata[0] == 0 ||
- @current_scene != SceneManager.scene.class
- @temp_window.dispose
- @temp_window = nil
- $game_party.pop_windowdata = nil
- end
- end
- end
- if FalcaoRGSS_AddAlchemy_to_menu
- class Window_MenuCommand < Window_Command
- alias falcaoadd_alchemy add_original_commands
- def add_original_commands
- add_command('Bản Chế Tạo', :alchemy, main_commands_enabled)
- falcaoadd_alchemy
- end
- end
- class Scene_Menu < Scene_MenuBase
- alias falcao_alchemy_command create_command_window
- def create_command_window
- falcao_alchemy_command
- @command_window.set_handler(:alchemy, method(:call_alchemy_scene))
- end
- def call_alchemy_scene
- SceneManager.call(Scene_Alchemy)
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement