| 赞 | 0 |
| VIP | |
| 好人卡 | |
| 积分 | 1 |
| 经验 | |
| 最后登录 | 2017-10-26 |
| 在线时间 | 91 小时 |
- 梦石
- 0
- 星屑
- 80
- 在线时间
- 91 小时
- 注册时间
- 2017-2-4
- 回帖
- 15
|
加入我们,或者,欢迎回来。
您需要 登录 才可以下载或查看,没有账号?注册会员
×
本帖最后由 uoar 于 2017-2-11 20:23 编辑
这个是合成系统介面的脚本
点击展开/收起
- #==============================================================================
- # ■ RGSS3 アイテム合成 ver 1.04
- #------------------------------------------------------------------------------
- # 配布元:
- # 白の魔 [url]http://izumiwhite.web.fc2.com/[/url]
- #
- # 利用規約:
- # RPGツクールVX Aceの正規の登錄者のみご利用になれます。
- # 利用報告・著作権表示とかは必要ありません。
- # 改造もご自由にどうぞ。
- # 何か問題が発生しても責任は持ちません。
- #==============================================================================
- #--------------------------------------------------------------------------
- # ★ 初期設定。
- # 合成レシピ等の設定
- #--------------------------------------------------------------------------
- module WD_itemsynthesis_ini
-
- Cost_view = true #費用(G)の表示(合成の費用が全て0Gの場合はfalseを推奨)
-
- Category_i = true #カテゴリウィンドウに「アイテム」の項目を表示
- Category_w = true #カテゴリウィンドウに「武器」の項目を表示
- Category_a = true #カテゴリウィンドウに「防具」の項目を表示
- Category_k = true #カテゴリウィンドウに「大事なもの」の項目を表示
-
- I_recipe = [] #この行は削除しないこと
- W_recipe = [] #この行は削除しないこと
- A_recipe = [] #この行は削除しないこと
-
- #以下、合成レシピ。
- #例: I_recipe[3] = [100, ["I",1,1], ["W",2,1], ["A",2,2], ["A",3,1]]
- #と記載した場合、ID3のアイテムの合成必要は、100G。
- #必要な素材は、ID1のアイテム1個、ID2の武器1個、ID2の防具2個、ID3の防具1個
- #となる。
-
- #アイテムの合成レシピ
- I_recipe[9] = [1000, ["I",40,1], ["I",48,2]]
- #武器の合成レシピ
- W_recipe[3] = [50, ["W",1,1], ["W",2,1]]
- W_recipe[6] = [600, ["W",3,1], ["I",17,0]]
-
- #防具の合成レシピ
- A_recipe[68] = [1000, ["I",39,20], ["A",1,1]]
-
- end
- #==============================================================================
- # ■ WD_itemsynthesis
- #------------------------------------------------------------------------------
- # アイテム合成用の共通メソッドです。
- #==============================================================================
- module WD_itemsynthesis
- def i_recipe_switch_on(id)
- $game_system.i_rcp_sw = [] if $game_system.i_rcp_sw == nil
- $game_system.i_rcp_sw[id] = false if $game_system.i_rcp_sw[id] == nil
- $game_system.i_rcp_sw[id] = true
- end
- def i_recipe_switch_off(id)
- $game_system.i_rcp_sw = [] if $game_system.i_rcp_sw == nil
- $game_system.i_rcp_sw[id] = false if $game_system.i_rcp_sw[id] == nil
- $game_system.i_rcp_sw[id] = false
- end
- def i_recipe_switch_on?(id)
- $game_system.i_rcp_sw = [] if $game_system.i_rcp_sw == nil
- $game_system.i_rcp_sw[id] = false if $game_system.i_rcp_sw[id] == nil
- return $game_system.i_rcp_sw[id]
- end
- def i_recipe_all_switch_on
- for i in 1..$data_items.size
- i_recipe_switch_on(i)
- end
- end
- def i_recipe_all_switch_off
- for i in 1..$data_items.size
- i_recipe_switch_off(i)
- end
- end
- def w_recipe_switch_on(id)
- $game_system.w_rcp_sw = [] if $game_system.w_rcp_sw == nil
- $game_system.w_rcp_sw[id] = false if $game_system.w_rcp_sw[id] == nil
- $game_system.w_rcp_sw[id] = true
- end
- def w_recipe_switch_off(id)
- $game_system.w_rcp_sw = [] if $game_system.w_rcp_sw == nil
- $game_system.w_rcp_sw[id] = false if $game_system.w_rcp_sw[id] == nil
- $game_system.w_rcp_sw[id] = false
- end
- def w_recipe_switch_on?(id)
- $game_system.w_rcp_sw = [] if $game_system.w_rcp_sw == nil
- $game_system.w_rcp_sw[id] = false if $game_system.w_rcp_sw[id] == nil
- return $game_system.w_rcp_sw[id]
- end
- def w_recipe_all_switch_on
- for i in 1..$data_weapons.size
- w_recipe_switch_on(i)
- end
- end
- def w_recipe_all_switch_off
- for i in 1..$data_weapons.size
- w_recipe_switch_off(i)
- end
- end
- def a_recipe_switch_on(id)
- $game_system.a_rcp_sw = [] if $game_system.a_rcp_sw == nil
- $game_system.a_rcp_sw[id] = false if $game_system.a_rcp_sw[id] == nil
- $game_system.a_rcp_sw[id] = true
- end
- def a_recipe_switch_off(id)
- $game_system.a_rcp_sw = [] if $game_system.a_rcp_sw == nil
- $game_system.a_rcp_sw[id] = false if $game_system.a_rcp_sw[id] == nil
- $game_system.a_rcp_sw[id] = false
- end
- def a_recipe_switch_on?(id)
- $game_system.a_rcp_sw = [] if $game_system.a_rcp_sw == nil
- $game_system.a_rcp_sw[id] = false if $game_system.a_rcp_sw[id] == nil
- return $game_system.a_rcp_sw[id]
- end
- def a_recipe_all_switch_on
- for i in 1..$data_armors.size
- a_recipe_switch_on(i)
- end
- end
- def a_recipe_all_switch_off
- for i in 1..$data_armors.size
- a_recipe_switch_off(i)
- end
- end
- def recipe_all_switch_on
- i_recipe_all_switch_on
- w_recipe_all_switch_on
- a_recipe_all_switch_on
- end
- def recipe_all_switch_off
- i_recipe_all_switch_off
- w_recipe_all_switch_off
- a_recipe_all_switch_off
- end
- end
- class Game_Interpreter
- include WD_itemsynthesis
- end
- class Game_System
- #--------------------------------------------------------------------------
- # ● 公開インスタンス変數
- #--------------------------------------------------------------------------
- attr_accessor :i_rcp_sw
- attr_accessor :w_rcp_sw
- attr_accessor :a_rcp_sw
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- alias wd_orig_initialize004 initialize
- def initialize
- wd_orig_initialize004
- @i_rcp_sw = []
- @w_rcp_sw = []
- @a_rcp_sw = []
- end
- end
- #==============================================================================
- # ■ Scene_ItemSynthesis
- #------------------------------------------------------------------------------
- # 合成畫面の處理を行うクラスです。
- #==============================================================================
- class Scene_ItemSynthesis < Scene_MenuBase
- #--------------------------------------------------------------------------
- # ● 開始處理
- #--------------------------------------------------------------------------
- def start
- super
- create_help_window
- create_dummy_window
- create_number_window
- create_status_window
- create_material_window
- create_list_window
- create_category_window
- create_gold_window
- create_change_window
- end
- #--------------------------------------------------------------------------
- # ● ゴールドウィンドウの作成
- #--------------------------------------------------------------------------
- def create_gold_window
- @gold_window = Window_Gold.new
- @gold_window.viewport = @viewport
- @gold_window.x = Graphics.width - @gold_window.width
- @gold_window.y = @help_window.height
- @gold_window.hide
- end
- #--------------------------------------------------------------------------
- # ● 切り替え表示ウィンドウの作成
- #--------------------------------------------------------------------------
- def create_change_window
- wx = 0
- wy = @gold_window.y
- ww = Graphics.width - @gold_window.width
- wh = @gold_window.height
- @change_window = Window_ItemSynthesisChange.new(wx, wy, ww, wh)
- @change_window.viewport = @viewport
- @change_window.hide
- end
- #--------------------------------------------------------------------------
- # ● ダミーウィンドウの作成
- #--------------------------------------------------------------------------
- def create_dummy_window
- wy = @help_window.y + @help_window.height + 48
- wh = Graphics.height - wy
- @dummy_window = Window_Base.new(0, wy, Graphics.width, wh)
- @dummy_window.viewport = @viewport
- end
- #--------------------------------------------------------------------------
- # ● 個數入力ウィンドウの作成
- #--------------------------------------------------------------------------
- def create_number_window
- wy = @dummy_window.y
- wh = @dummy_window.height
- @number_window = Window_ItemSynthesisNumber.new(0, wy, wh)
- @number_window.viewport = @viewport
- @number_window.hide
- @number_window.set_handler(:ok, method(:on_number_ok))
- @number_window.set_handler(:cancel, method(:on_number_cancel))
- @number_window.set_handler(:change_window, method(:on_change_window))
- end
- #--------------------------------------------------------------------------
- # ● ステータスウィンドウの作成
- #--------------------------------------------------------------------------
- def create_status_window
- wx = @number_window.width
- wy = @dummy_window.y
- ww = Graphics.width - wx
- wh = @dummy_window.height
- @status_window = Window_ShopStatus.new(wx, wy, ww, wh)
- @status_window.viewport = @viewport
- @status_window.hide
- end
- #--------------------------------------------------------------------------
- # ● 素材ウィンドウの作成
- #--------------------------------------------------------------------------
- def create_material_window
- wx = @number_window.width
- wy = @dummy_window.y
- ww = Graphics.width - wx
- wh = @dummy_window.height
- @material_window = Window_ItemSynthesisMaterial.new(wx, wy, ww, wh)
- @material_window.viewport = @viewport
- @material_window.hide
- @number_window.material_window = @material_window
- end
- #--------------------------------------------------------------------------
- # ● 合成アイテムリストウィンドウの作成
- #--------------------------------------------------------------------------
- def create_list_window
- wy = @dummy_window.y
- wh = @dummy_window.height
- @list_window = Window_ItemSynthesisList.new(0, wy, wh)
- @list_window.viewport = @viewport
- @list_window.help_window = @help_window
- @list_window.status_window = @status_window
- @list_window.material_window = @material_window
- @list_window.hide
- @list_window.set_handler(:ok, method(:on_list_ok))
- @list_window.set_handler(:cancel, method(:on_list_cancel))
- @list_window.set_handler(:change_window, method(:on_change_window))
- end
- #--------------------------------------------------------------------------
- # ● カテゴリウィンドウの作成
- #--------------------------------------------------------------------------
- def create_category_window
- @category_window = Window_ItemSynthesisCategory.new
- @category_window.viewport = @viewport
- @category_window.help_window = @help_window
- @category_window.y = @help_window.height
- @category_window.activate
- @category_window.item_window = @list_window
- @category_window.set_handler(:ok, method(:on_category_ok))
- @category_window.set_handler(:cancel, method(:return_scene))
- end
- #--------------------------------------------------------------------------
- # ● 合成アイテムリストウィンドウのアクティブ化
- #--------------------------------------------------------------------------
- def activate_list_window
- @list_window.money = money
- @list_window.show.activate
- end
- #--------------------------------------------------------------------------
- # ● 合成[決定]
- #--------------------------------------------------------------------------
- def on_list_ok
- @item = @list_window.item
- @list_window.hide
- @number_window.set(@item, max_buy, buying_price, currency_unit)
- @number_window.show.activate
- end
- #--------------------------------------------------------------------------
- # ● 合成[キャンセル]
- #--------------------------------------------------------------------------
- def on_list_cancel
- @category_window.activate
- @category_window.show
- @dummy_window.show
- @list_window.hide
- @status_window.hide
- @status_window.item = nil
- @material_window.hide
- @material_window.set(nil, nil)
- @gold_window.hide
- @change_window.hide
- @help_window.clear
- end
- #--------------------------------------------------------------------------
- # ● 表示切替
- #--------------------------------------------------------------------------
- def on_change_window
- if @status_window.visible
- @status_window.hide
- @material_window.show
- else
- @status_window.show
- @material_window.hide
- end
- end
- #--------------------------------------------------------------------------
- # ● カテゴリ[決定]
- #--------------------------------------------------------------------------
- def on_category_ok
- activate_list_window
- @gold_window.show
- @change_window.show
- @material_window.show
- @category_window.hide
- @list_window.select(0)
- end
- #--------------------------------------------------------------------------
- # ● 個數入力[決定]
- #--------------------------------------------------------------------------
- def on_number_ok
- Sound.play_shop
- do_syntetic(@number_window.number)
- end_number_input
- @gold_window.refresh
- end
- #--------------------------------------------------------------------------
- # ● 個數入力[キャンセル]
- #--------------------------------------------------------------------------
- def on_number_cancel
- Sound.play_cancel
- end_number_input
- end
- #--------------------------------------------------------------------------
- # ● 合成の実行
- #--------------------------------------------------------------------------
- def do_syntetic(number)
- $game_party.lose_gold(number * buying_price)
- $game_party.gain_item(@item, number)
-
- [url=home.php?mod=space&uid=2564094]@recipe[/url] = @list_window.recipe(@item)
- for i in [email]1...@recipe.size[/email]
- kind = @recipe[i][0]
- id = @recipe[i][1]
- num = @recipe[i][2]
- if kind == "I"
- item = $data_items[id]
- elsif kind == "W"
- item = $data_weapons[id]
- elsif kind == "A"
- item = $data_armors[id]
- end
- $game_party.lose_item(item, num*number)
- end
- end
- #--------------------------------------------------------------------------
- # ● 個數入力の終了
- #--------------------------------------------------------------------------
- def end_number_input
- @number_window.hide
- activate_list_window
- end
- #--------------------------------------------------------------------------
- # ● 最大購入可能個數の取得
- #--------------------------------------------------------------------------
- def max_buy
- max = $game_party.max_item_number(@item) - $game_party.item_number(@item)
-
- @recipe = @list_window.recipe(@item)
- for i in [email]1...@recipe.size[/email]
- kind = @recipe[i][0]
- id = @recipe[i][1]
- num = @recipe[i][2]
- if kind == "I"
- item = $data_items[id]
- elsif kind == "W"
- item = $data_weapons[id]
- elsif kind == "A"
- item = $data_armors[id]
- end
- if num > 0
- max_buf = $game_party.item_number(item)/num
- else
- max_buf = 999
- end
- max = [max, max_buf].min
- end
-
- buying_price == 0 ? max : [max, money / buying_price].min
- end
- #--------------------------------------------------------------------------
- # ● 所持金の取得
- #--------------------------------------------------------------------------
- def money
- @gold_window.value
- end
- #--------------------------------------------------------------------------
- # ● 通貨単位の取得
- #--------------------------------------------------------------------------
- def currency_unit
- @gold_window.currency_unit
- end
- #--------------------------------------------------------------------------
- # ● 合成費用の取得
- #--------------------------------------------------------------------------
- def buying_price
- @list_window.price(@item)
- end
- end
- #==============================================================================
- # ■ Window_ItemSynthesisList
- #------------------------------------------------------------------------------
- # 合成畫面で、合成可能なアイテムの一覧を表示するウィンドウです。
- #==============================================================================
- class Window_ItemSynthesisList < Window_Selectable
- include WD_itemsynthesis
- #--------------------------------------------------------------------------
- # ● 公開インスタンス変數
- #--------------------------------------------------------------------------
- attr_reader :status_window # ステータスウィンドウ
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize(x, y, height)
- super(x, y, window_width, height)
-
- @shop_goods = []
- @shop_recipes = []
-
- for i in 1..WD_itemsynthesis_ini::I_recipe.size
- recipe = WD_itemsynthesis_ini::I_recipe[i]
- if recipe
- good = [0, i, recipe[0]]
- if i_recipe_switch_on?(i)
- @shop_goods.push(good)
- @shop_recipes.push(recipe)
- end
- end
- end
- for i in 1..WD_itemsynthesis_ini::W_recipe.size
- recipe = WD_itemsynthesis_ini::W_recipe[i]
- if recipe
- good = [1, i, recipe[0]]
- if w_recipe_switch_on?(i)
- @shop_goods.push(good)
- @shop_recipes.push(recipe)
- end
- end
- end
- for i in 1..WD_itemsynthesis_ini::A_recipe.size
- recipe = WD_itemsynthesis_ini::A_recipe[i]
- if recipe
- good = [2, i, recipe[0]]
- if a_recipe_switch_on?(i)
- @shop_goods.push(good)
- @shop_recipes.push(recipe)
- end
- end
- end
-
- [url=home.php?mod=space&uid=26101]@Money[/url] = 0
- refresh
- select(0)
- end
- #--------------------------------------------------------------------------
- # ● ウィンドウ幅の取得
- #--------------------------------------------------------------------------
- def window_width
- return 304
- end
- #--------------------------------------------------------------------------
- # ● 項目數の取得
- #--------------------------------------------------------------------------
- def item_max
- @data ? @data.size : 1
- end
- #--------------------------------------------------------------------------
- # ● アイテムの取得
- #--------------------------------------------------------------------------
- def item
- @data[index]
- end
- #--------------------------------------------------------------------------
- # ● 所持金の設定
- #--------------------------------------------------------------------------
- def money=(money)
- @money = money
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 選択項目の有効狀態を取得
- #--------------------------------------------------------------------------
- def current_item_enabled?
- enable?(@data[index])
- end
- #--------------------------------------------------------------------------
- # ● 合成費用を取得
- #--------------------------------------------------------------------------
- def price(item)
- @price[item]
- end
- #--------------------------------------------------------------------------
- # ● 合成可否を取得
- #--------------------------------------------------------------------------
- def enable?(item)
- @makable[item]
- end
- #--------------------------------------------------------------------------
- # ● レシピを取得
- #--------------------------------------------------------------------------
- def recipe(item)
- @recipe[item]
- end
- #--------------------------------------------------------------------------
- # ● アイテムを許可狀態で表示するかどうか
- #--------------------------------------------------------------------------
- def have_mat?(recipe)
- flag = true
- if @money >= recipe[0]
- for i in 1...recipe.size
- kind = recipe[i][0]
- id = recipe[i][1]
- num = recipe[i][2]
- if kind == "I"
- item = $data_items[id]
- elsif kind == "W"
- item = $data_weapons[id]
- elsif kind == "A"
- item = $data_armors[id]
- end
- if $game_party.item_number(item) < [num, 1].max
- flag = false
- end
- end
- else
- flag = false
- end
- return flag
- end
- #--------------------------------------------------------------------------
- # ● カテゴリの設定
- #--------------------------------------------------------------------------
- def category=(category)
- return if @category == category
- @category = category
- refresh
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- make_item_list
- create_contents
- draw_all_items
- end
- #--------------------------------------------------------------------------
- # ● アイテムをリストに含めるかどうか
- #--------------------------------------------------------------------------
- def include?(item)
- case @category
- when :item
- item.is_a?(RPG::Item) && !item.key_item?
- when :weapon
- item.is_a?(RPG::Weapon)
- when :armor
- item.is_a?(RPG::Armor)
- when :key_item
- item.is_a?(RPG::Item) && item.key_item?
- else
- false
- end
- end
- #--------------------------------------------------------------------------
- # ● アイテムリストの作成
- #--------------------------------------------------------------------------
- def make_item_list
- @data = []
- @price = {}
- @makable = {}
- @recipe = {}
- for i in [email]0...@shop_goods.size[/email]
- goods = @shop_goods[i]
- recipe = @shop_recipes[i]
- case goods[0]
- when 0; item = $data_items[goods[1]]
- when 1; item = $data_weapons[goods[1]]
- when 2; item = $data_armors[goods[1]]
- end
- if item
- if include?(item)
- @data.push(item)
- @price[item] = goods[2]
- @makable[item] = have_mat?(recipe) && $game_party.item_number(item) < $game_party.max_item_number(item)
- @recipe[item] = recipe
- end
- end
- end
- end
- #--------------------------------------------------------------------------
- # ● 項目の描畫
- #--------------------------------------------------------------------------
- def draw_item(index)
- item = @data[index]
- rect = item_rect(index)
- draw_item_name(item, rect.x, rect.y, enable?(item))
- rect.width -= 4
- draw_text(rect, price(item), 2) if WD_itemsynthesis_ini::Cost_view
- end
- #--------------------------------------------------------------------------
- # ● ステータスウィンドウの設定
- #--------------------------------------------------------------------------
- def status_window=(status_window)
- @status_window = status_window
- call_update_help
- end
- #--------------------------------------------------------------------------
- # ● 素材ウィンドウの設定
- #--------------------------------------------------------------------------
- def material_window=(material_window)
- @material_window = material_window
- call_update_help
- end
- #--------------------------------------------------------------------------
- # ● ヘルプテキスト更新
- #--------------------------------------------------------------------------
- def update_help
- @help_window.set_item(item) if @help_window
- @status_window.item = item if @status_window
- @material_window.set(item, recipe(item)) if @material_window
- end
- #--------------------------------------------------------------------------
- # ● Z ボタン(表示切替)が押されたときの處理
- #--------------------------------------------------------------------------
- def process_change_window
- Sound.play_cursor
- Input.update
- call_handler(:change_window)
- end
- #--------------------------------------------------------------------------
- # ● 決定やキャンセルなどのハンドリング處理
- #--------------------------------------------------------------------------
- def process_handling
- super
- if active
- return process_change_window if handle?(:change_window) && Input.trigger?(:Z)
- # return process_change_window if handle?(:change_window) && Input.trigger?(:Z)
- end
- end
- end
- #==============================================================================
- # ■ Window_ItemSynthesisMaterial
- #------------------------------------------------------------------------------
- # 合成畫面で、合成に必要な素材を表示するウィンドウです。
- #==============================================================================
- class Window_ItemSynthesisMaterial < Window_Base
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize(x, y, width, height)
- super(x, y, width, height)
- @item = nil
- refresh
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- draw_possession(4, 0)
- draw_material_info(0, line_height * 2)
- end
- #--------------------------------------------------------------------------
- # ● アイテムの設定
- #--------------------------------------------------------------------------
- def set(item, recipe)
- @item = item
- @recipe = recipe
- @make_number = 1
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 作成個數の設定
- #--------------------------------------------------------------------------
- def set_num(make_number)
- @make_number = make_number
- refresh
- end
- #--------------------------------------------------------------------------
- # ● 所持數の描畫
- #--------------------------------------------------------------------------
- def draw_possession(x, y)
- rect = Rect.new(x, y, contents.width - 4 - x, line_height)
- change_color(system_color)
- draw_text(rect, Vocab::Possession)
- change_color(normal_color)
- draw_text(rect, $game_party.item_number(@item), 2)
- end
- #--------------------------------------------------------------------------
- # ● 素材情報の描畫
- #--------------------------------------------------------------------------
- def draw_material_info(x, y)
- rect = Rect.new(x, y, contents.width, line_height)
- change_color(system_color)
- contents.font.size = 18
- draw_text(rect, "必要素材", 0)
- if @recipe
- for i in [email]1...@recipe.size[/email]
- kind = @recipe[i][0]
- id = @recipe[i][1]
- num = @recipe[i][2]
- if kind == "I"
- item = $data_items[id]
- elsif kind == "W"
- item = $data_weapons[id]
- elsif kind == "A"
- item = $data_armors[id]
- end
- rect = Rect.new(x, y + line_height*i, contents.width, line_height)
- enabled = true
- enabled = false if [num*@make_number, 1].max > $game_party.item_number(item)
- draw_item_name(item, rect.x, rect.y, enabled)
- change_color(normal_color, enabled)
- if num > 0
- draw_text(rect, "#{num*@make_number}/#{$game_party.item_number(item)}", 2)
- end
- end
- end
- change_color(normal_color)
- contents.font.size = 24
- end
- end
- #==============================================================================
- # ■ Window_ItemSynthesisNumber
- #------------------------------------------------------------------------------
- # 合成畫面で、合成するアイテムの個數を入力するウィンドウです。
- #==============================================================================
- class Window_ItemSynthesisNumber < Window_ShopNumber
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- draw_item_name(@item, 0, item_y)
- draw_number
- draw_total_price if WD_itemsynthesis_ini::Cost_view
- end
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def material_window=(material_window)
- @material_window = material_window
- call_update_help
- end
- #--------------------------------------------------------------------------
- # ● 作成個數の変更
- #--------------------------------------------------------------------------
- def change_number(amount)
- @number = [[@number + amount, @max].min, 1].max
- call_update_help #追加
- end
- #--------------------------------------------------------------------------
- # ● ヘルプテキスト更新
- #--------------------------------------------------------------------------
- def call_update_help
- @material_window.set_num(@number) if @material_window
- end
- #--------------------------------------------------------------------------
- # ● Z ボタン(表示切替)が押されたときの處理
- #--------------------------------------------------------------------------
- def process_change_window
- Sound.play_cursor
- Input.update
- call_handler(:change_window)
- end
- #--------------------------------------------------------------------------
- # ● 決定やキャンセルなどのハンドリング處理
- #--------------------------------------------------------------------------
- def process_handling
- super
- if active
- return process_change_window if handle?(:change_window) && Input.trigger?(:Z)
- # return process_change_window if handle?(:change_window) && Input.trigger?(:Z)
- end
- end
- end
- #==============================================================================
- # ■ Window_ItemSynthesisCategory
- #------------------------------------------------------------------------------
- # 合成畫面で、通常アイテムや裝備品の分類を選択するウィンドウです。
- #==============================================================================
- class Window_ItemSynthesisCategory < Window_ItemCategory
- #--------------------------------------------------------------------------
- # ● 桁數の取得
- #--------------------------------------------------------------------------
- def col_max
- i = 0
- i += 1 if WD_itemsynthesis_ini::Category_i
- i += 1 if WD_itemsynthesis_ini::Category_w
- i += 1 if WD_itemsynthesis_ini::Category_a
- i += 1 if WD_itemsynthesis_ini::Category_k
- return i
- end
- #--------------------------------------------------------------------------
- # ● コマンドリストの作成
- #--------------------------------------------------------------------------
- def make_command_list
- add_command(Vocab::item, :item) if WD_itemsynthesis_ini::Category_i
- add_command(Vocab::weapon, :weapon) if WD_itemsynthesis_ini::Category_w
- add_command(Vocab::armor, :armor) if WD_itemsynthesis_ini::Category_a
- add_command(Vocab::key_item, :key_item) if WD_itemsynthesis_ini::Category_k
- end
- end
- #==============================================================================
- # ■ Window_ItemSynthesisNumber
- #------------------------------------------------------------------------------
- # 合成畫面で、切替を表示するウィンドウです。
- #==============================================================================
- class Window_ItemSynthesisChange < Window_Base
- #--------------------------------------------------------------------------
- # ● オブジェクト初期化
- #--------------------------------------------------------------------------
- def initialize(x, y, width, height)
- super(x, y, width, height)
- refresh
- end
- #--------------------------------------------------------------------------
- # ● リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- contents.clear
- text = "素材 ⇔ 合成物品 切換"
- draw_text(0, 0, contents_width, line_height, text, 1)
- end
- end
复制代码
这个是商店显示机能扩张的脚本
点击展开/收起- #******************************************************************************
- #
- # * <拡張> ショップステータス
- #
- # --------------------------------------------------------------------------
- # バージョン : 1.0.0
- # 対 応 : RPGツクールVX Ace : RGSS3
- # 制 作 者 : CACAO
- # 配 布 元 : [url]http://cacaosoft.web.fc2.com/[/url]
- # --------------------------------------------------------------------------
- # == 概 要 ==
- #
- # : ショップ画面で回復量やパラメータの変化量を表示します。
- #
- # --------------------------------------------------------------------------
- # == 注意事項 ==
- #
- # ※ エイリアスを用いない再定義を多用しています。
- # なるべく上の方に導入してください。
- #
- #
- #******************************************************************************
- #==============================================================================
- # ◆ 設定項目
- #==============================================================================
- module CAO
- module ShopStatus
- #--------------------------------------------------------------------------
- # ◇ 効果範囲を表示する
- #--------------------------------------------------------------------------
- SHOW_EFFECT_SCOPE = true
- #--------------------------------------------------------------------------
- # ◇ 戦闘中使用を表示する
- #--------------------------------------------------------------------------
- SHOW_USABLE_OCCASION = true
-
- #--------------------------------------------------------------------------
- # ◇ HP・MP回復量を表示する
- #--------------------------------------------------------------------------
- SHOW_ITEM_EFFECTS = true
- #--------------------------------------------------------------------------
- # ◇ TP増加量を表示する
- #--------------------------------------------------------------------------
- SHOW_GAIN_TP = true
-
- #--------------------------------------------------------------------------
- # ◇ ステート変化を表示する
- #--------------------------------------------------------------------------
- SHOW_STATES = true
- #--------------------------------------------------------------------------
- # ◇ 付加ステートも表示する
- #--------------------------------------------------------------------------
- SHOW_ADD_STATES = true
- #--------------------------------------------------------------------------
- # ◇ 解除ステートの上に描画するアイコン
- #--------------------------------------------------------------------------
- ICON_REMOVE_STATES = 141
- #--------------------------------------------------------------------------
- # ◇ 付加ステートの上に描画するアイコン
- #--------------------------------------------------------------------------
- ICON_ADD_STATES = 142
-
- #--------------------------------------------------------------------------
- # ◇ 装備品時に表示するパラメータ
- #--------------------------------------------------------------------------
- PARAMS = [:mhp, :mmp, :atk, :def, :mat, :mdf, :agi, :luk]
- #--------------------------------------------------------------------------
- # ◇ 装備可能なアクターのみ表示
- #--------------------------------------------------------------------------
- SHOW_EQUIPPABLE_ACTOR = false
- #--------------------------------------------------------------------------
- # ◇ 装備可能なアクターのパラメータのみ表示
- #--------------------------------------------------------------------------
- SHOW_EQUIPPABLE_PARAMS = true
- #--------------------------------------------------------------------------
- # ◇ 装備中マークの設定
- #--------------------------------------------------------------------------
- ICON_EQUIPPED_MARK = ["E", 14]
- #--------------------------------------------------------------------------
- # ◇ 装備中マークをアクターに重ねる
- #--------------------------------------------------------------------------
- ON_EQUIPPED_MARK = true
-
- #--------------------------------------------------------------------------
- # ◇ テキスト
- #--------------------------------------------------------------------------
- VOCAB_EFFECT_SCOPE = ["效果範圍", "無", "單人", "複數隨機", "全體"]
- VOCAB_USABLE_OCCASION =
- ["使用限制", "時常", "戰鬥中", "選單中", "不能使用"]
- VOCAB_EFFECT_HP = "HP恢復量"
- VOCAB_EFFECT_MP = "MP恢復量"
- VOCAB_EFFECT_TP = "TP增加量"
- VOCAB_CHANGE_STATE = "附加/解除狀態"
-
- VOCAB_RATE_UNIT = "%"
- VOCAB_POINT_UNIT = ""
-
- VOCAB_PARAMS = {}
- VOCAB_PARAMS[:mhp] = "最大HP"
- VOCAB_PARAMS[:mmp] = "最大MP"
- VOCAB_PARAMS[:atk] = "攻擊力"
- VOCAB_PARAMS[:def] = "防禦力"
- VOCAB_PARAMS[:mat] = "魔法攻撃"
- VOCAB_PARAMS[:mdf] = "魔法防禦"
- VOCAB_PARAMS[:agi] = "敏捷力"
- VOCAB_PARAMS[:luk] = "幸運值"
- end # module ShopStatus
- end # module CAO
- #/////////////////////////////////////////////////////////////////////////////#
- # #
- # 下記のスクリプトを変更する必要はありません。 #
- # #
- #/////////////////////////////////////////////////////////////////////////////#
- class Game_Actor
- #--------------------------------------------------------------------------
- # ● 公開インスタンス変数
- #--------------------------------------------------------------------------
- attr_accessor :icon_index # アイコン インデックス
- #--------------------------------------------------------------------------
- # ● グラフィックの初期化
- #--------------------------------------------------------------------------
- alias cao_shopstatus_init_graphics init_graphics
- def init_graphics
- cao_shopstatus_init_graphics
- @icon_index = 0
- end
- end
- class Window_Base
- #--------------------------------------------------------------------------
- # ● 定数 (歩行アイコンの背景色)
- #--------------------------------------------------------------------------
- COLOR_AIB_1 = Color.new(0, 0, 0) # アイコンの縁の色
- COLOR_AIB_2 = Color.new(255, 255, 255) # アイコンの背景色
- #--------------------------------------------------------------------------
- # ● 歩行アイコンの描画
- # enabled : 有効フラグ。false のとき半透明で描画
- #--------------------------------------------------------------------------
- def draw_character_icon(character_name, character_index, x, y, enabled = true)
- self.contents.fill_rect(x, y, 24, 24, COLOR_AIB_1)
- self.contents.fill_rect(x + 1, y + 1, 22, 22, COLOR_AIB_2)
- if character_name
- bitmap = Cache.character(character_name)
- sign = character_name[/^[\!\$]./]
- if sign != nil and sign.include?('$')
- cw = bitmap.width / 3
- ch = bitmap.height / 4
- else
- cw = bitmap.width / 12
- ch = bitmap.height / 8
- end
- n = character_index
- src_rect = Rect.new((n%4*3+1)*cw, (n/4*4)*ch, 20, 20)
- src_rect.x += (cw - src_rect.width) / 2
- src_rect.y += (ch - src_rect.height) / 4
- opacity = (enabled ? 255 : translucent_alpha)
- self.contents.blt(x + 2, y + 2, bitmap, src_rect, opacity)
- end
- end
- end
- class Window_ShopStatus
- include CAO::ShopStatus
- #--------------------------------------------------------------------------
- # ○ リフレッシュ
- #--------------------------------------------------------------------------
- def refresh
- self.contents.clear
- return unless @item
- @param_y = 0 # 項目の描画位置
- draw_possession(4, 0)
- if @item.kind_of?(RPG::Item)
- @item_effects = {}
- @item.effects.each do |e|
- @item_effects[e.code] ||= []
- @item_effects[e.code] << e
- end
- draw_item_info(4, line_height * 1.5)
- elsif @item.kind_of?(RPG::EquipItem)
- draw_equip_info(4, line_height * 1.5 + 8)
- end
- end
- #--------------------------------------------------------------------------
- # ● アイテム情報の描画
- #--------------------------------------------------------------------------
- def draw_item_info(x, y)
- @param_y = y
- draw_item_scope(x, @param_y)
- draw_item_occasion(x, @param_y)
- @param_y += (line_height / 2) if SHOW_EFFECT_SCOPE || SHOW_USABLE_OCCASION
- draw_item_effects(x, @param_y)
- draw_item_states(x, @param_y)
- end
- #--------------------------------------------------------------------------
- # ● 効果範囲の描画
- #--------------------------------------------------------------------------
- def draw_item_scope(x, y)
- return unless SHOW_EFFECT_SCOPE
- dr = Rect.new(x, y, contents_width - 4 - x, line_height)
- change_color(system_color)
- draw_text(dr, VOCAB_EFFECT_SCOPE[0])
- change_color(normal_color)
- case @item.scope
- when 0
- draw_text(dr, VOCAB_EFFECT_SCOPE[1], 2)
- when 1,3,7,9,11
- draw_text(dr, VOCAB_EFFECT_SCOPE[2], 2)
- when 4,5,6
- draw_text(dr, VOCAB_EFFECT_SCOPE[3], 2)
- when 2,8,10
- draw_text(dr, VOCAB_EFFECT_SCOPE[4], 2)
- else
- raise "must not happen"
- end
- @param_y += line_height
- end
- #--------------------------------------------------------------------------
- # ● 使用可能時の描画
- #--------------------------------------------------------------------------
- def draw_item_occasion(x, y)
- return unless SHOW_USABLE_OCCASION
- dr = Rect.new(x, y, contents_width - 4 - x, line_height)
- change_color(system_color)
- draw_text(dr, VOCAB_USABLE_OCCASION[0])
- change_color(normal_color)
- draw_text(dr, VOCAB_USABLE_OCCASION[@item.occasion + 1], 2)
- @param_y += line_height
- end
- #--------------------------------------------------------------------------
- # ● HP・MP・TPの回復量の描画
- #--------------------------------------------------------------------------
- def draw_item_effects(x, y)
- return unless SHOW_ITEM_EFFECTS
- ehp = @item_effects[Game_Battler::EFFECT_RECOVER_HP]
- emp = @item_effects[Game_Battler::EFFECT_RECOVER_MP]
-
- dr = Rect.new(x, y, contents_width - 4 - x, line_height)
- change_color(system_color)
- draw_text(dr, VOCAB_EFFECT_HP)
- dr.y += line_height
- draw_text(dr, VOCAB_EFFECT_MP)
-
- dr.y = y
- change_color(normal_color)
- draw_text(dr, text_recovery_amount(ehp), 2)
- dr.y += line_height
- draw_text(dr, text_recovery_amount(emp), 2)
-
- if SHOW_GAIN_TP
- etp = @item_effects[Game_Battler::EFFECT_GAIN_TP]
- dr.y = y + line_height * 2
- change_color(system_color)
- draw_text(dr, VOCAB_EFFECT_TP)
- change_color(normal_color)
- text = "#{etp ? etp[0].value1.to_i : 0}#{VOCAB_RATE_UNIT}"
- draw_text(dr, text, 2)
- end
- @param_y = dr.y + line_height * 1.5
- end
- #--------------------------------------------------------------------------
- # ● HP・MP回復量をテキストで取得
- #--------------------------------------------------------------------------
- def text_recovery_amount(effects)
- if effects
- value1 = (effects[0].value1.to_f * 100).to_i
- value2 = effects[0].value2.to_i
- else
- value1 = 0
- value2 = 0
- end
- return "#{value2}#{VOCAB_POINT_UNIT}" if value1 == 0
- return "#{value1}#{VOCAB_RATE_UNIT}" if value2 == 0
- return "#{value1}#{VOCAB_RATE_UNIT} + #{value2}#{VOCAB_POINT_UNIT}"
- end
- #--------------------------------------------------------------------------
- # ● ステートの描画
- #--------------------------------------------------------------------------
- def draw_item_states(x, y)
- return unless SHOW_STATES
-
- change_color(system_color)
- draw_text(x, y, contents_width - 4 - x, line_height, VOCAB_CHANGE_STATE)
- x += (contents_width - 4 - x) % 24
- y += line_height
- erss = @item_effects[Game_Battler::EFFECT_REMOVE_STATE] || []
- draw_states_icon(x, y, erss, 0, ICON_REMOVE_STATES)
- eass = @item_effects[Game_Battler::EFFECT_ADD_STATE] || []
- draw_states_icon(x, y, eass, erss.size, ICON_ADD_STATES) if SHOW_ADD_STATES
- unless !erss.empty? || (SHOW_ADD_STATES && !eass.empty?)
- change_color(normal_color)
- draw_text(x, y, contents_width - 4 - x, line_height, "無")
- end
- icon_line_max = (contents_width - 4 - x) / 24 # 1行に表示できる数
- @param_y = y + line_height / 2
- @param_y += ((erss.size + eass.size) / icon_line_max + 1) * line_height
- end
- #--------------------------------------------------------------------------
- # ● ステートアイコンの描画
- # super_icon_index : 重ねるアイコンの番号
- #--------------------------------------------------------------------------
- def draw_states_icon(x, y, effects, index, super_icon_index)
- icon_line_max = (contents_width - 4 - x) / 24
- effects.each do |e|
- next if e.data_id == 0
- draw_state_icon(
- x + (index % icon_line_max) * 24,
- y + (index / icon_line_max) * line_height,
- $data_states[e.data_id].icon_index, super_icon_index)
- index += 1
- end
- end
- #--------------------------------------------------------------------------
- # ● ステートアイコンの描画
- # state_icon_index : ステートアイコンの番号
- # super_icon_index : 重ねるアイコンの番号
- #--------------------------------------------------------------------------
- def draw_state_icon(x, y, state_icon_index, super_icon_index)
- draw_icon(state_icon_index, x, y)
- case super_icon_index
- when nil
- return
- when String
- bitmap = Cache.system(super_icon_index)
- self.contents.blt(x, y, bitmap, bitmap.rect)
- else
- draw_icon(super_icon_index, x, y)
- end
- end
- #--------------------------------------------------------------------------
- # ● 能力強化/弱体化の描画
- #--------------------------------------------------------------------------
- def draw_item_buff(x, y)
- end
- def draw_item_buffs(x, y)
- end
- #--------------------------------------------------------------------------
- # ● 成長パラメータの描画
- #--------------------------------------------------------------------------
- def draw_item_grows(x, y)
- end
- end
- class Window_ShopStatus
- #--------------------------------------------------------------------------
- # ● 定数
- #--------------------------------------------------------------------------
- ACTOR_WIDTH = 36 # 各アクターの横幅
- PARAM_WIDTH_MAX = 96 # パラメータ名の最大横幅
- #--------------------------------------------------------------------------
- # ● 定数(IDへの変換用)
- #--------------------------------------------------------------------------
- PARAM_ID = [:mhp, :mmp, :atk, :def, :mat, :mdf, :agi, :luk, :hit]
- #--------------------------------------------------------------------------
- # ○ 装備情報を描画するアクターの配列
- #--------------------------------------------------------------------------
- def status_members
- if SHOW_EQUIPPABLE_ACTOR
- member = $game_party.members.select {|actor| actor.equippable?(@item) }
- return member[@page_index * page_size, page_size]
- else
- return $game_party.members[@page_index * page_size, page_size]
- end
- end
- #--------------------------------------------------------------------------
- # ○ アイテムの設定
- #--------------------------------------------------------------------------
- def item=(item)
- @page_index = 0 if SHOW_EQUIPPABLE_ACTOR
- @item = item
- refresh
- end
- #--------------------------------------------------------------------------
- # ○ 一度に表示できるアクターの人数
- #--------------------------------------------------------------------------
- def page_size
- [4, (contents_width - PARAM_WIDTH_MAX) / ACTOR_WIDTH].max
- end
- #--------------------------------------------------------------------------
- # ○ 最大ページ数の取得
- #--------------------------------------------------------------------------
- def page_max
- if SHOW_EQUIPPABLE_ACTOR
- member = $game_party.members.select {|actor| actor.equippable?(@item) }
- return (member.size + page_size - 1) / page_size
- else
- return ($game_party.members.size + page_size - 1) / page_size
- end
- end
- #--------------------------------------------------------------------------
- # ●
- #--------------------------------------------------------------------------
- def actor_icon_margin
- return (ACTOR_WIDTH - 24) / 2
- end
- #--------------------------------------------------------------------------
- # ● パラメータ名の横幅
- #--------------------------------------------------------------------------
- def param_width
- return [PARAM_WIDTH_MAX, contents_width - page_size * ACTOR_WIDTH].min
- end
- #--------------------------------------------------------------------------
- # ○ 装備情報の描画
- #--------------------------------------------------------------------------
- def draw_equip_info(x, y)
- icon_y = y
- param_y = y + line_height * 1.5
- unless ON_EQUIPPED_MARK
- icon_y += line_height
- param_y += line_height
- end
- draw_parameters_name(x, param_y)
- x = param_width
- status_members.each_with_index do |actor, i|
- draw_actor_icon(x + actor_icon_margin, y, actor)
- draw_actor_equipped_mark(x, icon_y, actor)
- draw_actor_equip_info(x, param_y, actor)
- x += ACTOR_WIDTH
- end
- end
- #--------------------------------------------------------------------------
- # ● パラメータ名の描画
- #--------------------------------------------------------------------------
- def draw_parameters_name(x, y)
- width = param_width
- change_color(system_color)
- PARAMS.each_with_index do |param, i|
- draw_text(x, y, width, line_height, VOCAB_PARAMS[param])
- y += line_height
- end
- end
- #--------------------------------------------------------------------------
- # ● アクターアイコンの描画
- #--------------------------------------------------------------------------
- def draw_actor_icon(x, y, actor)
- enabled = actor.equippable?(@item)
- if actor.icon_index > 0
- bitmap = Cache.system("ActorIconSet")
- rect = Rect.new(actor.icon_index%16*24, actor.icon_index/16*24, 24, 24)
- self.contents.blt(x, y, bitmap, rect, enabled ? 255 : translucent_alpha)
- else
- draw_character_icon(
- actor.character_name, actor.character_index, x, y, enabled)
- end
- end
- #--------------------------------------------------------------------------
- # ● 装備中マークの描画
- #--------------------------------------------------------------------------
- def draw_actor_equipped_mark(x, y, actor)
- return unless actor.equips.include?(@item)
- case ICON_EQUIPPED_MARK
- when nil
- return
- when String
- x += actor_icon_margin
- bitmap = Cache.system(ICON_EQUIPPED_MARK)
- self.contents.blt(x, y, bitmap, bitmap.rect)
- when Integer
- x += actor_icon_margin
- draw_icon(ICON_EQUIPPED_MARK, x, y)
- when Array
- change_color(text_color(ICON_EQUIPPED_MARK[1]))
- if ON_EQUIPPED_MARK
- self.contents.font.size = 16
- draw_text(x, y + 12, ACTOR_WIDTH, 16, ICON_EQUIPPED_MARK[0], 2)
- self.contents.font.size = Font.default_size
- else
- draw_text(x, y + 4, ACTOR_WIDTH, line_height, ICON_EQUIPPED_MARK[0], 1)
- end
- end
- end
- #--------------------------------------------------------------------------
- # ○ アクターの装備情報の描画
- #--------------------------------------------------------------------------
- def draw_actor_equip_info(x, y, actor)
- enabled = actor.equippable?(@item)
- change_color(normal_color, enabled)
- item1 = current_equipped_item(actor, @item.etype_id)
- if !SHOW_EQUIPPABLE_PARAMS || enabled
- draw_actor_param_change(x, y, actor, item1)
- end
- end
- #--------------------------------------------------------------------------
- # ○ アクターの能力値変化の描画
- #--------------------------------------------------------------------------
- def draw_actor_param_change(x, y, actor, item1)
- self.contents.font.size = 18
- rect = Rect.new(x, y, ACTOR_WIDTH, line_height)
- if actor.equippable?(@item)
- PARAMS.each_with_index do |param,i|
- param_id = PARAM_ID.index(param)
- change = @item.params[param_id] - (item1 ? item1.params[param_id] : 0)
- change_color(param_change_color(change))
- rect.y = y + line_height * i
- draw_text(rect, (change.zero? ? "-" : sprintf("%+d", change)), 1)
- end
- else
- change_color(normal_color, false)
- PARAMS.size.times do |i|
- rect.y = y + line_height * i
- draw_text(rect, "-", 1)
- end
- end
- self.contents.font.size = Font.default_size
- end
- end
复制代码
想请问有方法能整合两个脚本吗?
我想"商店显示机能扩张"这个脚本也能套用在"合成系统介面"脚本中 求各位大神帮忙 |
|