#============================================================================== # ■装備品個別管理(倉庫内蔵型) for RGSS3 Ver5.04-α # □作成者 kure # # 倉庫画面呼び出し方法  SceneManager.call(Scene_Storage) # #=============================================================================== $kure_integrate_script = {} if $kure_integrate_script == nil $kure_integrate_script[:SortOut] = 5000 p "装備品個別管理" #-------------------------------------------------------------------------- # ★ 設定項目(各設定の値を変更してください) #-------------------------------------------------------------------------- module KURE module SortOut #基本設定------------------------------------------------------------------- #ID管理用変数(通常この値は変更しません) ID_BASE = 10000 #獲得アイテムログ最大数 MAX_ITEM_LOG = 30 #能力付与に関する項目------------------------------------------------------- #シンボル関連の設定-------------------------------------------------------- #シンボル能力付与の機能仕様の設定(0=OFF、1=ON) USE_SYMBOL = 1 #スロット関連の設定-------------------------------------------------------- #スロット装備システムの機能使用の設定(0=OFF、1=ON) USE_SLOT_EQUIP = 1 #スロット数の設定の反映方法(0=設定数を反映 1=設定数を上限としてランダム) SLOT_NUM_MODE = 0 #耐久値関連の設定----------------------------------------------------------- #耐久値機能使用の設定(0=OFF、1=ON) USE_DURABLE = 1 #破壊したアイテムの設定(0=以下の設定を適用 1=消滅) BROKEN_SETTING = 0 #BROKEN_SETTING = 0の時の処理設定----------------------------------------- #破損中のアイテムにつく名前 BROKEN_ITEM_NAME = "[壊]" #能力下降設定 #破損時の装備能力発揮率(%指定) BROKEN_PERFORM = 30 #特徴反映設定(0=反映される 1=反映されない) BROKEN_FEATURE = 0 #装備可能設定(0=装備可能 1=装備不可) BROKEN_CAN_EQUIP = 0 #破損中装備の価格設定(0=通常通り 1=2になる) BROKEN_PRICE = 1 #倉庫画面用用語------------------------------------------------------------- Vocab_SlotList = "装備スロットリスト" #装備スロットリスト Vocab_Symbollist = "装備シンボルリスト" #装備シンボルリスト end end #メモ欄の取得に関するスクリプト処理群------------------------------------------- module KURE #-------------------------------------------------------------------------- # ☆ 数値配列に畳む(追加定義) #-------------------------------------------------------------------------- def self.arr_num_slice(arr) result_arr = Array.new unless arr == [] and arr.empty? arr.flatten! arr.each{|value| value.scan(/\d+/).each { |num| result_arr.push(num.to_i)}} end return result_arr end end #============================================================================== # ■ RPG::BaseItem #============================================================================== class RPG::BaseItem #-------------------------------------------------------------------------- # ★基本設定の呼び出し #-------------------------------------------------------------------------- def identify_id ; return 0 ;end #固有ID def custom_num ; return 0 ;end #強化値 def symbol_list ; return [] ;end #シンボル def career_list ; return [] ;end #キャリア(テスト) def prise ; return 0 ;end #合成費用 #アイテム基本設定関連処理-------------------------------------------------- #-------------------------------------------------------------------------- # ◆ 値段倍率の定義(追加定義) #-------------------------------------------------------------------------- def price_rate @note.match(/<価格補正\s?(\d+)%\s?>/) return $1 ? ($1.to_f / 100) : 1 end #倉庫用設定---------------------------------------------------------------- #-------------------------------------------------------------------------- # ◆ 倉庫最大保有量の定義(追加定義) #-------------------------------------------------------------------------- def storage_max @note.match(/<最大保有量\s?(\d+)\s?>/) return $1 ? $1.to_i : 99 end #エンチャント設定(装備合成用)---------------------------------------------- #-------------------------------------------------------------------------- # ◆ エンチャントアイテムの取得 #-------------------------------------------------------------------------- def enchant_item? ; @note.include?("<エンチャント品>") ; end #-------------------------------------------------------------------------- # ◆ 合成不可アイテムの取得 #-------------------------------------------------------------------------- def convert_item_main? ; !@note.include?("<主合成不可>") ; end #-------------------------------------------------------------------------- # ◆ 合成不可アイテムの取得 #-------------------------------------------------------------------------- def convert_item_sub? ; !@note.include?("<副合成不可>") ; end #-------------------------------------------------------------------------- # ◆ シンボル復元アイテムの取得 #-------------------------------------------------------------------------- def restore_symbol? ; @note.include?("<初期シンボル復元>") ;end #-------------------------------------------------------------------------- # ◆ 継承処理の必要性を判定 #-------------------------------------------------------------------------- def need_succeed_process? return false if succeed_symbol == [] && restore_symbol? == false return true end #-------------------------------------------------------------------------- # ◆ 追加シンボル数取得 #-------------------------------------------------------------------------- def add_symbol_num @note.match(/<追加シンボル数\s?(\d+)\s?>/) return $1 ? $1.to_i : 0 end #-------------------------------------------------------------------------- # ◆ 追加シンボル数取得 #-------------------------------------------------------------------------- def add_slot_num @note.match(/<追加スロット数\s?(\d+)\s?>/) return $1 ? $1.to_i : 0 end #初期設定関連処理---------------------------------------------------------- #-------------------------------------------------------------------------- # ◆ ランダム強化値付与の定義 #-------------------------------------------------------------------------- def random_customize @note.match(/<初期最大強化値\s?(\d+)\s?>/) return $1 ? $1.to_i : 0 end #-------------------------------------------------------------------------- # ● 継承シンボルの定義(追加定義) #-------------------------------------------------------------------------- def succeed_symbol KURE.arr_num_slice(@note.scan(/<シンボル\s?(\d+(?:\s?*,\s?*\d+)*)>/)) end #-------------------------------------------------------------------------- # ◆ ランダムに付与されるシンボル #-------------------------------------------------------------------------- def rand_symbol @note.match(/<ランダムシンボル\s?(\d+)\s?,\s?(\d+)\s?>/) return $1 && $2 ? [$1.to_i, $2.to_i] : nil end #-------------------------------------------------------------------------- # ◆ ランダムに付与されるシンボルのリスト #-------------------------------------------------------------------------- def rand_symbol_list arr = [] #未設定は空配列を返す return [] unless rand_symbol #リストが存在しない場合も空配列を返す data = KURE::SortOut::SYMBOL_LIST[rand_symbol[0]] return [] unless data #レート計算 rate = data.inject(0){|sum, block| sum + block[1]} #付与処理 rand_symbol[1].times{ #判定項目の決定 dice = rand(rate) data.each{|block| dice -= block[1] next if dice > 0 arr.push(block[0]) break } } return arr end #-------------------------------------------------------------------------- # ◆ 初期シンボルの取得(追加定義)(装備合成用) #-------------------------------------------------------------------------- def first_symbol_list result = Array.new #継承シンボルの読み込み succeed_symbol.each{|id| next unless KURE::SortOut::SYMBOL[id] case KURE::SortOut::SYMBOL[id][0] when "W" ; result.push([$data_weapons[KURE::SortOut::SYMBOL[id][1]],id]) when "A" ; result.push([$data_armors[KURE::SortOut::SYMBOL[id][1]],id]) when "J" ; result.push([$data_classes[KURE::SortOut::SYMBOL[id][1]],id]) when "S" ; result.push([$data_states[KURE::SortOut::SYMBOL[id][1]],id]) end } return result end #スロットシステム用処理---------------------------------------------------- #-------------------------------------------------------------------------- # ◆ スロット数の定義(追加定義) #-------------------------------------------------------------------------- def slot_number @note.match(/<スロット数\s?(\d+)\s?>/) return $1 ? $1.to_i : 0 end #-------------------------------------------------------------------------- # ◆ 拡張スロット最大数の定義(追加定義) #-------------------------------------------------------------------------- def add_max_slot_number @note.match(/<追加最大スロット数\s?(\d+)\s?>/) return $1 ? $1.to_i : 0 end #-------------------------------------------------------------------------- # ● スロット対応装備タイプの定義(追加定義) #-------------------------------------------------------------------------- def adopt_slot_type KURE.arr_num_slice(@note.scan(/<スロット対応装備タイプ\s?(\d+(?:\s?*,\s?*\d+)*)>/)) end #シンボルシステム用処理---------------------------------------------------- #-------------------------------------------------------------------------- # ◆ シンボル数の定義(追加定義) #-------------------------------------------------------------------------- def symbol_number @note.match(/<シンボル数\s?(\d+)\s?>/) return $1 ? $1.to_i : 5 end #-------------------------------------------------------------------------- # ◆ 拡張シンボル最大数の定義(追加定義) #-------------------------------------------------------------------------- def add_max_symbol_number @note.match(/<追加最大シンボル数\s?(\d+)\s?>/) return $1 ? $1.to_i : 0 end #キャリアシステム処理用---------------------------------------------------- #-------------------------------------------------------------------------- # ◆ シンボル数の定義(追加定義) #-------------------------------------------------------------------------- def career_number @note.match(/<キャリア数\s?(\d+)\s?>/) return $1 ? $1.to_i : 2 end #強化値関連システム処理---------------------------------------------------- #-------------------------------------------------------------------------- # ◇ 強化補正の定義(追加定義) #-------------------------------------------------------------------------- def add_plus_revise result = [0,0,0,0,0,0,0,0] cheak_note = @note while cheak_note do cheak_note.match(/<強化補正\s?(\d+)\s?,\s?([-]?\d+)\s?>/) result[$1.to_i] = $2.to_i if $1 && $2 cheak_note = $' end return result end #-------------------------------------------------------------------------- # ◇ 強化補正上限の定義(追加定義) #-------------------------------------------------------------------------- def add_plus_revise_limit result = [100,100,100,100,100,100,100,100] cheak_note = @note while cheak_note do cheak_note.match(/<強化補正上限\s?(\d+)\s?,\s?([-]?\d+)\s?>/) result[$1.to_i] = $2.to_i if $1 && $2 cheak_note = $' end return result end #-------------------------------------------------------------------------- # ◇ 強化上限の定義(追加定義) #-------------------------------------------------------------------------- def add_plus_limit @note.match(/<強化上限\s?(\d+)\s?>/) return $1 ? $1.to_i : 10 end #-------------------------------------------------------------------------- # ◇ 強化上限の定義(追加定義) #-------------------------------------------------------------------------- def add_plus_limit_convert @note.match(/<合成強化上限\s?(\d+)\s?>/) return $1 ? $1.to_i : 10 end #-------------------------------------------------------------------------- # ◆ 強化値減少無効の定義(追加定義) #-------------------------------------------------------------------------- def protect_custom ; return @note.include?("<強化値減少無効>") ; end #キャリアシステム用処理(テスト実装)---------------------------------------- #-------------------------------------------------------------------------- # ◆ キャリア数の定義(追加定義) #-------------------------------------------------------------------------- def career_number @note.match(/<キャリア数\s?(\d+)\s?>/) return $1 ? $1.to_i : 5 end #耐久値関連処理------------------------------------------------------------ #-------------------------------------------------------------------------- # ◆ 耐久値の定義(追加定義) #-------------------------------------------------------------------------- def first_durable @note.match(/<耐久値\s?(\d+)\s?>/) return $1 ? $1.to_i : 100 end #-------------------------------------------------------------------------- # ◆ 耐久値減少無効の定義(追加定義) #-------------------------------------------------------------------------- def protect_durable ; return @note.include?("<耐久値減少無効>") ; end end #============================================================================== # ■ RPG::Weapon #============================================================================== class RPG::Weapon < RPG::EquipItem attr_accessor :weapon_id #-------------------------------------------------------------------------- # ● 固有IDを設定する #-------------------------------------------------------------------------- def identify_id=(value) @weapon_id = value end #-------------------------------------------------------------------------- # ● 固有IDを取得(判定用) #-------------------------------------------------------------------------- def self.identify_id ; @weapon_id ; end #-------------------------------------------------------------------------- # ● 固有IDを取得 #-------------------------------------------------------------------------- def identify_id ; @weapon_id ; end #-------------------------------------------------------------------------- # ● 同ーオブジェクトか判定します。 #-------------------------------------------------------------------------- def equal?(obj) return false unless obj.is_a?(RPG::Weapon) return obj.id == id if obj.weapon_id == nil return obj.weapon_id == @weapon_id end end #============================================================================== # ■ RPG::Armor #============================================================================== class RPG::Armor < RPG::EquipItem attr_accessor :armor_id #-------------------------------------------------------------------------- # ● 固有IDを設定する #-------------------------------------------------------------------------- def identify_id=(value) @armor_id = value end #-------------------------------------------------------------------------- # ● 固有IDを取得(判定用) #-------------------------------------------------------------------------- def self.identify_id ; @armor_id ; end #-------------------------------------------------------------------------- # ● 固有IDを取得 #-------------------------------------------------------------------------- def identify_id ; @armor_id ; end #-------------------------------------------------------------------------- # ● 同ーオブジェクトか判定します。 #-------------------------------------------------------------------------- def equal?(obj) return false unless obj.is_a?(RPG::Armor) return obj.id == id if obj.armor_id == nil return obj.armor_id == @armor_id end end #============================================================================== # ■ RPG::EquipItem #============================================================================== class RPG::EquipItem < RPG::BaseItem attr_accessor :customize #強化値 attr_accessor :symbol #シンボル attr_accessor :durable_value #耐久値 #基幹処理------------------------------------------------------------------ #-------------------------------------------------------------------------- # ● 同一オブジェクトの作成 #-------------------------------------------------------------------------- def clone same_obj = super return same_obj end #-------------------------------------------------------------------------- # ● 装備品のidを返す #-------------------------------------------------------------------------- def id identify_id ? identify_id * KURE::SortOut::ID_BASE + @id : @id end #-------------------------------------------------------------------------- # ● 装備品データベースのidを返す #-------------------------------------------------------------------------- def database_id ; @id ;end #-------------------------------------------------------------------------- # ● 同一アイテムの判定処理 #-------------------------------------------------------------------------- def ==(obj) return equal?(obj) end #-------------------------------------------------------------------------- # ● アイテム名 #-------------------------------------------------------------------------- def name return @name unless identify_id set_name unless @view_name return @view_name end #-------------------------------------------------------------------------- # ● 能力値変化量の取得 #-------------------------------------------------------------------------- def params return @params unless identify_id set_basic_params unless @basic_params return @basic_params end #-------------------------------------------------------------------------- # ● 特徴の取得 #-------------------------------------------------------------------------- def features return [] if KURE::SortOut::BROKEN_FEATURE == 1 && @durable_value == -1 features = @features.clone features += @slot_feature if @slot_feature features += @symbol_feature if @symbol_feature return features end #初期設定処理-------------------------------------------------------------- #-------------------------------------------------------------------------- # ◆ 取得時初期の処理 #-------------------------------------------------------------------------- def first_setting(first_equip = nil) return if @first_seted common_setting #共通初期化処理 set_randamize #強化値、シンボル、スロットのランダムを反映 set_first_symbol #初期シンボルの付与 reset_name_random_params @first_seted = true #初期化処理通過フラグをONにする end #-------------------------------------------------------------------------- # ◆ 共通の初期化処理 #-------------------------------------------------------------------------- def common_setting #基本設定---------------------------------------------------------------- @base_note = @note.clone unless @base_note #オブジェクトのメモをコピー @base_price = @price #オブジェクトの価格をコピー @add_name_before = "" #シンボル語(前) @add_name_after = "" #シンボル語(後) @view_name = "" #表示名 @uniq_name = "" #固有名(設定した場合) #強化値関連初期化処理---------------------------------------------------- @customize = 0 #強化値 #強化パラメータ関連処理(暫定残留)---------------------------------------- @custom_param = [0,0,0,0,0,0,0,0] #強化パラーメータ #装備経験値関連処理(暫定残留)-------------------------------------------- @equip_exp = 0 #装備経験値 #シンボル関連初期化処理-------------------------------------------------- @symbol = [] #シンボル配列 @symbol_param = [0,0,0,0,0,0,0,0] #シンボル用強化パラメータ @symbol_feature = [] #シンボル用特徴配列 @symbol_note = '' #シンボル用メモ欄 @symbol_number = symbol_number #シンボル数 @add_symbol = 0 #追加されたシンボル数 #スロット関連初期化処理-------------------------------------------------- @slot = [] #スロット配列 @slot_param = [0,0,0,0,0,0,0,0] #スロット用強化パラメータ @slot_feature = [] #スロット用特徴配列 @slot_note = '' #スロット用メモ欄 @slot_number = slot_number #スロット数 @add_slot = 0 #追加されたスロット数 #キャリア関連初期化処理-------------------------------------------------- @carrer = [] #キャリア配列 @career_number = career_number #キャリア数 #耐久値関連初期化処理---------------------------------------------------- @durable_value = first_durable end #-------------------------------------------------------------------------- # ◆ 強化値とスロットのランダム付与 #-------------------------------------------------------------------------- def set_randamize #強化値とスロットの付与数ランダム化を適用 @customize = [rand(random_customize + 1), add_plus_limit].min @slot_number = rand(slot_number + 1) if KURE::SortOut::SLOT_NUM_MODE == 1 end #-------------------------------------------------------------------------- # ● 初期シンボルの付与 #-------------------------------------------------------------------------- def set_first_symbol #シンボル継承データを読み込む first_symbol = succeed_symbol + rand_symbol_list first_symbol.each{|id| #設定よりシンボルのデータを取得 data = KURE::SortOut::SYMBOL[id] next unless data #データにより出力オブジェクトを変更 case data[0] when "W" ; @symbol.push([ $data_weapons[data[1]], id, data[5] ]) #武器 when "A" ; @symbol.push([ $data_armors[data[1]], id, data[5] ]) #防具 when "J" ; @symbol.push([ $data_classes[data[1]], id, data[5] ]) #職業 when "S" ; @symbol.push([ $data_states[data[1]], id, data[5] ]) #ステート end } end #配列のID差分を取得する処理------------------------------------------------ #-------------------------------------------------------------------------- # ● ID配列の個数を含めた内包判定(arr1にarr2が個数を含め存在するか判定) #-------------------------------------------------------------------------- def include_arr?(arr1, arr2) #ID配列をコピーする temp = arr1.clone #arr2の配列を順番にチェックする arr2.each{|idd| #フラグを消去 flag = false next unless idd temp.each_with_index{|idc, index| next unless idc next unless idd == idc #値が存在すればフラグを立てて値を消す flag = true temp[index] = nil break } #フラグが立たない場合はfalseを返す return false unless flag } return true end #-------------------------------------------------------------------------- # ● ID配列の個数を含めた差を取得(arr1よりarr2を個数を換算して引く) #-------------------------------------------------------------------------- def diff(arr1, arr2) #ID配列をコピーする temp = arr1.clone arr2.each{|idd| temp.each_with_index{|idc, index| next unless idc next unless idd == idc temp[index] = nil break } } return temp.compact! end #能力更新関連処理---------------------------------------------------------- #-------------------------------------------------------------------------- # ◆ 能力更新処理 #-------------------------------------------------------------------------- def reset_name_random_params set_name_str #接頭語をセット set_symbol_param #シンボル用パラメータセット set_slot_param #スロット用パラメータセット set_note #メモ欄の更新 set_price #価格更新 set_basic_params #基礎能力値を更新 set_name #表示名を更新 @adv_feature_flag = nil #統合ベーススクリプト対応処理 end #-------------------------------------------------------------------------- # ● 接頭語の取得 #-------------------------------------------------------------------------- def set_name_str #IDの配列を取得 id_list = symbol_id_list #エクストラシンボル語を判定する KURE::SortOut::EXTRA_SYMBOL_TEXT.each{|data| next unless data extra_id = data[1] #ID配列を全て含むかを判定 next unless include_arr?(id_list, extra_id) #配列を含む場合はシンボル語を追加 @add_name_before += data[0][0] @add_name_after += data[0][1] #エクストラシンボル語設定で処理を変更 case KURE::SortOut::EXTRA_SYMBOL_TETX_MODE when 0 ; return when 1 ; id_list = diff(id_list, extra_id) end break } #シンボルID、個数の配列で取得 id_list = id_list.uniq.collect{|id| [id, id_list.count(id)]} #シンボル語表示モードによる切り替え case KURE::SortOut::SYMBOL_TETX_MODE when 1 #一番付与数が多いシンボル語を抽出 id_list = [id_list.sort_by! {|block| block[1] }.reverse[0]] end #ID毎にデータを取得 id_list.each{|block| next unless block block_id = block[0] data = KURE::SortOut::SYMBOL_TEXT[block_id] #データが存在しない(未設定)は飛ばす next unless data next if data == [] block_num = [ block[1] - 1, data.size - 1 ].min @add_name_before += data[block_num][0] @add_name_after += data[block_num][1] } end #-------------------------------------------------------------------------- # ● シンボル用パラメータの取得 #-------------------------------------------------------------------------- def set_symbol_param @symbol_param = [0,0,0,0,0,0,0,0] @symbol_feature = [] @symbol_note = '' @symbol.each{|symbol| #シンボルが存在しない場合 next unless symbol[0] #要求強化値を満たしていなければ反映しない next if symbol[2] > @customize @symbol_feature += symbol[0].features @symbol_note += symbol[0].note next unless symbol[0].is_a?(RPG::EquipItem) (0..7).each{|id| @symbol_param[id] += symbol[0].params[id]} } end #-------------------------------------------------------------------------- # ● スロット用パラメータの取得 #-------------------------------------------------------------------------- def set_slot_param @slot_param = [0,0,0,0,0,0,0,0] @slot_feature = [] @slot_note = '' @slot.each{|slot| next unless slot @slot_feature += slot.features @slot_note += slot.note (0..7).each{|id| @slot_param[id] += slot.params[id]} } end #-------------------------------------------------------------------------- # ◆ メモ欄の取得 #-------------------------------------------------------------------------- def set_note @slot_note ||= '' ; @symbol_note ||= '' ; @base_note ||= '' #反映しては困る設定を消去 #装備タイプ @slot_note.gsub!(/<装備タイプ\s?(\d+)\s?>/,'') @symbol_note.gsub!(/<装備タイプ\s?(\d+)\s?>/,'') #強化設定 @slot_note.gsub!(/<強化上限\s?(\d+)\s?>/,'') @symbol_note.gsub!(/<強化上限\s?(\d+)\s?>/,'') @slot_note.gsub!(/<合成強化上限\s?(\d+)\s?>/,'') @symbol_note.gsub!(/<合成強化上限\s?(\d+)\s?>/,'') @slot_note.gsub!(/<強化補正\s?(\d+)\s?,\s?([-]?\d+)\s?>/,'') @symbol_note.gsub!(/<強化補正\s?(\d+)\s?,\s?([-]?\d+)\s?>/,'') @slot_note.gsub!(/<強化補正上限\s?(\d+)\s?,\s?([-]?\d+)\s?>/,'') @symbol_note.gsub!(/<強化補正上限\s?(\d+)\s?,\s?([-]?\d+)\s?>/,'') #表示色 @slot_note.gsub!(/<表示色\s?(\d+)\s?>/,'') @symbol_note.gsub!(/<表示色\s?(\d+)\s?>/,'') @note = @base_note + @slot_note + @symbol_note end #-------------------------------------------------------------------------- # ● 価格 #-------------------------------------------------------------------------- def set_price price = 0 ; rate = 1 #シンボルオブジェクトの価格を読み込む @symbol.each{ |symbol| next unless symbol[0] next unless symbol[0].is_a?(RPG::EquipItem) price += symbol[0].price rate *= symbol[0].price_rate } @price = ((@base_price + price) * rate).to_i @price = 2 if KURE::SortOut::BROKEN_PRICE == 1 && broken? end #-------------------------------------------------------------------------- # ● 基礎能力値変化量の取得 #-------------------------------------------------------------------------- def set_basic_params @basic_params = @params.clone (0..7).each{|id| #強化値の付与(上限によって制限をかける) @basic_params[id] += [@customize * add_plus_revise[id], add_plus_revise_limit[id]].min @basic_params[id] += @symbol_param[id] #シンボル能力の付与 @basic_params[id] += @slot_param[id] #スロット能力の付与 @basic_params[id] += @custom_param[id] #カスタムの付与(設定を暫定で残留) #破損中は補正 if @basic_params[id] > 0 && broken? per = KURE::SortOut::BROKEN_PERFORM @basic_params[id] = (@basic_params[id] * (per.to_f / 100)).to_i end @basic_params[id] = @basic_params[id].to_i } end #-------------------------------------------------------------------------- # ● アイテム名をセット #-------------------------------------------------------------------------- def set_name @uniq_name ||= "" ; @view_name ||= "" break_name = broken? ? KURE::SortOut::BROKEN_ITEM_NAME : "" if @uniq_name == "" @view_name = break_name + @add_name_before + @name + @add_name_after if custom_num == 0 @view_name = break_name + @add_name_before + @name + @add_name_after + "+" + custom_num.to_s if custom_num != 0 else @view_name = break_name + @uniq_name if custom_num == 0 @view_name = break_name + @uniq_name + "+" + custom_num.to_s if custom_num != 0 end end #シンボル関連処理---------------------------------------------------------- #-------------------------------------------------------------------------- # ◆ データの取得 #-------------------------------------------------------------------------- def symbol_list ; @symbol ; end #本体 def symbol_id_list ; @symbol.collect{|data| data[1] } ; end #IDリスト def max_symbol_number ; @symbol_number + @add_symbol ; end #シンボル数(拡張後) #-------------------------------------------------------------------------- # ◆ シンボル数の拡張 #-------------------------------------------------------------------------- def gain_symbol_number @add_symbol = [@add_symbol + 1,add_max_symbol_number].min end #-------------------------------------------------------------------------- # ◆ シンボル拡張できるか #-------------------------------------------------------------------------- def gain_symbol? return @add_symbol < add_max_symbol_number end #-------------------------------------------------------------------------- # ◆ シンボルを追加する処理 #-------------------------------------------------------------------------- def set_symbol(id, limit) #idが未設定の場合は処理しない return unless id #シンボル制限を無視無い場合、付与できるかのチェックを行う return if limit && @symbol.size >= max_symbol_number #存在しないデータは付与しない。 data = KURE::SortOut::SYMBOL[id] return unless data case data[0] when "W" ; @symbol.push([ $data_weapons[data[1]], id, data[5] ]) #武器 when "A" ; @symbol.push([ $data_armors[data[1]], id, data[5] ]) #防具 when "J" ; @symbol.push([ $data_classes[data[1]], id, data[5] ]) #職業 when "S" ; @symbol.push([ $data_states[data[1]], id, data[5] ]) #ステート end reset_name_random_params end #-------------------------------------------------------------------------- # ◆ シンボルを削除する処理 #-------------------------------------------------------------------------- def delete_symbol(randmize, protect) #削除対象リストを作成 delete_id = [] #シンボル全てに対して判定を行う @symbol.each_with_index{|block, index| #初期シンボル保護の場合、対象シンボルは判定を外す next if protect && succeed_symbol.include?(block[1]) delete_id.push(index)} #対象のシンボルが存在しない場合、判定を抜ける return if delete_id == [] #削除用配列にランダムであればランダム化して配列を入れる delete = randmize ? delete_id.sort_by{rand} : delete_id #シンボルの削除を行ってデータを再構成する。 @symbol[delete[0]] = nil @symbol.compact! reset_name_random_params end #スロット関連処理---------------------------------------------------------- #-------------------------------------------------------------------------- # ◆ データの取得 #-------------------------------------------------------------------------- def slot_list ; @slot ; end #スロットのリスト def max_slot_number ; @slot_number + @add_slot ; end #スロット数(拡張後) #-------------------------------------------------------------------------- # ◆ スロット数の拡張 #-------------------------------------------------------------------------- def gain_slot_number @add_slot = [@add_slot + 1,add_max_slot_number].min end #-------------------------------------------------------------------------- # ◆ スロット拡張できるか #-------------------------------------------------------------------------- def gain_slot? return @add_slot < add_max_slot_number end #-------------------------------------------------------------------------- # ◆ スロットにアイテムを追加する処理 #-------------------------------------------------------------------------- def set_slot_value(slot, item) return if KURE::SortOut::USE_SLOT_EQUIP == 0 @slot ||= [] unless item @slot[slot] = nil reset_name_random_params return end return if slot - 1 >= max_slot_number return if item.identify_id == 0 etype = item.is_a?(RPG::Weapon) ? 1 : 2 case etype when 1 ; @slot[slot] = $game_party.set_weapon(item.id) when 2 ; @slot[slot] = $game_party.set_armor(item.id) end reset_name_random_params end #キャリア関連処理---------------------------------------------------------- #-------------------------------------------------------------------------- # ◆ データの取得 #-------------------------------------------------------------------------- def career_list ; @carrer ; end #キャリア def career_number ; @career_number ; end #キャリア数 #耐久値関連処理------------------------------------------------------------ #-------------------------------------------------------------------------- # ◆ 耐久値の取得 #-------------------------------------------------------------------------- def durable_value @durable_value ||= first_durable return @durable_value end #-------------------------------------------------------------------------- # ◆ 破損状態の取得 #-------------------------------------------------------------------------- def broken? return false unless @durable_value return true if @durable_value < 0 return false end #-------------------------------------------------------------------------- # ◆ 修復する #-------------------------------------------------------------------------- def recover_durable @durable_value = first_durable reset_name_random_params end #-------------------------------------------------------------------------- # ◆ 耐久値の増減 #-------------------------------------------------------------------------- def reduce_durable_value=(value) return if KURE::SortOut::USE_DURABLE == 0 return if protect_durable && value > 0 @durable_value ||= first_durable @durable_value -= value @durable_value = first_durable if @durable_value > first_durable if @durable_value < 1 @durable_value = -1 reset_name_random_params end end #メモ欄操作処理------------------------------------------------------------- #-------------------------------------------------------------------------- # ◆ 本体のメモ欄の取得 #-------------------------------------------------------------------------- def base_note @base_note ||= '' return @base_note end #-------------------------------------------------------------------------- # ◆ 本体のメモ欄を更新 #-------------------------------------------------------------------------- def add_txt(str) @base_note += str reset_name_random_params end #アイテム名関連処理-------------------------------------------------------- #-------------------------------------------------------------------------- # ◆ 個別の名前を設定 #-------------------------------------------------------------------------- def set_uniq_name(str) @uniq_name ||= "" @uniq_name = str set_name end #強化値関連処理------------------------------------------------------------ #-------------------------------------------------------------------------- # ● カスタム数取得 #-------------------------------------------------------------------------- def custom_num ; @customize ; end #-------------------------------------------------------------------------- # ◆ 強化値の増減 #-------------------------------------------------------------------------- def custom_value(value) return if value < 0 && protect_custom @customize = [@customize + value, add_plus_limit].min if value > 0 @customize = [@customize + value, 0].max if value < 0 reset_name_random_params end #強化パラメータ関連処理(処理を一応残す)------------------------------------ #-------------------------------------------------------------------------- # ● カスタム配列の取得 #-------------------------------------------------------------------------- def custom_param @custom_param ||= [0,0,0,0,0,0,0,0] return @custom_param end #-------------------------------------------------------------------------- # ◆ カスタムステータスの増減 #-------------------------------------------------------------------------- def custom_status(param, value) @custom_param ||= [0,0,0,0,0,0,0,0] @custom_param[param] += value reset_name_random_params end #装備経験値用処理(処理を一応残す) #-------------------------------------------------------------------------- # ● 経験値 #-------------------------------------------------------------------------- def equip_exp ; @equip_exp ; end #-------------------------------------------------------------------------- # ● 経験値加算 #-------------------------------------------------------------------------- def add_equip_exp(value) return unless identify_id @equip_exp += value end #-------------------------------------------------------------------------- # ● スロット用経験値加算 #-------------------------------------------------------------------------- def slot_equip_exp=(value) return unless @slot @slot.each{|obj| next unless obj obj.add_equip_exp(value) } end #データ継承処理(合成用処理)------------------------------------------------ #-------------------------------------------------------------------------- # ◆ データ継承処理 #-------------------------------------------------------------------------- def succeed_data(succeed) #カスタム数(加算継承) @customize = [@customize + succeed[0], add_plus_limit_convert].min #接頭語(上書き継承)実装削除 #@name_value = succeed[1] #シンボル(上書き継承) @symbol = succeed[2] #スロット数(加算継承) succeed[3].times{gain_slot_number} #耐久値(継承未実装) #@durable_value += succeed[4] #シンボル数(加算継承) succeed[5].times{gain_symbol_number} reset_name_random_params end #-------------------------------------------------------------------------- # ◆ データ抽出処理 #-------------------------------------------------------------------------- def drain_data return [@customize, nil, @symbol, add_slot_num, @durable_value, add_symbol_num] end end #============================================================================== # ■ Game_BaseItem #============================================================================== class Game_BaseItem #データの取得-------------------------------------------------------------- #-------------------------------------------------------------------------- # ● IDの取得 #-------------------------------------------------------------------------- def id return @item_id % KURE::SortOut::ID_BASE if @item_id > KURE::SortOut::ID_BASE return @item_id end #-------------------------------------------------------------------------- # ● 固有IDの設定 #-------------------------------------------------------------------------- def identify_id=(value) object.identify_id = value if object end #-------------------------------------------------------------------------- # ● データの取得 #-------------------------------------------------------------------------- def identify_id ; object ? object.identify_id : 0 ; end #固有ID def custom_num ; object ? object.custom_num : 0 ; end #強化値 def slot_list ; object ? object.slot_list : [] ; end #スロット def symbol_list ; object ? object.symbol_list : [] ; end #シンボル #オブジェクトの取得-------------------------------------------------------- #-------------------------------------------------------------------------- # ● アイテムオブジェクトの設定 #-------------------------------------------------------------------------- def object=(item) @class = item ? item.class : nil @item_id = item ? item.id : 0 end #-------------------------------------------------------------------------- # ● アイテムオブジェクトの取得 #-------------------------------------------------------------------------- def object return $data_skills[@item_id] if is_skill? return $data_items[@item_id] if is_item? return $game_party.set_weapon(@item_id) if is_weapon? return $game_party.set_armor(@item_id) if is_armor? return nil end #初期装備の対応設定-------------------------------------------------------- #-------------------------------------------------------------------------- # ● 装備品を ID で設定 # is_weapon : 武器かどうか # item_id : 武器/防具 ID #-------------------------------------------------------------------------- def set_equip(is_weapon, item_id) @class = is_weapon ? RPG::Weapon : RPG::Armor @item_id = item_id #固有IDが未設定の場合 if @item_id < KURE::SortOut::ID_BASE obj = is_weapon ? $data_weapons[item_id] :$data_armors[item_id] if obj same_obj = Marshal.load(Marshal.dump(obj)) new_identify_id = $game_party.set_id(same_obj) same_obj.identify_id = new_identify_id same_obj.first_setting(true) master_container = $game_party.item_master_container(same_obj.class) master_container[new_identify_id] = same_obj @item_id = same_obj.id if object end end end end #============================================================================== # ■ Game_Actor #============================================================================== class Game_Actor < Game_Battler #-------------------------------------------------------------------------- # ● パーティとアイテムを交換する # new_item : パーティから取り出すアイテム # old_item : パーティに返すアイテム #-------------------------------------------------------------------------- def trade_item_with_party(new_item, old_item) return false if new_item && !$game_party.has_item?(new_item) $game_party.gain_item(old_item, 1, false, true) $game_party.lose_item(new_item, 1, false, true) return true end #-------------------------------------------------------------------------- # ● 装備の強制変更 # slot_id : 装備スロット ID # item : 武器/防具(nil なら装備解除) #-------------------------------------------------------------------------- def force_change_equip(slot_id, item) same_object = nil same_object = Marshal.load(Marshal.dump(item)) if item if same_object && same_object.identify_id == 0 new_identify_id = $game_party.set_id(same_object) same_object.identify_id = new_identify_id same_object.first_setting master_container = $game_party.item_master_container(same_object.class) master_container[new_identify_id] = same_object end @equips[slot_id].object = item release_unequippable_items(false) force_refresh end #-------------------------------------------------------------------------- # ● 装備の変更(ID で指定)(再定義) # slot_id : 装備スロット ID # item_id : 武器/防具 ID #-------------------------------------------------------------------------- def change_equip_by_id(slot_id, item_id) change_item = nil if item_id && item_id != 0 item = $data_weapons[item_id] if equip_slots[slot_id] == 0 item = $data_armors[item_id] if equip_slots[slot_id] != 0 container = $game_party.item_container(item.class) if container[item_id] container[item_id].each{|block| next unless block break if change_item change_item = block} change_equip(slot_id, change_item) if change_item end else change_equip(slot_id, nil) end end #-------------------------------------------------------------------------- # ● 装備の破棄 # item : 破棄する武器/防具 #-------------------------------------------------------------------------- def discard_equip(item) #アイテムをデータベースオブジェクトに変換 dis_item = $data_weapons[$game_party.turn_item_id(item.id)] if item.class == RPG::Weapon dis_item = $data_armors[$game_party.turn_item_id(item.id)] if item.class == RPG::Armor #判定用のIDを用意 slot_id = nil #装備品を順番に判定 equips.each_with_index{|object, index| next unless object cheak_obj = $data_weapons[$game_party.turn_item_id(object.id)] if object.class == RPG::Weapon cheak_obj = $data_armors[$game_party.turn_item_id(object.id)] if object.class == RPG::Armor #削除対象と装備品のデータベースが一致しなければ次へ next if cheak_obj != dis_item #一致すれば装備位置を保存してループを抜ける slot_id = index break } return unless slot_id #マスターコンテナ及び、装備リストからアイテムを削除 master_container = $game_party.item_master_container(item.class) delete_item_id = @equips[slot_id].identify_id master_container[delete_item_id] = nil @equips[slot_id].object = nil end end #============================================================================== # ■ Game_Party #============================================================================== class Game_Party < Game_Unit #-------------------------------------------------------------------------- # ● 公開インスタンス変数 #-------------------------------------------------------------------------- attr_reader :weapons_name_list #武器名リスト(所持) attr_reader :armors_name_list #防具名リスト(所持) attr_reader :weapons_master_name_list #武器名マスター(全配列) attr_reader :armors_master_name_list #防具名マスター(全配列) attr_reader :weapons_master #武器データ(マスター) attr_reader :armors_master #防具データ(マスター) #初期設定------------------------------------------------------------------ #-------------------------------------------------------------------------- # ● 全アイテムリストの初期化(再定義) #-------------------------------------------------------------------------- def init_all_items #アイテムデータ保存用配列 @items = [] ; @weapons = [] ; @armors = [] @weapons_master = [] ; @armors_master = [] @weapons_name_list = [] ; @armors_name_list = [] @get_list = [] #倉庫用のデータ保存配列 @s_items = [] ; @s_weapons = [] ; @s_armors = [] #第2倉庫データ(多目的Closed倉庫) @s2_items = [] ; @s2_weapons = [] ; @s2_armors = [] end #アイテムログ全般処理------------------------------------------------------ #-------------------------------------------------------------------------- # ● 獲得アイテム名リストを初期化(追加定義) #-------------------------------------------------------------------------- def clear_get_list ; @get_list = [] ; end #-------------------------------------------------------------------------- # ● 装備品の獲得アイテム名リストを取得(追加定義) #-------------------------------------------------------------------------- def get_list ; @get_list.select{|obj| obj[2] != RPG::Item }.collect{|obj| obj[0] } ;end #-------------------------------------------------------------------------- # ● 全獲得アイテム名リストを取得(追加定義) #-------------------------------------------------------------------------- def get_all_list ; @get_list.collect{|obj| obj[0]} ; end #-------------------------------------------------------------------------- # ● 獲得アイテムのデータリストを取得(追加定義) #-------------------------------------------------------------------------- def get_full_list ; @get_list ; end #-------------------------------------------------------------------------- # ● 獲得アイテム名リストを追加(追加定義) #-------------------------------------------------------------------------- def add_get_list(item, amount) @get_list.unshift([item.name, amount, item.class, item.id]) #最大サイズと比較し、大きければ末尾をカットする @get_list = @get_list.slice(0..KURE::SortOut::MAX_ITEM_LOG - 1) if @get_list.size > KURE::SortOut::MAX_ITEM_LOG end #-------------------------------------------------------------------------- # ● 入手したアイテムのデータを記録(追加定義) #-------------------------------------------------------------------------- def memory_get_item(item, amount) add_get_list(item, amount) if amount > 0 end #アイテムコンテナ(マスターコンテナ処理)------------------------------------ #-------------------------------------------------------------------------- # ● マスターコンテナオブジェクトを取得(追加定義) #-------------------------------------------------------------------------- def item_master_container(item_class) return @weapons_master if item_class == RPG::Weapon return @armors_master if item_class == RPG::Armor return nil end #-------------------------------------------------------------------------- # ● マスターコンテナオブジェクトを圧縮(追加定義) #-------------------------------------------------------------------------- def compact_item_master_container(item_class) container = item_master_container(item_class) return unless container count = container.size - 1 while count > 0 break if container[count] container.delete_at(-1) unless container[count] count -= 1 end end #-------------------------------------------------------------------------- # ● 倉庫のコンテナオブジェクトを取得 #-------------------------------------------------------------------------- def s_container(item_class, s_id = 1) case s_id when 1 return @s_items if item_class == RPG::Item return @s_weapons if item_class == RPG::Weapon return @s_armors if item_class == RPG::Armor when 2 return @s2_items if item_class == RPG::Item return @s2_weapons if item_class == RPG::Weapon return @s2_armors if item_class == RPG::Armor end return nil end #-------------------------------------------------------------------------- # ● 武器オブジェクトのマスターブロック配列を作成(追加定義) #-------------------------------------------------------------------------- def master_weapons_block(id) return @weapons_master.select{|obj| obj && id == turn_item_id(obj.id)} end #-------------------------------------------------------------------------- # ● 武器オブジェクトのPT内マスターブロック配列を作成(追加定義) #-------------------------------------------------------------------------- def master_weapons_block_pt(id) return party_weapons_master.select{|obj| obj && id == turn_item_id(obj.id)} end #-------------------------------------------------------------------------- # ● 防具オブジェクトのマスターブロック配列を作成(追加定義) #-------------------------------------------------------------------------- def master_armors_block(id) return @armors_master.select{|obj| obj && id == turn_item_id(obj.id)} end #-------------------------------------------------------------------------- # ● 防具オブジェクトのマスターブロック配列を作成(追加定義) #-------------------------------------------------------------------------- def master_armors_block_pt(id) return party_armors_master.select{|obj| obj && id == turn_item_id(obj.id)} end #-------------------------------------------------------------------------- # ● アイテムのデータベース数取得(追加定義) #-------------------------------------------------------------------------- def item_master_number(item) #対応するコンテナを取得 return 0 if item.class == RPG::Item container = master_weapons_block_pt(item.id) if item.class == RPG::Weapon container = master_armors_block_pt(item.id) if item.class == RPG::Armor return 0 unless container return container.size end #アイテムコンテナ(通常コンテナ処理)---------------------------------------- #-------------------------------------------------------------------------- # ● ID毎のオブジェクトブロックの配列取得(追加定義) #-------------------------------------------------------------------------- def weapons_block(id) ; @weapons[id] ? @weapons[id] : [] ; end #武器 def armors_block(id) ; @armors[id] ? @armors[id] : [] ; end #防具 #-------------------------------------------------------------------------- # ● 武器、防具、アイテムのオブジェクトの配列取得(再定義) #-------------------------------------------------------------------------- def weapons ; @weapons.compact.flatten ; end #武器 def armors ; @armors.compact.flatten ; end #防具 def s_weapons ; @s_weapons.compact.flatten ; end #武器(倉庫) def s_armors ; @s_armors.compact.flatten ; end #防具(倉庫) def s2_weapons ; @s2_weapons.compact.flatten ; end #武器(第2倉庫) def s2_armors ; @s2_armors.compact.flatten ; end #防具(第2倉庫) def items ; set_item_list(@items) ; end #アイテム def s_items ; set_item_list(@s_items) ; end #アイテム(倉庫) def s2_items ; set_item_list(@s2_items) ; end #アイテム(第2倉庫) #-------------------------------------------------------------------------- # ● 指定配列よりアイテムオブジェクトを取得 #-------------------------------------------------------------------------- def set_item_list(arr) item = Array.new arr.each_with_index{|num, index| next unless num next if num == 0 item.push($data_items[index])} return item end #-------------------------------------------------------------------------- # ● アイテムの所持数取得(再定義) #-------------------------------------------------------------------------- def item_number(item) ; c_item_num(item_container(item.class), item) ; end #所持 def s_item_number(item) ; c_item_num(s_container(item.class, 1), item) ; end #倉庫(第1) def s2_item_number(item) ; c_item_num(s_container(item.class, 2), item) ; end #倉庫(第2) #-------------------------------------------------------------------------- # ● コンテナから指定アイテムの数を数える(再定義) #-------------------------------------------------------------------------- def c_item_num(container, item) return 0 unless container #通常アイテムの場合 if item.class == RPG::Item return 0 if container[item.id] == 0 return 0 if container[item.id] == nil return container[item.id] else return 0 unless container[turn_item_id(item.id)] return container[turn_item_id(item.id)].size end end #-------------------------------------------------------------------------- # ● 倉庫のアイテムオブジェクトの配列取得 #-------------------------------------------------------------------------- def all_s_items ; s_items + s_weapons + s_armors ; end #倉庫 def all_s2_items ; s2_items + s2_weapons + s2_armors ; end #第2倉庫 #倉庫と手持ちのアイテム移動処理-------------------------------------------- #-------------------------------------------------------------------------- # ● 倉庫へアイテムの移動 #-------------------------------------------------------------------------- def in_to_storage(item, s_id = 1) return unless item #対応するアイテムコンテナを取得 container = item_container(item.class) s_container = s_container(item.class, s_id) #通常アイテム if item.class == RPG::Item container[item.id] = [[item_number(item) - 1, 0].max, max_item_number(item)].min s_container[item.id] ||= 0 s_container[item.id] += 1 #それ以外(装備品オブジェクト) else same_object = Marshal.load(Marshal.dump(item)) item_id = $game_party.turn_item_id(same_object.id) lose_item_id = set_delete(item_id,same_object) return unless lose_item_id #コンテナよりアイテムを削除 container[item_id][lose_item_id] = nil container[item_id].compact! #倉庫のコンテナにアイテムを出力 s_container[item_id] ||= [] s_container[item_id].push(same_object) end end #-------------------------------------------------------------------------- # ● 倉庫からアイテムを取り出す #-------------------------------------------------------------------------- def out_put_storage(item, s_id = 1) return unless item #対応するアイテムコンテナを取得 container = item_container(item.class) s_container = s_container(item.class, s_id) #通常アイテム if item.class == RPG::Item s_container[item.id] ||= 0 s_container[item.id] -= 1 gain_item(item, 1) #それ以外(装備品オブジェクト) else same_object = Marshal.load(Marshal.dump(item)) item_id = $game_party.turn_item_id(same_object.id) lose_item_id = set_s_delete(item_id,same_object) return unless lose_item_id #コンテナよりアイテムを削除 s_container[item_id][lose_item_id] = nil s_container[item_id].compact! #倉庫のコンテナにアイテムを出力 container[item_id] ||= [] container[item_id].push(same_object) end end #アイテムの固有関連処理---------------------------------------------------- #-------------------------------------------------------------------------- # ● 固有ID判定(追加定義) #-------------------------------------------------------------------------- def identify?(item_id) return item_id > KURE::SortOut::ID_BASE end #-------------------------------------------------------------------------- # ● ID取得(追加定義) #-------------------------------------------------------------------------- def turn_identify_id(item_id) ; item_id / KURE::SortOut::ID_BASE ; end #固有ID def turn_item_id(item_id) ; item_id % KURE::SortOut::ID_BASE ; end #データベースID #-------------------------------------------------------------------------- # ● 武器オブジェクトの取得(追加定義) #-------------------------------------------------------------------------- def set_weapon(item_id) return $data_weapons[item_id] unless identify?(item_id) return @weapons_master[turn_identify_id(item_id)] end #-------------------------------------------------------------------------- # ● 防具オブジェクトの取得(追加定義) #-------------------------------------------------------------------------- def set_armor(item_id) return $data_armors[item_id] unless identify?(item_id) return @armors_master[turn_identify_id(item_id)] end #最新のデータとのリンク処理 #-------------------------------------------------------------------------- # ● 装備の名称の配列の更新(追加定義) # (処理上不要であるが他のスクリプトの併用機能維持のため残す) #-------------------------------------------------------------------------- def refresh_equip_name_list_both return unless @need_refresh refresh_equip_name_list @need_refresh = false end #-------------------------------------------------------------------------- # ● 装備の名称のマスター配列の更新(追加定義) #-------------------------------------------------------------------------- def refresh_equip_master_name_list @weapons_master_name_list = [] ; @armors_master_name_list = [] #装備武器のアイテムIDより配列を作成 weapon_ids = party_weapons_master.select{|obj| obj != nil}.collect{|obj| turn_item_id(obj.id)} weapon_ids.sort!.uniq! weapon_ids.each{ |id| @weapons_master_name_list.push($data_weapons[id])} #装備防具のアイテムIDより配列を作成 armors_ids = party_armors_master.select{|obj| obj != nil}.collect{|obj| turn_item_id(obj.id)} armors_ids.sort!.uniq! armors_ids.each{ |id| @armors_master_name_list.push($data_armors[id])} end #-------------------------------------------------------------------------- # ● 装備の名称の配列の更新(追加定義) #-------------------------------------------------------------------------- def refresh_equip_name_list refresh_equip_master_name_list @weapons_name_list = [] ; @armors_name_list = [] @weapons.each_with_index{|obj, index| next if obj == nil or obj == [] @weapons_name_list.push($data_weapons[index])} @armors.each_with_index{|obj, index| next if obj == nil or obj == [] @armors_name_list.push($data_armors[index])} end #-------------------------------------------------------------------------- # ● PT内の武器のアイテムオブジェクトの配列取得(追加定義) #-------------------------------------------------------------------------- def party_weapons_master ; party_equip_master(@weapons_master) ; end #-------------------------------------------------------------------------- # ● PT内の防具のアイテムオブジェクトの配列取得(追加定義) #-------------------------------------------------------------------------- def party_armors_master ; party_equip_master(@armors_master) ; end #-------------------------------------------------------------------------- # ● PT内の防具のアイテムオブジェクトの配列取得(追加定義) #-------------------------------------------------------------------------- def party_equip_master(arr) all_actor = $data_actors.compact.collect {|obj| $game_actors[obj.id] } cheacker_list = all_actor - all_members push_list = Array.new arr.each{|item| next if cheacker_list.any? {|actor| actor.equips.include?(item) } push_list.push(item)} return push_list end #アイテムの増減関連処理(メイン処理)---------------------------------------- #------------------------------------------------------------------------- # ● アイテムの増加(減少)(再定義) # include_equip : 装備品も含める #-------------------------------------------------------------------------- def gain_item(item, amount, include_equip = false, change_equip = false, recycle_slot = true) #対応するアイテムコンテナを取得 container = item_container(item.class) master_container = item_master_container(item.class) compact_item_master_container(item.class) return unless container #現在の所持数と、増加後のアイテム数を設定 last_number = item_number(item) new_number = last_number + amount #通常アイテムならば個数をID位置に出力 if item.class == RPG::Item container[item.id] = [[new_number, 0].max, max_item_number(item)].min memory_get_item(item, [amount, max_item_number(item) - last_number].min) end #装備品の場合の処理 if item.class == RPG::Weapon or item.class == RPG::Armor #アイテムが増える場合 if new_number > last_number count = new_number - last_number #取得装備を一旦複製し、データベースIDを取得する same_object = Marshal.load(Marshal.dump(item)) item_id = $game_party.turn_item_id(same_object.id) #コンテナが存在していなければ作成 container[item_id] ||= [] #装備切り替えの場合の処理 if change_equip && same_object.identify_id != 0 #アイテム増加処理(コンテナに出力) container[item_id].push(same_object) count -= 1 end #増加数の数だけ同様処理を行う count.times{ #獲得アイテム複製し、固有IDを与えて初期設定を行う same_object = Marshal.load(Marshal.dump(item)) new_identify_id = set_id(same_object) same_object.identify_id = new_identify_id same_object.first_setting #アイテム増加処理(コンテナに出力) container[item_id].push(same_object) #マスターコンテナに新しい装備を出力 master_container[new_identify_id] = same_object memory_get_item(same_object, 1) } #アイテムが減る場合 else #減少個数を算出 count = last_number - new_number #同一アイテムを複製し、データベースIDを取得 same_object = Marshal.load(Marshal.dump(item)) item_id = $game_party.turn_item_id(same_object.id) #同一アイテムの削除するべきデータベース位置、固有IDを取得 lose_item_id = set_delete(item_id,same_object) delete_identify_id = same_object.identify_id #装備切り替えの場合の処理 if change_equip && lose_item_id #アイテム減少処理(コンテナに出力) #装備するためマスターコンテナは維持 container[item_id][lose_item_id] = nil container[item_id].compact! count -= 1 end #以下の削除ブロックは装備切り替え以外のアイテム削除 if count > 0 #データベース位置と固有IDを確認 if lose_item_id && delete_identify_id #装備品のスロット品を回収 recycle_slot(container[item_id][lose_item_id]) if recycle_slot #アイテム減少処理 #消滅するためマスターコンテナより削除 master_container[delete_identify_id] = nil container[item_id][lose_item_id] = nil container[item_id].compact! count -= 1 end #同一アイテムが存在しなければ弱いアイテムより削除 count.times{ #能力の低いアイテムを取得 lose_item_id = week_object(item_id,same_object) if lose_item_id && container[item_id][lose_item_id] #装備品のスロット品を回収 recycle_slot(container[item_id][lose_item_id]) if recycle_slot master_container[container[item_id][lose_item_id].identify_id] = nil container[item_id][lose_item_id] = nil container[item_id].compact! end } end end @need_refresh = true if new_number == 0 || 1 end #最終的な数が0以下の場合、装備を含んで削除を行う discard_members_equip(item, -new_number) if include_equip && new_number < 0 $game_map.need_refresh = true end #-------------------------------------------------------------------------- # ● アイテムの減少(再定義) # include_equip : 装備品も含める #-------------------------------------------------------------------------- def lose_item(item, amount, include_equip = false, change_equip = false, recycle_slot = true) gain_item(item, -amount, include_equip, change_equip, recycle_slot) end #-------------------------------------------------------------------------- # ● スロットにささった装備の回収(追加定義) #-------------------------------------------------------------------------- def recycle_slot(item) return unless item.class == RPG::EquipItem return if item.identify_id == 0 item.slot_list.each{|item| $game_party.gain_item(item, 1 ,false ,true) if item} end #-------------------------------------------------------------------------- # ● 各マスターコンテナの空白のID位置を取得(追加定義) #-------------------------------------------------------------------------- def set_id(item) return seek_empty_pos(@weapons_master) if item.class == RPG::Weapon return seek_empty_pos(@armors_master) if item.class == RPG::Armor end #-------------------------------------------------------------------------- # ● 各マスターコンテナの空白のID位置を取得(追加定義) #-------------------------------------------------------------------------- def seek_empty_pos(arr) #配列を前から検索し、1以降で空白の位置があればINDEXを返す arr.each_with_index{|obj, index| next if index == 0 next if obj return index } return 1 if arr.size == 0 return arr.size end #-------------------------------------------------------------------------- # ● 削除する配列位置を取得(追加定義) #-------------------------------------------------------------------------- def set_delete(item_id, item) return seek_delete_pos(@weapons[item_id], item.id) if item.class == RPG::Weapon return seek_delete_pos(@armors[item_id], item.id) if item.class == RPG::Armor end #-------------------------------------------------------------------------- # ● 削除する配列位置を取得(追加定義) #-------------------------------------------------------------------------- def set_s_delete(item_id, item) return seek_delete_pos(@s_weapons[item_id], item.id) if item.class == RPG::Weapon return seek_delete_pos(@s_armors[item_id], item.id) if item.class == RPG::Armor end #-------------------------------------------------------------------------- # ● 各マスターコンテナの空白のID位置を取得(追加定義) #-------------------------------------------------------------------------- def seek_delete_pos(arr, id) return unless arr #配列を前から検索し、同一IDであればINDEXを返す arr.each_with_index{|obj, index| return index if obj.id == id} end #-------------------------------------------------------------------------- # ● メンバーの装備品を破棄する #-------------------------------------------------------------------------- def discard_members_equip(item, amount) #削除するアイテムのデータベースIDを取得 dis_id = turn_item_id(item.id) num = amount members.each{|actor| #削除数が規定に達したら処理を抜ける break if num <= 0 cheak_list = actor.weapons if item.class == RPG::Weapon cheak_list = actor.armors if item.class == RPG::Armor #装備品をチェックし、同一データベースIDなら削除 cheak_list.each{|obj| if turn_item_id(obj.id) == dis_id actor.discard_equip(item) num -= 1 end } } end #-------------------------------------------------------------------------- # ● 該当アイテムの中で最も能力が低いもののIDを取得(追加定義) #-------------------------------------------------------------------------- def week_object(item_id, item) #判定する装備ブロックを取得 cheak_list = @weapons[item_id] if item.class == RPG::Weapon cheak_list = @armors[item_id] if item.class == RPG::Armor return nil unless cheak_list #判定用変数を作成 result = 0 ; keep = nil cheak_list.each_with_index{|obj, index| next unless obj keep = obj.custom_num unless keep if keep > obj.custom_num keep = obj ; result = index end } return result end #装備品のカスタム関連処理-------------------------------------------------- #-------------------------------------------------------------------------- # ● 指定アクターの指定スロットのアイテムを取得(追加定義) #-------------------------------------------------------------------------- def actor_slot_item(actor_id, slot_id) #指定アイテムが存在しなけれなnilを返す item = $game_actors[actor_id].equips[slot_id] return nil unless item #固有IDが存在しなければnilを返す serch_identify_id = item.identify_id return nil if serch_identify_id == 0 #マスターコンテナ上にアイテムが無ければnilを返す master_container = item_master_container(item.class) int_item = master_container[serch_identify_id] return nil unless int_item return item end #-------------------------------------------------------------------------- # ● 装備品の強化(追加定義) #-------------------------------------------------------------------------- def custom_object_plus(actor_id, slot_id, param, plus) int_item = actor_slot_item(actor_id, slot_id) return unless int_item if param == -1 int_item.custom_value(plus) else int_item.custom_status(param, plus) end end #-------------------------------------------------------------------------- # ● 装備品の耐久値操作(追加定義) #-------------------------------------------------------------------------- def custom_equip_durable_value(actor_id, slot_id, value) int_item = actor_slot_item(actor_id, slot_id) return unless int_item int_item.reduce_durable_value = value end #-------------------------------------------------------------------------- # ● 装備品にスロットを追加(追加定義) #-------------------------------------------------------------------------- def custom_object_add_slot(actor_id, slot_id, plus) int_item = actor_slot_item(actor_id, slot_id) return unless int_item plus.times{int_item.gain_slot_number} end #-------------------------------------------------------------------------- # ● 装備品のシンボルを拡張(追加定義) #-------------------------------------------------------------------------- def custom_object_add_symbol(actor_id, slot_id, plus) int_item = actor_slot_item(actor_id, slot_id) return unless int_item plus.times{int_item.gain_symbol_number} end #-------------------------------------------------------------------------- # ● 装備品のシンボルを追加(追加定義) #-------------------------------------------------------------------------- def custom_object_add_symbol_obj(actor_id, slot_id, id, limit) int_item = actor_slot_item(actor_id, slot_id) return unless int_item int_item.set_symbol(id,limit) end #-------------------------------------------------------------------------- # ● 装備品のシンボルを削除(追加定義) #-------------------------------------------------------------------------- def custom_object_delete_symbol_obj(actor_id, slot_id, rand, protect) int_item = actor_slot_item(actor_id, slot_id) return unless int_item int_item.delete_symbol(rand, protect) end #-------------------------------------------------------------------------- # ● 装備品にメモを追加(追加定義) #-------------------------------------------------------------------------- def custom_equip_notes(actor_id, slot_id, str) int_item = actor_slot_item(actor_id, slot_id) return unless int_item int_item.add_txt(str) end #-------------------------------------------------------------------------- # ● 装備品の名前を変更(追加定義) #-------------------------------------------------------------------------- def custom_equip_name(actor_id, slot_id, str) int_item = actor_slot_item(actor_id, slot_id) return unless int_item int_item.set_uniq_name(str) end #-------------------------------------------------------------------------- # ● 指定したアクターの破損した装備の数を取得(追加定義) #-------------------------------------------------------------------------- def broken_equip_num(actor_id) eruip = $game_actors[actor_id].equips.select{|obj| obj != nil && obj.broken?} return eruip.size end #-------------------------------------------------------------------------- # ● 指定したアクターの破損した装備を全て修復(追加定義) #-------------------------------------------------------------------------- def fix_all_equip(actor_id) actor = $game_actors[actor_id] for slot in 0..actor.equips.size - 1 next unless actor.equips[slot] actor.equips[slot].recover_durable container = item_master_container(actor.equips[slot].class) container[actor.equips[slot].identify_id].recover_durable end end #-------------------------------------------------------------------------- # ● 所持している全ての破損装備を数える(追加定義) #-------------------------------------------------------------------------- def all_broken_equip_num num = 0 @weapons_master.each do |weapon| num += 1 if weapon && weapon.broken? end @armors_master.each do |armor| num += 1 if armor && armor.broken? end return num end #-------------------------------------------------------------------------- # ● 所持している破損装備を全て修復(追加定義) #-------------------------------------------------------------------------- def fix_all_party_equip @weapons_master.each do |weapon| if weapon && weapon.broken? weapon.recover_durable item_id = turn_item_id(weapon.id) identify_id = set_delete(item_id,weapon) unless $game_party.all_members.any? {|actor| actor.equips.include?(weapon) } if @weapons[item_id] && @weapons[item_id][identify_id] @weapons[item_id][identify_id].recover_durable end end end end @armors_master.each do |armor| if armor && armor.broken? armor.recover_durable item_id = turn_item_id(armor.id) identify_id = set_delete(item_id,armor) unless $game_party.all_members.any? {|actor| actor.equips.include?(armor) } if @armors[item_id] && @armors[item_id][identify_id] @armors[item_id][identify_id].recover_durable end end end end $game_party.refresh_equip_name_list_both end end #============================================================================== # ■ Game_Interpreter(追加定義) #============================================================================== class Game_Interpreter #-------------------------------------------------------------------------- # ● 指定アクターの装備武器を強化(+値追加)(追加定義) #-------------------------------------------------------------------------- def custom_equip_item(actor_id, slot_id, plus) $game_party.custom_object_plus(actor_id, slot_id, -1, plus) end #-------------------------------------------------------------------------- # ● 指定アクターの装備武器のステータスを強化(追加定義) #-------------------------------------------------------------------------- def custom_equip_param(actor_id, slot_id, param, plus) $game_party.custom_object_plus(actor_id, slot_id, param, plus) end #-------------------------------------------------------------------------- # ● 指定アクターの武器のメモ欄を追加(追加定義) #-------------------------------------------------------------------------- def custom_equip_notes(actor_id, slot_id, txt) $game_party.custom_equip_notes(actor_id, slot_id, txt) end #-------------------------------------------------------------------------- # ● 指定アクターの武器の名前を変更(追加定義) #-------------------------------------------------------------------------- def custom_equip_name(actor_id, slot_id, txt) $game_party.custom_equip_name(actor_id, slot_id, txt) end #-------------------------------------------------------------------------- # ● 指定アクターの破損装備数を取得(追加定義) #-------------------------------------------------------------------------- def broken_equip_num(actor_id) $game_party.broken_equip_num(actor_id) end #-------------------------------------------------------------------------- # ● 指定アクターの装備を修復(追加定義) #-------------------------------------------------------------------------- def fix_all_equip(actor_id) $game_party.fix_all_equip(actor_id) end #-------------------------------------------------------------------------- # ● 全ての破損装備数を取得(追加定義) #-------------------------------------------------------------------------- def all_broken_equip_num $game_party.all_broken_equip_num end #-------------------------------------------------------------------------- # ● 全ての装備を修復(追加定義) #-------------------------------------------------------------------------- def fix_all_party_equip $game_party.fix_all_party_equip end #-------------------------------------------------------------------------- # ● 指定アクターの装備武器にスロットを追加(追加定義) #-------------------------------------------------------------------------- def custom_equip_add_slot(actor_id, slot_id, plus) $game_party.custom_object_add_slot(actor_id, slot_id, plus) end #-------------------------------------------------------------------------- # ● 指定アクターの装備武器のシンボル数を拡張(追加定義) #-------------------------------------------------------------------------- def custom_equip_add_symbol(actor_id, slot_id, plus) $game_party.custom_object_add_symbol(actor_id, slot_id, plus) end #-------------------------------------------------------------------------- # ● 指定アクターの装備武器のシンボルを追加(追加定義) #-------------------------------------------------------------------------- def custom_equip_add_symbol_obj(actor_id, slot_id, id, limit = true) $game_party.custom_object_add_symbol_obj(actor_id, slot_id, id, limit) end #-------------------------------------------------------------------------- # ● 指定アクターの装備武器のシンボルを削除(追加定義) #-------------------------------------------------------------------------- def custom_equip_delete_symbol_obj(actor_id, slot_id, rand = true ,protect = true) $game_party.custom_object_delete_symbol_obj(actor_id, slot_id, rand, protect) end #-------------------------------------------------------------------------- # ● 指定アクターの装備武器の耐久値を操作(追加定義) #-------------------------------------------------------------------------- def custom_equip_durable_value(actor_id, slot_id, value) $game_party.custom_equip_durable_value(actor_id, slot_id, value) end #-------------------------------------------------------------------------- # ● 指定アクターの装備をチェック #-------------------------------------------------------------------------- def equip_cheak(actor_id, type, id) case type when 0 id_arr = $game_actors[1].weapons.collect{|obj| $game_party.turn_item_id(obj.id)} when 1 id_arr = $game_actors[1].armors.collect{|obj| $game_party.turn_item_id(obj.id)} end return id_arr.include?(id) end end #============================================================================== # ■ Window_ItemList #------------------------------------------------------------------------------ #  アイテム画面で、所持アイテムの一覧を表示するウィンドウです。 #============================================================================== class Window_ItemList < Window_Selectable #-------------------------------------------------------------------------- # ● アイテムの個数を描画(再定義) #-------------------------------------------------------------------------- def draw_item_number(rect, item) num = item.is_a?(RPG::EquipItem) ? 1 : $game_party.item_number(item) draw_text(rect, sprintf(":%2d", num), 2) end end #倉庫画面用処理---------------------------------------------------------------- #============================================================================== # ■ Scene_Storage #============================================================================== class Scene_Storage < Scene_MenuBase #-------------------------------------------------------------------------- # ● 開始処理 #-------------------------------------------------------------------------- def start super $game_party.refresh_equip_name_list_both create_help_window create_category_window create_item_window create_info_window window_setting end #-------------------------------------------------------------------------- # ● ヘルプウィンドウの作成 #-------------------------------------------------------------------------- def create_help_window @help_window = Window_Help.new(1) @help_window.set_text("作業を選択してください。") end #-------------------------------------------------------------------------- # ● カテゴリウィンドウの作成 #-------------------------------------------------------------------------- def create_category_window wx = 0 wy = @help_window.height @category_window = Ex_Window_ItemCategory.new(wx, wy) @category_window.set_handler(:ok, method(:on_category_ok)) @category_window.set_handler(:cancel, method(:on_category_cancel)) @category_window.activate end #-------------------------------------------------------------------------- # ● アイテムウィンドウの作成 #-------------------------------------------------------------------------- def create_item_window wy = @category_window.y + @category_window.height ww = Graphics.width / 2 wh = Graphics.height - wy @item_window = Ext_Window_ItemList.new(0, wy, ww, wh) @item_window.set_handler(:ok, method(:on_item_ok)) @item_window.set_handler(:cancel, method(:on_item_cancel)) @item_window.deactivate end #-------------------------------------------------------------------------- # ● インフォメーションウィンドウの作成 #-------------------------------------------------------------------------- def create_info_window wx = @item_window.width wy = @category_window.y + @category_window.height ww = Graphics.width - wx wh = Graphics.height - wy @info_window = Window_k_Ext_Item_Info.new(wx, wy, ww, wh) end #-------------------------------------------------------------------------- # ● 各ウィンドウの初期設定 #-------------------------------------------------------------------------- def window_setting @category_window.item_window = @item_window @item_window.info_window = @info_window end #-------------------------------------------------------------------------- # ● カテゴリ[決定] #-------------------------------------------------------------------------- def on_category_ok case @category_window.mode when 0 @item_window.mode = @category_window.index @info_window.system_mode = @category_window.index @category_window.mode = 1 @category_window.select(0) @category_window.activate when 1 @category_window.deactivate @item_window.select(0) @item_window.activate end end #-------------------------------------------------------------------------- # ● カテゴリ[キャンセル] #-------------------------------------------------------------------------- def on_category_cancel case @category_window.mode when 0 ; return_scene when 1 @category_window.mode = 0 @category_window.select(0) @category_window.activate end end #-------------------------------------------------------------------------- # ● アイテム[決定] #-------------------------------------------------------------------------- def on_item_ok case @item_window.mode when 0 ; $game_party.in_to_storage(@item_window.item, 1) when 1 ; $game_party.out_put_storage(@item_window.item, 1) end @item_window.refresh @item_window.set_item @item_window.activate end #-------------------------------------------------------------------------- # ● アイテム[キャンセル] #-------------------------------------------------------------------------- def on_item_cancel @category_window.activate @item_window.unselect end end #============================================================================== # ■ Ex_Window_ItemCategory #============================================================================== class Ex_Window_ItemCategory < Window_HorzCommand attr_accessor :item_window attr_reader :mode #-------------------------------------------------------------------------- # ● オブジェクト初期化(エイリアス) #-------------------------------------------------------------------------- alias k_integrate_before_initialize initialize unless $! def initialize(x, y) @mode = 0 k_integrate_before_initialize(x, y) end #-------------------------------------------------------------------------- # ● 桁数の取得 #-------------------------------------------------------------------------- def col_max ; return 4 ; end #-------------------------------------------------------------------------- # ● ウィンドウ幅の取得 #-------------------------------------------------------------------------- def window_width ; Graphics.width ; end #-------------------------------------------------------------------------- # ● 表示モードの設定 #-------------------------------------------------------------------------- def mode=(mode) return if @mode == mode @mode = mode refresh end #-------------------------------------------------------------------------- # ● カーソル位置の設定 #-------------------------------------------------------------------------- def index=(index) @index = index update_cursor call_update_help return if index < 0 @item_window.category = current_ext if @item_window end #-------------------------------------------------------------------------- # ● コマンドリストの作成 #-------------------------------------------------------------------------- def make_command_list case mode when 0 ; make_command_0 when 1 ; make_command_1 end end #-------------------------------------------------------------------------- # ● コマンドリストの作成(設定0) #-------------------------------------------------------------------------- def make_command_0 add_command("預ける", :ok, true, 0) add_command("引き出す", :ok, true, 0) end #-------------------------------------------------------------------------- # ● コマンドリストの作成(設定1) #-------------------------------------------------------------------------- def make_command_1 add_command(Vocab::item, :ok, true, 1) add_command(Vocab::weapon, :ok, true, 2) add_command(Vocab::armor, :ok, true, 3) add_command(Vocab::key_item, :ok, true, 4) end end #============================================================================== # ■ Ext_Window_ItemList #============================================================================== class Ext_Window_ItemList < Window_ItemList attr_reader :mode attr_accessor :info_window #-------------------------------------------------------------------------- # ● オブジェクト初期化(エイリアス) #-------------------------------------------------------------------------- alias k_integrate_before_initialize initialize unless $! def initialize(x, y, width, height) @mode = 0 @pages = [] k_integrate_before_initialize(x, y, width, height) end #-------------------------------------------------------------------------- # ● 桁数の取得 #-------------------------------------------------------------------------- def col_max ; return 1 ; end #-------------------------------------------------------------------------- # ● アイテムを許可状態で表示するかどうか #-------------------------------------------------------------------------- def enable?(item) return false unless item case @mode when 0 return false if $game_party.s_item_number(item) >= item.storage_max return true when 1 return false if $game_party.item_number(item) >= $game_party.max_item_number(item) return true end end #-------------------------------------------------------------------------- # ● 動作モードの設定 #-------------------------------------------------------------------------- def mode=(mode) return if @mode == mode @mode = mode refresh end #-------------------------------------------------------------------------- # ● カーソル位置の設定 #-------------------------------------------------------------------------- def index=(index) @index = index update_cursor call_update_help set_item end #-------------------------------------------------------------------------- # ● 現在のアイテムをインフォウィンドウに表示 #-------------------------------------------------------------------------- def set_item @info_window.item = nil if index < 0 @info_window.item = item if @info_window && index >= 0 if item.is_a?(RPG::EquipItem) @pages[0] = call_add_feature_size(item) @pages[1] = call_ap_list_size(item) @pages[2] = call_sortout_size(0, item) @pages[3] = call_sortout_size(1, item) end @info_window.page_fix @info_window.refresh end #-------------------------------------------------------------------------- # ● 特徴ページ数 #-------------------------------------------------------------------------- def call_add_feature_size(item) return 0 unless item if $kure_integrate_script[:integrate] basic = KURE.call_add_feature_txt(item).size else basic = KURE.basic_actor_add_feature_txt(item).size end result = basic.div(10) + 1 result -= 1 if basic.modulo(10) == 0 return [result, 1].max end #-------------------------------------------------------------------------- # ● APリスト数 #-------------------------------------------------------------------------- def call_ap_list_size(item) return 0 unless item return 0 unless $kure_integrate_script[:integrate] basic = KURE.call_add_feature(83, item.note).size result = basic.div(4) + 1 result -= 1 if basic.modulo(4) == 0 return [result, 1].max end #-------------------------------------------------------------------------- # ● スロット数やシンボル数などページ数の取得 #-------------------------------------------------------------------------- def call_sortout_size(type, item) return 0 unless item return 0 unless $kure_integrate_script[:SortOut] case type when 0 result = item.max_slot_number.div(9) + 1 result -= 1 if item.max_slot_number.modulo(9) == 0 when 1 result = item.max_symbol_number.div(9) + 1 result -= 1 if item.max_symbol_number.modulo(9) == 0 end return [result, 1].max end #-------------------------------------------------------------------------- # ● →キー入力時動作 #-------------------------------------------------------------------------- def cursor_right(wrap = false) first_page = Array.new first_page = use_101? ? [100, 101] : [100] @pages[0] ||= 1 ; @pages[1] ||= 1 ; @pages[2] ||= 1 ; @pages[3] ||= 1 ; page_list = first_page @pages[0].times{|index| page_list.push(200 + index)} if $kure_integrate_script[:integrate] @pages[1].times{|index| page_list.push(300 + index)} if $kure_integrate_script[:ExEquip] && KURE::ExEquip::AP_VIEWER == 1 @pages[2].times{|index| page_list.push(400 + index)} if $kure_integrate_script[:SortOut] && KURE::SortOut::USE_SLOT_EQUIP == 1 @pages[3].times{|index| page_list.push(500 + index)} if $kure_integrate_script[:SortOut] && KURE::SortOut::USE_SYMBOL == 1 end page_list += first_page page_list.each_with_index{|id, index| if id == @info_window.draw_index @info_window.draw_index = page_list[index + 1] break end } end #-------------------------------------------------------------------------- # ● ←キー入力時操作 #-------------------------------------------------------------------------- def cursor_left(wrap = false) first_page = Array.new first_page = use_101? ? [100, 101] : [100] @pages[0] ||= 1 ; @pages[1] ||= 1 ; @pages[2] ||= 1 ; @pages[3] ||= 1 page_list = first_page @pages[0].times{|index| page_list.push(200 + index)} if $kure_integrate_script[:integrate] @pages[1].times{|index| page_list.push(300 + index)} if $kure_integrate_script[:ExEquip] && KURE::ExEquip::AP_VIEWER == 1 @pages[2].times{|index| page_list.push(400 + index)} if $kure_integrate_script[:SortOut] && KURE::SortOut::USE_SLOT_EQUIP == 1 @pages[3].times{|index| page_list.push(500 + index)} if $kure_integrate_script[:SortOut] && KURE::SortOut::USE_SYMBOL == 1 end page_list.unshift(page_list[page_list.size - 1]) for page in 1..page_list.size - 1 if page_list[page] == @info_window.draw_index @info_window.draw_index = page_list[page - 1] break end end end #-------------------------------------------------------------------------- # ● 装備条件ページが必要かどうか #-------------------------------------------------------------------------- def use_101? return false unless $kure_integrate_script[:ExEquip] return true if KURE::ExEquip::USE_EQUIPLV_SYSTEM == 1 return true if KURE::ExEquip::USE_EQUIPSTATUS_SYSTEM == 1 return true if KURE::ExEquip::USE_EQUIPVAL_SYSTEM == 1 return false end #-------------------------------------------------------------------------- # ● アイテムリストの作成 #-------------------------------------------------------------------------- def make_item_list case @mode when 0 ; @data = $game_party.all_items.select {|item| include?(item) } when 1 ; @data = $game_party.all_s_items.select {|item| include?(item) } end @data.push(nil) if include?(nil) end #-------------------------------------------------------------------------- # ● アイテムをリストに含めるかどうか #-------------------------------------------------------------------------- def include?(item) case @category when 0 ; false #空白 when 1 ; item.is_a?(RPG::Item) && !item.key_item? #アイテム when 2 ; item.is_a?(RPG::Weapon) #武器 when 3 ; item.is_a?(RPG::Armor) #防具 when 4 ; item.is_a?(RPG::Item) && item.key_item? #大切な物 else ; false end end #-------------------------------------------------------------------------- # ● アイテムの個数を描画 #-------------------------------------------------------------------------- def draw_item_number(rect, item) case @mode when 0 num = item.is_a?(RPG::EquipItem) ? 1 : $game_party.item_number(item) draw_text(rect, sprintf(":%2d", num), 2) when 1 num = item.is_a?(RPG::EquipItem) ? 1 : $game_party.s_item_number(item) draw_text(rect, sprintf(":%2d", num), 2) end end end #============================================================================== # ■ Window_k_Ext_Item_Info #============================================================================== class Window_k_Ext_Item_Info < Window_EquipStatus attr_accessor :draw_index attr_accessor :system_mode #-------------------------------------------------------------------------- # ● オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(x, y, width, height) @width = width @height = height @system_mode = 0 @draw_index = 0 @item = nil super(x, y) end #-------------------------------------------------------------------------- # ◎ ウィンドウ幅の取得 #-------------------------------------------------------------------------- def window_width ; return @width ;end #-------------------------------------------------------------------------- # ◎ ウィンドウ高さの取得 #-------------------------------------------------------------------------- def window_height ; return @height ;end #-------------------------------------------------------------------------- # ● 表示アイテムの設定 #-------------------------------------------------------------------------- def item=(item) return if @item == item @item = item @draw_index = item ? 100 : 0 refresh end #-------------------------------------------------------------------------- # ◎ 描画INDEXの設定 #-------------------------------------------------------------------------- def draw_index=(index) @draw_index = index refresh end #-------------------------------------------------------------------------- # ◎ 描画ページの修正を設定 #-------------------------------------------------------------------------- def page_fix case @draw_index when 100..199 ; @draw_index = 100 when 200..299 ; @draw_index = 200 when 300..399 ; @draw_index = 300 when 400..499 ; @draw_index = 400 when 500..599 ; @draw_index = 500 when 600..699 ; @draw_index = 600 when 700..799 ; @draw_index = 700 end end #-------------------------------------------------------------------------- # ◎ ブロック描画(アイテム) #-------------------------------------------------------------------------- def draw_block_0 draw_text(0, 0, 180, contents.font.size, "アイテム詳細") #アイテム名を描画 draw_item_name(@item, 5, line_height * 1) #残量を表示 change_color(system_color) text = "倉庫収容数" if @system_mode == 0 text = "所持数" if @system_mode == 1 draw_text(5, line_height * 2, 130, contents.font.size, text) change_color(normal_color) num = $game_party.s_item_number(@item).to_s if @system_mode == 0 num = $game_party.item_number(@item).to_s if @system_mode == 1 draw_text(150, line_height * 2, 130, contents.font.size, num) draw_item_effects(5, line_height * 3, @item) end #-------------------------------------------------------------------------- # ◎ 特徴の描画 #-------------------------------------------------------------------------- def draw_item_effects(x,y,item) return unless item effect_max = 0 draw_list = KURE.call_effect_txt(item) effect_max = draw_list.size - 1 #実際の描画処理 for list in 0..effect_max change_color(normal_color) draw_text(x, y + contents.font.size * list , contents.width, contents.font.size, draw_list[list]) end end #-------------------------------------------------------------------------- # ◎ リフレッシュ #-------------------------------------------------------------------------- def refresh contents.clear return unless @item #フォントの設定 last_font = contents.font.size contents.font.size = 20 #タイトルゲージを描画 draw_gauge(0,0, contents.width, 1, mp_gauge_color2,crisis_color) change_color(normal_color) draw_text(0, contents.height - contents.font.size, contents.width, contents.font.size, "← →:表示切り替え",1) if @draw_index != 0 #アイテムの種類で描画を変更 draw_block_0 if @item.is_a?(RPG::Item) if @item.is_a?(RPG::EquipItem) case @draw_index when 100..199 ; draw_index_one when 200..299 ; draw_index_two when 300..399 ; draw_index_three when 400..499 ; draw_index_four when 500..599 ; draw_index_five when 600..699 ; draw_index_six when 700..799 ; draw_index_seven end end end #-------------------------------------------------------------------------- # ◎ 操作説明(draw_index = 100,101) #-------------------------------------------------------------------------- def draw_index_one case @draw_index when 100 ; draw_text(0, 0, 180, contents.font.size, "装備品能力") when 101 ; draw_text(0, 0, 180, contents.font.size, "装備条件") end return unless @item draw_item_name(@item, 5,line_height * 1) case @draw_index when 100 8.times {|i| draw_item_index1_1(0, line_height * 2, i, @item) } draw_equip_type(0,line_height * 1 + contents.font.size * 6, @item) when 101 draw_equip_condition(0, line_height * 1, @item) end end #-------------------------------------------------------------------------- # ◎ 項目の描画(draw_index = 100) #-------------------------------------------------------------------------- def draw_item_index1_1(x, y, param_id, item) if $kure_integrate_script[:ExEquip] return unless KURE::ExEquip::VIEW_PARAM[param_id] draw_id = KURE::ExEquip::VIEW_PARAM[param_id] else draw_id = param_id end left = "" ; left2 = "" pos_x = x + (contents.width / 2) * param_id.modulo(2) pos_y = y + contents.font.size * param_id.div(2) draw_param_name(pos_x, pos_y, draw_id) if item change_color(param_change_color(item.params[draw_id])) left =" " if item.params[draw_id].abs < 100 left =" " if item.params[draw_id].abs < 10 left2 = "+" if item.params[draw_id] > 0 left2 = " " if item.params[draw_id] == 0 end draw_text(pos_x, pos_y, contents.width / 2 - 5, contents.font.size, left + left2 + (item.params[draw_id].abs).to_s, 2) end #-------------------------------------------------------------------------- # ◎ 要求条件の描画(draw_index = 100) #-------------------------------------------------------------------------- def draw_equip_type(x,y,item) 5.times{|index| case index when 1 next unless $kure_integrate_script[:ExEquip] next if KURE::ExEquip::USE_WEIGHT_SYSTEM == 0 when 2,3,4 ; next unless $kure_integrate_script[:SortOut] end pos_y = y + contents.font.size * index case index when 0 ; system_name = KURE::ExEquip::Vocab_EquipType when 1 ; system_name = KURE::ExEquip::Vocab_Weight when 2 ; system_name = KURE::ExEquip::Vocab_EquipExp when 3 ; system_name = KURE::ExEquip::Vocab_Durable when 4 ; system_name = KURE::ExEquip::Vocab_Slot + "(装備/最大)" end next if system_name == "" change_color(system_color) draw_text(x, pos_y, 130, contents.font.size, system_name) case index when 0 if item.is_a?(RPG::Weapon) ; str = $data_system.weapon_types[item.wtype_id] elsif item.is_a?(RPG::Armor) ; str = $data_system.armor_types[item.atype_id] else ; str = "" end when 1 weight = item.weight.to_s revise = item.gain_weight > 0 ? "+" + item.gain_weight.to_s : item.gain_weight.to_s str = weight + " / " + revise when 2 str = item.equip_exp.to_s when 3 str = item.broken? ? "破損中" : item.durable_value when 4 slot_max = item.max_slot_number slot_num = item.slot_list.compact.size str = "(" + slot_num.to_s + " / " + slot_max.to_s + ")" end change_color(normal_color) draw_text(x, pos_y, contents.width - 10, contents.font.size, str, 2) } end #-------------------------------------------------------------------------- # ◎ 操作説明(draw_index = 101) #-------------------------------------------------------------------------- def draw_equip_condition(x, y, item) #装備レベル利用時は要求レベルを描画 line = 1 3.times{|index| case index when 0 ; list = item.need_equip_level ; next if list == [] when 1 ; list = item.need_equip_status ; next if list == [] when 2 ; list = [item.need_equip_val] ; next if list == [[0, 0]] end case index when 0 next unless $kure_integrate_script[:ExEquip] next if KURE::ExEquip::USE_EQUIPLV_SYSTEM == 0 name = "装備可能レベル" when 1 next unless $kure_integrate_script[:ExEquip] next if KURE::ExEquip::USE_EQUIPSTATUS_SYSTEM == 0 name = "装備要求ステータス" when 2 next unless $kure_integrate_script[:ExEquip] next if KURE::ExEquip::USE_EQUIPVAL_SYSTEM == 0 name = "装備要求条件" end change_color(system_color) draw_text(x, y + contents.font.size * line, 150, contents.font.size, name) line += 1 change_color(normal_color) list.each{|block| case index when 0 name = $data_classes[block[0]].name + " " need = block[1] != 0 ? block[1].to_s + "以上 " : "" limit = block[2] != 0 ? block[2].to_s + "以下" : "" str = name + need + limit when 1 name = Vocab::param(block[0]) + " " need = block[1].to_s + "以上" str = name + need when 2 name = $data_system.variables[block[0]] ? $data_system.variables[block[0]] + " " : "特殊条件" need = block[1].to_s + "以上" str = name + need end draw_text(x + 10, y + contents.font.size * line, contents.width - 15, contents.font.size, str) line += 1 } } end #-------------------------------------------------------------------------- # ◎ 操作説明(draw_index = 2) #-------------------------------------------------------------------------- def draw_index_two draw_text(0, 0, 180, contents.font.size, "装備品特徴" + "(" + (@draw_index - 199).to_s + ")" ) draw_item_name(@item, 5,line_height * 1) if @item draw_features(0,line_height * 2,@item) end #-------------------------------------------------------------------------- # ◎ 特徴の描画(draw_index = 200..299) #-------------------------------------------------------------------------- def draw_features(x,y,item) return unless item if $kure_integrate_script[:integrate] draw_list = KURE.call_add_feature_txt(item) else draw_list = KURE.basic_actor_add_feature_txt(item) end first = 0 + 11 * (@draw_index - 200) last = [10 + 11 * (@draw_index - 200), draw_list.size].min draw_list[first..last].each_with_index{|text, index| pos_y = y + contents.font.size * index draw_text(x, pos_y, contents.width, contents.font.size, text) } end #-------------------------------------------------------------------------- # ◎ 習得スキルリスト(draw_index = 3) #-------------------------------------------------------------------------- def draw_index_three draw_text(0, 0, 180, contents.font.size, "習得スキルリスト" + "(" + (@draw_index - 299).to_s + ")" ) draw_item_name(@item, 5,line_height * 1) if @item draw_aplist(0,line_height * 2,@item) end #-------------------------------------------------------------------------- # ◎ APのリストを描画(draw_index = 300..399) #-------------------------------------------------------------------------- def draw_aplist(x,y,item) return unless item draw_list = KURE.call_add_feature(83, item.note) first = 0 + 5 * (@draw_index - 300) last = [4 + 5 * (@draw_index - 300), draw_list.size].min draw_list[first..last].each_with_index{|data, index| pos_y = y + line_height * index * 2 pos_y2 = y + line_height * ((index * 2) + 1) skill = $data_skills[data[0]] value = @actor.call_ability_point(data[0]) text1 = skill.name + "(" + "x" + data[1].to_s + ")" text2 = value.to_s + "/" + "1000" draw_icon(skill.icon_index, x, pos_y) draw_text(x + 30, pos_y + (line_height - contents.font.size) / 2, contents.width, contents.font.size, text1) draw_text(x, pos_y2, contents.width, contents.font.size, text2, 2) } end #-------------------------------------------------------------------------- # ◎ 操作説明(draw_index = 4) #-------------------------------------------------------------------------- def draw_index_four draw_text(0, 0, 180, contents.font.size, KURE::SortOut::Vocab_SlotList + "(" + (@draw_index - 399).to_s + ")" ) draw_item_name(@item, 5,line_height * 1) if @item draw_ss_list(0, line_height * 2, @item, 0) end #-------------------------------------------------------------------------- # ◎ 装備シンボルリスト(draw_index = 5) #-------------------------------------------------------------------------- def draw_index_five draw_text(0, 0, 180, contents.font.size, KURE::SortOut::Vocab_Symbollist + "(" + (@draw_index - 499).to_s + ")" ) draw_item_name(@item, 5,line_height * 1) if @item draw_ss_list(0, line_height * 2, @item, 1) end #-------------------------------------------------------------------------- # ◎ スロット、シンボル内容を描画 #-------------------------------------------------------------------------- def draw_ss_list(x, y, item, mode) return unless item case mode when 0 slot_list = item.slot_list slot_max_size = item.max_slot_number base = 400 when 1 slot_list = item.symbol_list.collect{|obj| obj[0] } slot_max_size = item.max_symbol_number base = 500 end first = 0 + 10 * (@draw_index - base) last = [10 + 10 * (@draw_index - base), slot_max_size].min (last - first).times{|index| pos_y = y + (line_height * index) + 2 id = index + first draw_text(5, pos_y, 25, line_height, id + 1) draw_item_name(slot_list[id], 30, pos_y) if slot_list[id] } end end