# ▽△▽ XRXSv26. MeLT_Item. マテリアルソート+ ▽△▽ # # publish 2010/ 3/19 # update - 11/ 1/15c # #============================================================================== # カスタマイズポイント #============================================================================== module XRXSV26 # # コマンド配列 # #    収納バッグ          ジャンル分け # 0 : パーティアイテム     − 「アイテム」 # 3 : パーティアイテム     − 「だいじなもの」 # 4 : パーティアイテム     − 装備品(武器防具) # 5 : パーティアイテム     − 武器 # 6 : パーティアイテム     − 防具 # 7 : パーティアイテム     − 盾 # 8 : パーティアイテム     − 頭防具 # 9 : パーティアイテム     − 身体防具 # 10 : パーティアイテム     − 装飾品 # 11 : アイテムトラッシュ    − すべて # 12 : パーティマテリアルバッグ − すべて # # 14 : [スライド式個別マテリアルウィンドウセット] # CommandIDs = [14, 5, 6, 3, 11] # # コマンドが1つしかない場合、自動決定する? # AutoSelection = true # # コマンド名称とヘルプテキスト # CommandNames = [ "アイテム", "", "", "だいじなもの", "装備品", "武器", "防具", "盾", "頭", "胴体", "装飾品", "トラッシュ", "ふくろ", "", "バッグ" ] HelpText = [ "アイテムを表示します。", "", "", "だいじなものを表示します。", "全ての装備品を表示します。", "武器を表示します。", "防具を表示します。", "防具・盾を表示します。", "防具・頭を表示します。", "防具・身体を表示します。", "防具・装飾品を表示します。", "アイテムトラッシュを表示します。", "パーティ共通バッグを表示します。", "", "それぞれのバッグを表示します。" ] # # アイテム基本表示行数 # ItemRows = 10 # # マテリアルや「だいじなもの」かつ個数1コのものは、個数表示を消す? # OnlyOnesNumberHiding = true # # スライド式個別マテリアルウィンドウのスライド速度 # SlideSpeed = 24 end #============================================================================== # マテリアルバッグ/トラッシュ機能 #============================================================================== class Game_Party < Game_Unit def bag @bag ||= [] return @bag end def trash @trash ||= [] return @trash end end class Game_Actor < Game_Battler def bag @bag ||= [] return @bag end end #============================================================================== # マテリアル選択確認ウィンドウ #============================================================================== class Window_MaterialCommand < Window_Command def initialize super(128, ["つかう", "いれかえ", "すてる"]) end end #============================================================================== # 「すてる」確認ウィンドウ #============================================================================== class Window_MaterialDumpAplly < Window_Command def initialize(item) str1 = sprintf("%s を捨てる", item.name) str2 = "やめる" super(256, [str1, str2]) self.x = (Graphics.width - self.width ) / 2 self.y = (Graphics.height - self.height) / 2 end end #============================================================================== # アイテムコマンド #============================================================================== class Window_SlideCommand < Window_Command end class Window_ItemCommand < Window_SlideCommand def initialize @clear_style = ((XRXSV10::BG_NAME rescue "").size >= 1) commands = [] @command_ids = self.command_id_data.dup for id in @command_ids commands.push(XRXSV26::CommandNames[id]) end super(160, commands) self.x = -12 self.y = (@clear_style ? 72 : 56) end def command_id_data return XRXSV26::CommandIDs end def update_help id = self.command_id str = XRXSV26::HelpText[id].to_s @help_window.set_text(str) end def command_id return @command_ids[self.index] end end class Window_ItemBack < Window_Selectable def initialize super(0, 56, 544, 304) self.z = 0 end end #============================================================================== # ワイド機能 #============================================================================== class Game_System attr_accessor :wide_screen end #============================================================================== # 拡張ヘルプ #============================================================================== class Window_HelpEX < Window_Help def set(item) self.set_text(item == nil ? "" : item.description) end end #============================================================================== # アイテム対象アイテムの機能 #============================================================================== class RPG::Item def for_item? return true if self.note.include?("\\grinder") or self.note.include?("\\composer") return false end end #============================================================================== # マテリアルダンプ #============================================================================== module XRXSV26_DumpItem def dump_material(material, n) lose_item(material.item, n) end end class Game_Unit include XRXSV26_DumpItem end #============================================================================== # アイテムマテリアル機能への対応 #============================================================================== class RPG::BaseItem attr_accessor :material def materialized? return self.material.is_a?(Material) end end class Material end #============================================================================== # アイテムシーン #============================================================================== class Scene_Item < Scene_Base #-------------------------------------------------------------------------- # ● 開始処理 #-------------------------------------------------------------------------- def start super create_menu_background @clear_style = ((XRXSV10::BG_NAME rescue "").size >= 1) @actor = $game_party.members[0] @material_windowset = Windowset_Material.new create_command_window unless @clear_style @back_window = Window_ItemBack.new end @item_window = Window_MenuItem.new @viewport = Viewport.new(0, 0, Graphics.width, Graphics.height) @help_window = Window_HelpEX.new @help_window.y = Graphics.height - @help_window.height @help_window.z -= 3 @item_window.help_window = @help_window @command_window.help_window = @help_window @target_window = Window_MenuStatus.new(0, 0) @target_window.z += 3 @material_windowset.help_window = @help_window @material_command_window = Window_MaterialCommand.new @material_command_window.openness = 0 @material_command_enable = [true, true, true] @last_command_index = -2 @item_window_saving = @item_window #* @item_to_item_mode = false @item_to_item = nil @material_sort_mode = false update_check_item_window_index @command_window.update_help hide_target_window @material_windowset.active = false @material_command_window.active = false @item_window.active = false @command_window.slidein! rescue nil if auto_command_select? process_decide_command end end def auto_command_select? return (XRXSV26::CommandIDs.size == 1 and XRXSV26::AutoSelection) end def create_command_window @command_window = Window_ItemCommand.new if @actor @actorstatus_window = Window_SkillStatus.new(0, 0, @actor) end end #-------------------------------------------------------------------------- # ● 終了処理 #-------------------------------------------------------------------------- def terminate super dispose_menu_background @back_window.dispose if @back_window != nil @actorstatus_window.dispose if @actorstatus_window != nil @viewport.dispose @command_window.dispose @item_window.dispose @help_window.dispose @target_window.dispose @material_windowset.dispose @material_command_window.dispose end #-------------------------------------------------------------------------- # ● フレーム更新 #-------------------------------------------------------------------------- def update super update_menu_background @material_windowset.update @item_window.update if @item_window == @item_window_saving @material_command_window.update if @material_command_window @command_window.update @target_window.update @help_window.update return if update_extra if @target_window.active update_target_selection elsif @dumpaplly_window update_dump_aplly elsif @material_command_window.active update_material_command elsif @item_window_saving.active or @material_windowset.active update_item elsif @command_window.active update_command end end #-------------------------------------------------------------------------- # フレーム更新 - 追加部分 #-------------------------------------------------------------------------- def update_extra return false end #-------------------------------------------------------------------------- # フレーム更新 - コマンド #-------------------------------------------------------------------------- def update_command update_check_item_window_index if Input.trigger?(Input::B) Sound.play_cancel return_scene elsif Input.trigger?(Input::C) Sound.play_decision process_decide_command end end def process_decide_command @command_window.decide! rescue nil @command_window.active = false if @command_window.command_id == 14 @material_windowset.active = true @material_windowset.index = 0 else @item_window.set_cursor_last_index @item_window.active = true end end #-------------------------------------------------------------------------- # コマンドウィンドウのカーソルが移動したかどうかの判定と処理 #-------------------------------------------------------------------------- def update_check_item_window_index if @last_command_index != @command_window.index @last_command_index = @command_window.index if @command_window.command_id == 14 @material_windowset.visible = true @item_window.visible = false else @material_windowset.visible = false @item_window.visible = true @item_window.set_refresh(@command_window.command_id) end end end #-------------------------------------------------------------------------- # フレーム更新 - アイテム選択の更新 #-------------------------------------------------------------------------- def update_item if Input.trigger?(Input::B) Sound.play_cancel if @item_to_item_mode @item_to_item_mode = false @item_to_item = nil @item_window.cursor2_dispose! @material_windowset.enable_type(0) elsif @material_sort_mode @material_sort_mode = false @material_windowset.cursor2_dispose! elsif auto_command_select? @item_window = @item_window_saving return_scene else @item_window = @item_window_saving @command_window.cancel! rescue nil @command_window.active = true @item_window.active = false @item_window.index = -1 @material_windowset.index = -1 @material_windowset.active = false @material_windowset.page_reset! end elsif Input.trigger?(Input::C) #and XRXSV26::CommandIDs[@command_window.index] == 0 if @item_to_item_mode done = false @item = @material_windowset.item if @item and @item_to_item != @item if @item_to_item.note.include?("\\grinder") if @item.materialized? done = @item.material.gp_plus(@item_to_item.parameter_points) end elsif @item_to_item.note.include?("\\composer") if @item.materialized? done = @item.material.compose(@item_to_item.material) end end end if done Sound.play_decision $game_party.consume_item(@item_to_item) @item_to_item_mode = false @item_to_item = nil @material_windowset.cursor2_dispose! material_window_refresh @material_windowset.enable_type(0) else Sound.play_buzzer end elsif @material_sort_mode Sound.play_decision @material_windowset.go_sort! material_window_refresh @material_sort_mode = false elsif @command_window.command_id == 14 Sound.play_decision @item_window = @material_windowset.active_window @material_windowset.active = false open_material_command else update_item_selection end end end #-------------------------------------------------------------------------- # マテリアルコマンドを開く #-------------------------------------------------------------------------- def open_material_command x = 64 + @material_windowset.active_dest_x y = 72 + @material_windowset.y + 24 * @material_windowset.index if y + @material_command_window.height >= 340 y -= @material_command_window.height + 24 end item = @material_windowset.item @material_command_enable[0] = $game_party.item_can_use?(item) @material_command_enable[1] = (item != nil) @material_command_enable[2] = (item != nil and item.price >= 1) @material_command_window.draw_item(0, @material_command_enable[0]) @material_command_window.draw_item(1, @material_command_enable[1]) @material_command_window.draw_item(2, @material_command_enable[2]) @material_command_window.x = x @material_command_window.y = y @material_command_window.openness = 0 @material_command_window.open @material_command_window.index = 0 @material_command_window.active = true end #-------------------------------------------------------------------------- # マテリアルコマンド選択の更新 #-------------------------------------------------------------------------- def update_material_command if Input.trigger?(Input::B) Sound.play_cancel @material_windowset.active = true @material_command_window.active = false @material_command_window.close elsif Input.trigger?(Input::C) if not @material_command_enable[@material_command_window.index] Sound.play_buzzer else case @material_command_window.index when 0 # つかう update_item_selection when 1 # いれかえ Sound.play_decision @material_sort_mode = true @material_windowset.cursor2_copy! @material_command_window.close @material_command_window.active = false @material_windowset.active = true when 2 # すてる Sound.play_decision @material_command_window.active = false @material_command_window.close @dumpaplly_window = Window_MaterialDumpAplly.new(@material_windowset.item) end end end end #-------------------------------------------------------------------------- # アイテムの決定 #-------------------------------------------------------------------------- alias xrxsv26_determine_item determine_item def determine_item if @item.for_item? and @command_window.command_id == 14 @material_command_window.close @material_command_window.active = false @material_windowset.active = true @material_windowset.cursor2_copy! @item_to_item_mode = true @item_to_item = @item if @item_to_item.note.include?("\\grinder") @material_windowset.enable_type(1) elsif @item_to_item.note.include?("\\composer") @material_windowset.enable_type(2) end else xrxsv26_determine_item end end #-------------------------------------------------------------------------- # 「すてる」確認選択の更新 #-------------------------------------------------------------------------- def update_dump_aplly @dumpaplly_window.update if Input.trigger?(Input::B) or (Input.trigger?(Input::C) and @dumpaplly_window.index == 1) Sound.play_cancel @dumpaplly_window.dispose @dumpaplly_window = nil @material_windowset.active = true elsif Input.trigger?(Input::C) and @dumpaplly_window.index == 0 Sound.play_decision @dumpaplly_window.dispose @dumpaplly_window = nil @material_windowset.active = true material = @material_windowset.item.material $game_party.dump_material(material, 1) material_window_refresh @item_window_saving.clear_trash_cashe end end #-------------------------------------------------------------------------- # ● ターゲットウィンドウの表示 #-------------------------------------------------------------------------- alias xrxsv26_show_target_window show_target_window def show_target_window(right) xrxsv26_show_target_window(true) @target_window.x += 16 @target_window.slidein! rescue nil @item_window.cursor2_copy! rescue nil @item_window.contents_opacity = 96 @material_command_window.active = false @material_command_window.close end #-------------------------------------------------------------------------- # ● ターゲットウィンドウの非表示 #-------------------------------------------------------------------------- def hide_target_window @item_window.contents_opacity = 255 @item_window.active = true @target_window.visible = false @target_window.active = false @material_windowset.active = (@command_window.command_id == 14) @item_window.cursor2_dispose! rescue nil @viewport.rect.set(0, 0, Graphics.width, Graphics.height) @viewport.ox = 0 end #-------------------------------------------------------------------------- # ● アイテムの使用 (味方対象以外の使用効果を適用) #-------------------------------------------------------------------------- alias xrxsv26_use_item_nontarget use_item_nontarget def use_item_nontarget @item_window_saving.clear_trash_cashe xrxsv26_use_item_nontarget material_window_refresh end #-------------------------------------------------------------------------- # マテリアルウィンドウ関連のリフレッシュ #-------------------------------------------------------------------------- def material_window_refresh @actorstatus_window.refresh if @actorstatus_window != nil @material_windowset.refresh @item_window = @material_windowset.active_window if (@command_window.command_id == 14) end end #============================================================================== # --- カーソルコピー機能 --- #============================================================================== class Window_MenuItem < Window_Item include XRXSV_CursorCopy rescue nil end #============================================================================== # メニューアイテムウィンドウ #============================================================================== class Window_MenuItem < Window_Item #-------------------------------------------------------------------------- # ▽ オブジェクト初期化 #-------------------------------------------------------------------------- def initialize h = XRXSV26::ItemRows * WLH + 32 y = [(Graphics.height - h) / 2, 56].max x = 144 w = 544 - x @slide_count = 0 @data = [] @bitmap_cache = [] @data_cache = [] @set_index = -1 @set_index_old = -1 super(x, y, w, h) @spacing = 8 @set_index = XRXSV26::CommandIDs[0] refresh @original_x = self.x self.index = -1 self.opacity = 0 end #-------------------------------------------------------------------------- # ▽ 解放 #-------------------------------------------------------------------------- def dispose super for cache in @bitmap_cache cache.dispose if cache != nil end end #-------------------------------------------------------------------------- # セット (ジャンル変更時) #-------------------------------------------------------------------------- def set_refresh(index) @set_index = index @data.clear case index when 0 for item in $game_party.items if item.is_a?(RPG::Item) and $game_party.item_can_use?(item) and item.price >= 1 add_item(item) end end for item in $game_party.items if item.is_a?(RPG::Item) and not $game_party.item_can_use?(item) and item.price >= 1 add_item(item) end end when 3 for item in $game_party.items if item.is_a?(RPG::Item) and item.price == 0 add_item(item) end end when 4 for item in $game_party.items add_item(item) if item.is_a?(RPG::Weapon) or item.is_a?(RPG::Armor) end when 5 for item in $game_party.items add_item(item) if item.is_a?(RPG::Weapon) end when 6 for item in $game_party.items add_item(item) if item.is_a?(RPG::Armor) end when 7..10 for item in $game_party.items add_item(item) if item.is_a?(RPG::Armor) and item.kind == (index - 7) end when 11 for material in $game_party.trash add_item(material.item) end when 12 # パーティかばん for material in $game_party.bag add_item(material.item) end when 14 # when 101..200 # 個人かばん holder = $game_actors[@set_index - 100] for material in holder.bag add_item(material.item) end end @data.push(nil) if include?(nil) @data.push(nil) if @data.size == 0 @item_max = @data.size if @set_index_old == -1 or self.contents != @bitmap_cache[@set_index_old] self.contents.dispose end cache = @bitmap_cache[@set_index] if cache == nil self.contents = Bitmap.new(1,1) create_contents for i in 0...@item_max draw_item(i) end @bitmap_cache[@set_index] = self.contents @data_cache[@set_index] = @data else self.contents = cache @data = @data_cache[@set_index] @item_max = @data.size end self.index = -1 @set_index_old = @set_index end #-------------------------------------------------------------------------- # ▽ リフレッシュ (内容更新時・キャッシュクリア) #-------------------------------------------------------------------------- def refresh if @set_index >= 0 last_index = self.index clear_cache(@set_index) clear_cache(11) set_refresh(@set_index) self.index = [last_index, @data.size - 1].min end end def clear_trash_cashe clear_cache(11) end def clear_cache(set_index) cache = @bitmap_cache[set_index] if cache and cache != self.contents cache.dispose end @bitmap_cache[set_index] = nil end #-------------------------------------------------------------------------- # アイテムの追加 #-------------------------------------------------------------------------- def add_item(item) if include?(item) @data.push(item) if item.is_a?(RPG::Item) and item.id == $game_party.last_item_id self.index = @data.size - 1 end end end #-------------------------------------------------------------------------- # カーソルを記憶位置に #-------------------------------------------------------------------------- def set_cursor_last_index self.index = 0 for i in 0...@item_max item = @data[i] if item.is_a?(RPG::Item) and item.id == $game_party.last_item_id self.index = i break end end end #-------------------------------------------------------------------------- # ▼ 項目の描画 #-------------------------------------------------------------------------- def draw_item(index) rect = item_rect(index) self.contents.clear_rect(rect) item = @data[index] if item != nil number = $game_party.item_number(item) enabled = enable?(item) rect.width -= 4 draw_item_name(item, rect.x, rect.y, enabled) if XRXSV26::OnlyOnesNumberHiding and number == 1 and (item.price == 0 or (item.materialized? and item.material.stackable?)) #-- else self.contents.draw_text(rect, sprintf("x%2d", number), 2) end end end #-------------------------------------------------------------------------- # アイテムの描画 (サイズダウン) #-------------------------------------------------------------------------- def draw_item_name(item, x, y, enabled = true) if item != nil width = [self.contents.text_size(item.name).width, 120].min width = width * ($game_system.wide_screen ? 3 : 4) / 4 draw_icon(item.icon_index, x, y, enabled) original_font = self.contents.font.dup self.contents.font.size = 18 self.contents.font.color = normal_color self.contents.font.color.alpha = enabled ? 255 : 128 self.contents.draw_text(x + 24, y, width, WLH, item.name) self.contents.font = original_font end end #-------------------------------------------------------------------------- # ▽ ヘルプテキスト更新 #-------------------------------------------------------------------------- def update_help @help_window.set(item) end end #============================================================================== # メニューマテリアルウィンドウセット #============================================================================== class Windowset_Material MaterialMAX = 8 attr_accessor :active attr_accessor :active_window #-------------------------------------------------------------------------- # オブジェクト初期化と解放 #-------------------------------------------------------------------------- def initialize(indent_x = 144) @indent_x = indent_x @material_windows = [] x = 128 z = 51 for actor in $game_party.members x += 160 z += 4 window = Window_MenuMaterial.new(actor, 0) window.x = 128 window.z = z @material_windows.push(window) end n = $game_party.bag.size m = (XRXSV50::PartyBagPageMAX rescue 0) * MaterialMAX n += 1 if m != n bag_pages = (n + MaterialMAX - 1) / MaterialMAX for i in 0...bag_pages x += 160 z += 4 window = Window_MenuMaterial.new($game_party, i * MaterialMAX) window.x = 128 window.z = z @material_windows.push(window) end @dest_x = [] @window_index = 0 @active = false @fix_window = nil @fix_bag_index = 0 @enable_type = 0 @active_window = @material_windows[0] calc_dest_xd end def dispose for window in @material_windows window.dispose end end #-------------------------------------------------------------------------- # フレーム更新 #-------------------------------------------------------------------------- def update update_window_position for window in @material_windows window.active = self.active window.update end return if not self.active if Input.repeat?(Input::RIGHT) next_window(1) elsif Input.repeat?(Input::LEFT) next_window(-1) end update_help end def update_window_position for i in 0...@material_windows.size window = @material_windows[i] n = window.x - @dest_x[i] m = (n < 0 ? 1 : -1) * [n.abs, XRXSV26::SlideSpeed].min window.x += m end end #-------------------------------------------------------------------------- # ウィンドウのセット/位置計算 #-------------------------------------------------------------------------- def next_window(n) last_index = 0 if @active_window last_index = @active_window.index @active_window.index = -1 end if n == 0 @window_index = 0 elsif Input.trigger?(Input::LEFT) or Input.trigger?(Input::RIGHT) Sound.play_cursor @window_index = (@window_index + n) % @material_windows.size elsif n == 1 and @window_index < @material_windows.size - 1 Sound.play_cursor @window_index += 1 elsif n == -1 and @window_index >= 1 Sound.play_cursor @window_index -= 1 end @active_window = @material_windows[@window_index] @active_window.index = last_index calc_dest_xd end def calc_dest_xd dest_xd = 0 for i in 0...@material_windows.size @dest_x[i] = @indent_x + dest_xd if @fix_window == @material_windows[i] dest_xd += 192 elsif @window_index > i dest_xd += 8 else dest_xd += 192 end end end def page_reset! next_window(0) end #-------------------------------------------------------------------------- # リフレッシュ #-------------------------------------------------------------------------- def refresh n = $game_party.bag.size m = (XRXSV50::PartyBagPageMAX rescue 0) * MaterialMAX n += 1 if m != n bag_pages = (n + MaterialMAX - 1) / MaterialMAX offset_max = bag_pages * MaterialMAX for i in 0...@material_windows.size window = @material_windows[i] if window.holder == $game_party and window.index_offset >= offset_max window.dispose @material_windows[i] = nil @active_window = nil if @active_window == window end end @material_windows.compact! for window in @material_windows window.refresh end next_window(-1) while @window_index >= @material_windows.size end def full_refresh refresh end #-------------------------------------------------------------------------- # 有効状態の設定 # (0:使用、1:グラインド、2:合成ベース、3:合成材料、4:すてる) #-------------------------------------------------------------------------- def enable_type(type) for window in @material_windows window.enable_type = type end @enable_type = type full_refresh end #-------------------------------------------------------------------------- # 第二カーソルと交換処理 #-------------------------------------------------------------------------- def cursor2_copy! @fix_window = @active_window @fix_window.cursor2_copy! rescue nil @fix_bag_index = @fix_window.index + @fix_window.index_offset for window in @material_windows window.space_on end end def cursor2_dispose! @fix_window.cursor2_dispose! rescue nil @fix_window = nil for window in @material_windows window.space_off end end def go_sort! return unless @fix_window bag_index = @active_window.index + @active_window.index_offset material1 = @fix_window.holder.bag[@fix_bag_index] material2 = @active_window.holder.bag[bag_index] @fix_window.holder.bag[@fix_bag_index] = material2 @active_window.holder.bag[bag_index] = material1 @active_window.holder.bag.compact! @fix_window.holder.bag.compact! @active_window.refresh @fix_window.refresh ($game_party.check_material_overcarry rescue nil) cursor2_dispose! end #-------------------------------------------------------------------------- # ウィンドウの様に働かせるためのメソッド群 #-------------------------------------------------------------------------- def update_help @active_window.update_help end def help_window=(help_window) for window in @material_windows window.help_window = help_window end end def visible=(b) for window in @material_windows window.visible = b end end def index=(n) @active_window.index = n end def index return @active_window.index end def item return @active_window.item end def active_dest_x return @dest_x[@window_index].to_i end def y return @active_window.y end end #---------------------------------------------------------------------------- # メニューマテリアルウィンドウ単品 #---------------------------------------------------------------------------- class Window_MenuMaterial < Window_Item include XRXSV_CursorCopy rescue nil MaterialMAX = 8 attr_accessor :holder attr_reader :index_offset attr_accessor :enable_type #-------------------------------------------------------------------------- # オブジェクト初期化 #-------------------------------------------------------------------------- def initialize(holder, index_offset = 0) @holder = holder @index_offset = index_offset @enable_type = 0 @item_max = 1 super(0, 72, 172 + 32, MaterialMAX * 24 + 64) @original_windowskin = self.windowskin bitmap = Bitmap.new(128,128) bitmap.blt(0,0, self.windowskin, Rect.new(0,0,128,128)) bitmap.clear_rect(Rect.new(66,2,60,60)) self.windowskin = bitmap self.opacity = 224 @column_max = 1 refresh self.index = -1 end def item_rect(index) rect = super(index) rect.y += 32 return rect end def clear_trash_cashe end def index=(n) if n >= @item_max n = @item_max - 1 end super(n) end def x=(n) @contents_viewport.rect.x += (n - self.x) if @contents_viewport super(n) end #-------------------------------------------------------------------------- # リフレッシュ #-------------------------------------------------------------------------- def refresh @data = [] return if @column_max == 2 # 軽量化 for i in 0...MaterialMAX material = @holder.bag[@index_offset + i] if material @data[i] = material.item else @data[i] = nil end end @data.compact! @data.push(nil) if @data.size == 0 @item_max = @data.size self.index = self.index create_contents if @holder.is_a?(Game_Actor) self.contents.blt(0, 0, @holder.miniface, @holder.miniface.rect) rescue nil self.contents.draw_text(48,0,124,WLH, @holder.name) elsif (XRXSV50::PartyBagPageMAX rescue 0) >= 1 and @index_offset / 8 >= (XRXSV50::PartyBagPageMAX rescue 0) self.contents.draw_text(0,0,172,WLH, "持ちきれないアイテム") else str = XRXSV26::CommandNames[12].to_s + (@index_offset / MaterialMAX + 1).to_s self.contents.draw_text(0,0,172,WLH, str) end skin_rect = Rect.new(80,0,32,16) dest_rect = Rect.new(0, WLH, 172,8) self.contents.stretch_blt(dest_rect, @original_windowskin, skin_rect) for i in 0...@item_max draw_item(i) end end #-------------------------------------------------------------------------- # 末尾空白の追加と削除 #-------------------------------------------------------------------------- def space_on n = @data.size if n < MaterialMAX @data[n] = nil @item_max = @data.size draw_item(n) end end def space_off n = @data.size if n >= 2 and @data[n-1] == nil @data.pop @item_max = @data.size draw_item(n-1) end end #-------------------------------------------------------------------------- # ▼ 項目の描画 #-------------------------------------------------------------------------- def draw_item(index) rect = item_rect(index) self.contents.clear_rect(rect) item = @data[index] enabled = enable?(item) rect.width -= 4 draw_item_name(item, rect.x, rect.y, enabled) if item and item.material.stackable? number = $game_party.item_number(item) str = sprintf("x%2d", number) self.contents.font.size = 18 text_rect = self.contents.text_size(str) w = text_rect.width * 3 / 4 rect.x += rect.width - w rect.width = w self.contents.draw_text(rect, str, 2) end end #-------------------------------------------------------------------------- # ▽ アイテムを許可状態で表示するかどうか #-------------------------------------------------------------------------- def enable?(item) if item and item.materialized? case @enable_type when 1 # グラインダー可能 return item.material.grindable? when 2 # 合成ベースに選択可能 return item.material.composable? when 3 # 構成素材に使用可能 return item.material.compose_usable? when 4 # 「すてる」ことができるもの return item.price >= 1 when 5 # 精霊ジェネレートできるもの return item.material.spiritualizable? end end return super end #-------------------------------------------------------------------------- # アイテムの描画 (サイズダウン) #-------------------------------------------------------------------------- def draw_item_name(item, x, y, enabled = true) if item != nil draw_icon(item.icon_index, x, y, enabled) text = item.name alpha = enabled ? 255 : 128 else text = "---" alpha = 128 end width = [self.contents.text_size(text).width, 122].min width = width * ($game_system.wide_screen ? 3 : 4) / 4 original_font = self.contents.font.dup self.contents.font.size = 18 self.contents.font.color = normal_color if item and item.materialized? and item.material.spiritual self.contents.font.color = text_color(23) end self.contents.font.color.alpha = alpha self.contents.draw_text(x + 24, y, width, WLH, text) self.contents.font = original_font end #-------------------------------------------------------------------------- # ▽ ヘルプテキスト更新 #-------------------------------------------------------------------------- def update_help @help_window.set(self.item) if @help_window end end #============================================================================== # --- ターゲットウィンドウ用メニューステータスへの対応 --- #============================================================================== module XRXSV26TargetSlidable def slidable_scenes return super + [Scene_Item] end end class Window_MenuStatus < Window_Selectable include XRXSV26TargetSlidable end