#============================================================================== # ■ セーブのバックアップ作成 #------------------------------------------------------------------------------ #  セーブデータのバックアップを作ります # バックアップを引き出す際に参考に出来るメモ帳も同時に作成します #============================================================================== module An_BackFile #バックアップデータのファイルです。 File = "Backup" #バックアップファイルの付属メモに書き込む内容 #↓消さないで Note = [] #アクターのステータス(パーティ内) Note[1] = true #アクターの装備(パーティ内) Note[2] = true #プレイ時間 Note[3] = true end #============================================================================== # ■ Scene_File #============================================================================== class Scene_File < Scene_Base #-------------------------------------------------------------------------- # ● バックアップ時の時刻取得 #-------------------------------------------------------------------------- def an_make_backup_get_time time = "#{Time.now.strftime('%Y年%m月%d日 %H時%M分%S秒')}" return time end #-------------------------------------------------------------------------- # ● ファイル名の作成 #-------------------------------------------------------------------------- def an_make_backup_filename(file_index, time) if An_BackFile::File != "" text = "#{An_BackFile::File}/Save" else text = "Save" end return text + "#{file_index + 1} #{$an_backcount} #{time}.rvdata" end #-------------------------------------------------------------------------- # ● ファイル名の作成(メモ帳) #-------------------------------------------------------------------------- def an_make_backup_notename(file_index, time) if An_BackFile::File != "" text = "#{An_BackFile::File}/Save" else text = "Save" end return text + "#{file_index + 1} #{$an_backcount} #{time}.txt" end #-------------------------------------------------------------------------- # ● セーブの実行 #-------------------------------------------------------------------------- alias an_backfile_do_save do_save def do_save time = an_make_backup_get_time file = File.open(an_make_backup_filename(@index, time), "wb") write_save_data(file) file.close if An_BackFile::Note.include?(true) file = File.open(an_make_backup_notename(@index, time), "w") file.write(create_note_data(file)) file.close end an_backfile_do_save end #-------------------------------------------------------------------------- # ● メモ帳の作成 #-------------------------------------------------------------------------- def create_note_data(file) data = "" for actor in $game_party.members if An_BackFile::Note[1] data += "名前 #{actor.name} \n" data += "#{Vocab.hp} #{actor.hp}/#{actor.maxhp}\n" data += "#{Vocab.mp} #{actor.mp}/#{actor.maxmp}\n" data += "#{Vocab.atk} #{actor.atk}\n" data += "#{Vocab.def} #{actor.def}\n" data += "#{Vocab.spi} #{actor.spi}\n" data += "#{Vocab.agi} #{actor.agi}\n" data += "\n" end if An_BackFile::Note[2] data += "名前 #{actor.name} \n" unless An_BackFile::Note[1] data += "装備\n" for items in actor.equips if items != nil data += "#{items.name}" else data += "装備なし" end data += "\n" end data += "\n" end end if An_BackFile::Note[3] data += "プレイ時間\n" hour = Graphics.frame_count / 60 / 60 min = Graphics.frame_count / 60 % 60 sec = Graphics.frame_count % 60 time_string = sprintf("%02d:%02d:%02d", hour, min, sec) data += time_string + "\n" data += "\n" end return data end end