# ▽△▽ XRXSv10. MeLT-VX.OP. オプション+プレイトータル ▽△▽ # [伸縮対応] # # publish 2010/ 3/13 # update - 4/28c # #============================================================================== # カスタマイズポイント #============================================================================== module XRXSVMeLTOP # # オプション選択中に使うアイコンインデックス # IconIndex = 102 # # オプションセレクト - 最大 8 個まで # 0 : 画面サイズ # 1 : 戦闘-自動スキップ # 2 : ※移動速度 (X.Move)      ※導入時のみ表示されます # 3 : 常時ダッシュ # 4 : ※バトルスピード (ATBエンジン) # 5 : ※ATBラピッド (ATBエンジン) # 6 : カスタムスイッチ1 # 7 : カスタムスイッチ2 # 8 : カスタムスイッチ3 # 9 : カスタムスイッチ4 # Selects = [0,1,4,5,2,3] # # カスタムスイッチで使うスイッチID(1〜4) # 1 2 3 4 CustomSwitcheIDs = [ 0, 0, 0, 0] # # 用語 # Select_S = "オプション" PlayTs_S = "プレイ記録" # # ウィンドウ背景に使用するウィンドウスキン # ResizeSkin = "Window" # # プレイ時間文字式 # PlayTimeS = "%d時間 %02d分" end #============================================================================== # オプションセレクトウィンドウ - 用語 #============================================================================== class Window_OptionSelect < Window_Selectable def get_settings(select_id) case select_id when 0 texts = ["画面サイズ", "ノーマル","ロング"] on = (Graphics.width == 544) when 1 texts = ["戦闘-オートスキップ", "オン","オフ"] on = $game_system.battle_autoskip when 2 texts = ["移動速度", "ふつう","おそい"] on = ($game_system.xmove_speed == XRXSV5::XMoveSpeed) when 3 texts = ["常時ダッシュ", "オン","オフ"] on = $game_system.auto_dash when 4 texts = ["バトルスピード", "ふつう", "はやい"] on = ($game_system.battle_atbrate == 1) when 5 texts = ["ATBラピッド", "オン", "オフ"] on = !$game_system.battle_atbrapidban when 6 texts = ["カスタムスイッチ1", "オン", "オフ"] on = $game_switches[XRXSVMeLTOP::CustomSwitcheIDs[0]] when 7 texts = ["カスタムスイッチ2", "オン", "オフ"] on = $game_switches[XRXSVMeLTOP::CustomSwitcheIDs[1]] when 8 texts = ["カスタムスイッチ3", "オン", "オフ"] on = $game_switches[XRXSVMeLTOP::CustomSwitcheIDs[2]] when 9 texts = ["カスタムスイッチ4", "オン", "オフ"] on = $game_switches[XRXSVMeLTOP::CustomSwitcheIDs[3]] end return texts, on end end #============================================================================== # オプションコマンド #============================================================================== module XRXSVMeLTOP Commands = [XRXSVMeLTOP::Select_S, XRXSVMeLTOP::PlayTs_S] Works = [0,1] end class Window_OptionCommand < Window_SlideCommand def initialize super(160, XRXSVMeLTOP::Commands) end def command_id return XRXSVMeLTOP::Works[self.index] end end #============================================================================== # システム追加機能 #============================================================================== class Game_System attr_accessor :battle_autoskip attr_accessor :auto_dash end class Scene_Battle < Scene_Base alias xrxsv10op_show_fast? show_fast? def show_fast? return (xrxsv10op_show_fast? or $game_system.battle_autoskip) end end class Game_Player < Game_Character alias xrxsv10op_dash? dash? def dash? return false if @move_route_forcing return false if $game_map.disable_dash? return false if in_vehicle? return (xrxsv10op_dash? or $game_system.auto_dash) end end #============================================================================== # オプション画面 #============================================================================== module XRXSV10OP_UpdateExtra def update_extra return false end def update_extra_command_decide(work_id) end end class Scene_Option < Scene_Base include XRXSV10OP_UpdateExtra #-------------------------------------------------------------------------- # ▽ 開始処理 #-------------------------------------------------------------------------- def start super @command_window = Window_OptionCommand.new create_menu_background @select_window = Window_OptionSelect.new @select_window.contents_opacity = 0 @select_window.active = false @playrecords_window = Window_PlayRecords.new @playrecords_window.contents_opacity = 0 end #-------------------------------------------------------------------------- # ▽ 開始後処理 #-------------------------------------------------------------------------- def post_start end #-------------------------------------------------------------------------- # ▽ フレーム更新 #-------------------------------------------------------------------------- def update return if update_extra if @playrecords_window.active update_playrecords elsif @select_window.active update_wideselect else update_command end end #-------------------------------------------------------------------------- # フレーム更新 - プレイ記録時 #-------------------------------------------------------------------------- def update_playrecords @select_window.contents_opacity -= 32 @playrecords_window.contents_opacity += 32 if Input.trigger?(Input::B) Sound.play_cancel @playrecords_window.active = false @command_window.cancel! end end #-------------------------------------------------------------------------- # フレーム更新 - ワイド選択時 #-------------------------------------------------------------------------- def update_wideselect @select_window.update @select_window.contents_opacity += 32 @playrecords_window.contents_opacity -= 32 if Input.trigger?(Input::B) Sound.play_cancel @select_window.index = -1 @select_window.active = false @command_window.cancel! end if Input.trigger?(Input::C) Sound.play_decision if @select_window.process_decide dispose_menu_background create_menu_background end end end #-------------------------------------------------------------------------- # フレーム更新 - コマンド時 #-------------------------------------------------------------------------- def update_command @command_window.update @select_window.contents_opacity -= 32 @playrecords_window.contents_opacity -= 32 if Input.trigger?(Input::B) Sound.play_cancel return_scene end if Input.trigger?(Input::C) Sound.play_decision @command_window.decide! case @command_window.command_id when 0 @select_window.active = true @select_window.index = 0 when 1 @playrecords_window.refresh @playrecords_window.active = true else update_extra_command_decide(@command_window.command_id) end end end #-------------------------------------------------------------------------- # ▽ 終了前処理 #-------------------------------------------------------------------------- def pre_terminate end #-------------------------------------------------------------------------- # ▽ 終了処理 #-------------------------------------------------------------------------- def terminate super @command_window.dispose @select_window.dispose @playrecords_window.dispose dispose_menu_background end #-------------------------------------------------------------------------- # 元の画面へ戻る #-------------------------------------------------------------------------- def return_scene $scene = Scene_Map.new end end #============================================================================== # オプションセレクトウィンドウ #============================================================================== class Window_OptionSelect < Window_Selectable #-------------------------------------------------------------------------- # オブジェクト初期化 #-------------------------------------------------------------------------- def initialize super(128, 60, 432, 300) self.z += 1 @skin = Cache.system(XRXSVMeLTOP::ResizeSkin) @selects = XRXSVMeLTOP::Selects $game_system.xmove_speed rescue @selects.delete(2) $game_system.battle_atbrate rescue @selects.delete(4) $game_system.battle_atbrapidban rescue @selects.delete(5) @item_max = @selects.size * 2 @column_max = 2 self.index = -1 self.opacity = 0 refresh end #-------------------------------------------------------------------------- # 決定の処理 #-------------------------------------------------------------------------- def process_decide select_id = @selects[self.index / 2] on = (self.index % 2 == 0) case select_id when 0 new_width = (on ? 544 : 640) Graphics.resize_screen(new_width, 416) when 1 $game_system.battle_autoskip = on when 2 $game_system.xmove_speed = (on ? nil : 4) when 3 $game_system.auto_dash = on when 4 $game_system.battle_atbrate = (on ? nil : 0.5) when 5 $game_system.battle_atbrapidban = !on when 6,7,8,9 $game_switches[XRXSVMeLTOP::CustomSwitcheIDs[select_id - 6]] = on end refresh return (select_id == 0) end #-------------------------------------------------------------------------- # リフレッシュ - ウィンドウ背景 #-------------------------------------------------------------------------- def refresh_back skin = Cache.system(XRXSVMeLTOP::ResizeSkin) w = self.contents.width h = self.contents.height draw_rect = Rect.new(0, 0, w, h) skin_rect = Rect.new(0, 0, 64, 64) self.contents.stretch_blt(draw_rect, skin, skin_rect, 64) skin_rect = Rect.new(0, 64, 64, 64) self.contents.stretch_blt(draw_rect, skin, skin_rect, 128) end #-------------------------------------------------------------------------- # リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear refresh_back for i in 0...@item_max/2 draw_line(i) end end #-------------------------------------------------------------------------- # アイテムの描画 #-------------------------------------------------------------------------- def draw_line(index) rect1 = item_rect(index * 2) rect2 = item_rect(index * 2 + 1) x1 = 20 x2 = rect1.x + 26 x3 = rect2.x + 26 y = rect1.y+2 w1 = 128 w2 = rect1.width - 26 w3 = rect2.width - 26 select_id = @selects[index] texts, on = get_settings(select_id) self.contents.font.size = 18 self.contents.draw_text(x1, y, w1, WLH, texts[0]) self.contents.font.size = 20 self.contents.draw_text(x2, y, w2, WLH, texts[1]) self.contents.draw_text(x3, y, w3, WLH, texts[2]) xi = (on ? x2-24 : x3-24) draw_icon(XRXSVMeLTOP::IconIndex, xi, y-1, true) end #-------------------------------------------------------------------------- # アイテムの矩形 #-------------------------------------------------------------------------- def item_rect(index) x = 160 + (index % 2) * 112 y = (index/2) * 28 + 12 w = 112 h = 28 return Rect.new(x, y, w, h) end end #============================================================================== # プレイ記録ウィンドウ #============================================================================== class Window_PlayRecords < Window_Selectable attr_accessor :active #-------------------------------------------------------------------------- # オブジェクト初期化 #-------------------------------------------------------------------------- def initialize super(128, 60, 432, 300) self.opacity = 0 refresh end #-------------------------------------------------------------------------- # リフレッシュ - ウィンドウ背景 #-------------------------------------------------------------------------- def refresh_back skin = Cache.system(XRXSVMeLTOP::ResizeSkin) w = self.contents.width h = self.contents.height draw_rect = Rect.new(0, 0, w, h) skin_rect = Rect.new(0, 0, 64, 64) self.contents.stretch_blt(draw_rect, skin, skin_rect, 64) skin_rect = Rect.new(0, 64, 64, 64) self.contents.stretch_blt(draw_rect, skin, skin_rect, 128) end #-------------------------------------------------------------------------- # リフレッシュ #-------------------------------------------------------------------------- def refresh self.contents.clear refresh_back total_sec = Graphics.frame_count / Graphics.frame_rate hour = total_sec / 60 / 60 min = total_sec / 60 % 60 time_string = sprintf(XRXSVMeLTOP::PlayTimeS, hour, min) captions = [ "プレイ時間", "セーブ回数", "最大レベル", "平均レベル", "歩数", "総獲得" + Vocab.gold, "入手" + Vocab.item + "種類数", "入手" + Vocab.equip + "種類数" ] data = [ time_string, $game_system.save_count.to_s, $game_party.max_level, $game_party.average_level, $game_party.steps, $game_party.playtotal_gold, $game_party.playtotal_items.size.to_s, $game_party.playtotal_equips.size.to_s ] y_offset = 40 for i in 0...captions.size self.contents.draw_text( 32, y_offset + i * WLH, 192, WLH, captions[i], 0) self.contents.draw_text(224, y_offset + i * WLH, 128, WLH, data[i], 2) end end end #============================================================================== # 平均レベルの取得 #============================================================================== class Game_Party < Game_Unit def average_level level = 0 for i in @actors level += $game_actors[i].level end level /= @actors.size return level end end #============================================================================== # 総獲得ゴールドの取得 #============================================================================== class Game_Party < Game_Unit def playtotal_gold @playtotal_gold = 0 if @playtotal_gold == nil return @playtotal_gold end alias xrxsv10_gain_gold gain_gold def gain_gold(n) last_gold = @gold xrxsv10_gain_gold(n) gain_amount = @gold - last_gold if gain_amount >= 1 @playtotal_gold = self.playtotal_gold + gain_amount end end end #============================================================================== # 総獲得アイテム種類数の取得 #============================================================================== class Game_Party < Game_Unit def playtotal_items @playtotal_items = [] if @playtotal_items == nil return @playtotal_items end def playtotal_weapons @playtotal_weapons = [] if @playtotal_weapons == nil return @playtotal_weapons end def playtotal_armors @playtotal_armors = [] if @playtotal_armors == nil return @playtotal_armors end alias xrxsv10_gain_item gain_item def gain_item(item, n, include_equip = false) xrxsv10_gain_item(item, n, include_equip) playtoal_gain_item(item, n) end def playtoal_gain_item(item, n) if n >= 1 and case item when RPG::Item set = self.playtotal_items when RPG::Weapon set = self.playtotal_weapons when RPG::Armor set = self.playtotal_armors end if not set.include?(item.id) set.push(item.id) end end end def playtotal_equips set = self.playtotal_weapons + self.playtotal_armors for actor in $game_party.members for item in actor.equips next if item == nil playtoal_gain_item(item, 1) end end return set end end