From 7b802d971041e7335548ddce6d7492ea256c94fc Mon Sep 17 00:00:00 2001 From: jianmingyong Date: Mon, 6 Mar 2017 20:04:41 +0800 Subject: [PATCH] Better backup save with some error prompts --- .../2.5DHero/Network/Profiles/GamejoltSave.vb | 32 +- 2.5DHero/2.5DHero/Player/Player.vb | 608 +++--------------- .../Screens/MainMenu/MainMenuScreen.vb | 210 ++++++ 3 files changed, 309 insertions(+), 541 deletions(-) diff --git a/2.5DHero/2.5DHero/Network/Profiles/GamejoltSave.vb b/2.5DHero/2.5DHero/Network/Profiles/GamejoltSave.vb index 6cae88874..bbf920929 100644 --- a/2.5DHero/2.5DHero/Network/Profiles/GamejoltSave.vb +++ b/2.5DHero/2.5DHero/Network/Profiles/GamejoltSave.vb @@ -186,22 +186,22 @@ Namespace GameJolt End Get End Property - Private _apricorns As String = "" - Private _berries As String = "" - Private _box As String = "" - Private _daycare As String = "" - Private _itemData As String = "" - Private _items As String = "" - Private _NPC As String = "" - Private _options As String = "" - Private _party As String = "" - Private _player As String = "" - Private _pokedex As String = "" - Private _register As String = "" - Private _hallOfFame As String = "" - Private _secretBase As String = "" - Private _roamingPokemon As String = "" - Private _statistics As String = "" + Public _apricorns As String = "" + Public _berries As String = "" + Public _box As String = "" + Public _daycare As String = "" + Public _itemData As String = "" + Public _items As String = "" + Public _NPC As String = "" + Public _options As String = "" + Public _party As String = "" + Public _player As String = "" + Public _pokedex As String = "" + Public _register As String = "" + Public _hallOfFame As String = "" + Public _secretBase As String = "" + Public _roamingPokemon As String = "" + Public _statistics As String = "" Public AchievedEmblems As New List(Of String) Public DownloadedSprite As Texture2D = Nothing diff --git a/2.5DHero/2.5DHero/Player/Player.vb b/2.5DHero/2.5DHero/Player/Player.vb index 86e86d61d..52a210b72 100644 --- a/2.5DHero/2.5DHero/Player/Player.vb +++ b/2.5DHero/2.5DHero/Player/Player.vb @@ -567,528 +567,6 @@ Entity.MakeShake = Name.ToLower() = "drunknilllzz" - ''' Backup Save module - ''' 1. Encrypted OverWrite Save. - ''' 2. OverWrite Save. - ''' 3. Backup Save. - If filePrefix = "GAMEJOLTSAVE" AndAlso Core.GameOptions.Extras.Contains("Backup Save") Then - If Not Directory.Exists(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID) Then - Directory.CreateDirectory(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID) - End If - - If (File.Exists(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\Encrypted\Encrypted.dat")) Then - Dim Items() As String = File.ReadAllText(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID.ToString() & "\Encrypted\Encrypted.dat").Split(CChar("|")) - Dim Hash As String = String.Join("|", Items.Take(16)) - - Try - If Items.Count = 17 AndAlso String.Equals(Hash, Encryption.DecryptString(Items.Last, StringObfuscation.Obfuscate(GameJoltSave.GameJoltID))) Then - Core.Player.ApricornData = Encryption.DecryptString(Items(0), StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) - Core.Player.BerryData = Encryption.DecryptString(Items(1), StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) - Core.Player.BoxData = Encryption.DecryptString(Items(2), StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) - Core.Player.DaycareData = Encryption.DecryptString(Items(3), StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) - Core.Player.HallOfFameData = Encryption.DecryptString(Items(4), StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) - Core.Player.ItemData = Encryption.DecryptString(Items(5), StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) - - Inventory.Clear() - Mails.Clear() - Dim Data As String = Encryption.DecryptString(Items(6), StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) - If Not String.IsNullOrWhiteSpace(Data) Then - For Each ItemDat As String In Data.SplitAtNewline() - If Not String.IsNullOrWhiteSpace(ItemDat) Then - If ItemDat.StartsWith("{") AndAlso ItemDat.EndsWith("}") AndAlso ItemDat.Contains("|") Then - Dim ItemID As String = ItemDat.Remove(0, ItemDat.IndexOf("{") + 1) - ItemID = ItemID.Remove(ItemID.IndexOf("}")) - - Dim amount As Integer = CInt(ItemID.Remove(0, ItemID.IndexOf("|") + 1)) - ItemID = ItemID.Remove(ItemID.IndexOf("|")) - - Inventory.AddItem(CInt(ItemID), amount) - ElseIf ItemDat.StartsWith("Mail|") Then - Dim mailData As String = ItemDat.Remove(0, 5) - Mails.Add(Game.Items.MailItem.GetMailDataFromString(mailData)) - End If - End If - Next - End If - - Core.Player.NPCData = Encryption.DecryptString(Items(7), StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) - - Data = Encryption.DecryptString(Items(8), StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) - For Each Line As String In Data.SplitAtNewline() - If Line.Contains("|") Then - Dim ID As String = Line.Remove(Line.IndexOf("|")) - Dim Value As String = Line.Remove(0, Line.IndexOf("|") + 1) - Select Case ID.ToLower() - Case "fov" - startFOV = CSng(Value.Replace(".", GameController.DecSeparator)).Clamp(1, 179) - Case "textspeed" - TextBox.TextSpeed = CInt(Value) - Case "mousespeed" - startRotationSpeed = CInt(Value) - End Select - End If - Next - - Pokemons.Clear() - Dim PokeData As String = Encryption.DecryptString(Items(9), StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) - For Each Line As String In PokeData.SplitAtNewline() - If Line.StartsWith("{") AndAlso Line.EndsWith("}") Then - Dim p As Pokemon = Pokemon.GetPokemonByData(Line) - If p.IsEgg() = False Then - If p.IsShiny = True Then - PokedexData = Pokedex.ChangeEntry(PokedexData, p.Number, 3) - Else - PokedexData = Pokedex.ChangeEntry(PokedexData, p.Number, 2) - End If - End If - Pokemons.Add(p) - End If - Next - - Data = Encryption.DecryptString(Items(10), StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) - Screen.Level.Riding = False - For Each Line As String In Data.SplitAtNewline() - If Not String.IsNullOrWhiteSpace(Line) AndAlso Line.Contains("|") Then - Dim ID As String = Line.Remove(Line.IndexOf("|")) - Dim Value As String = Line.Remove(0, Line.IndexOf("|") + 1) - Select Case ID.ToLower() - Case "name" - Name = CType(IIf(IsGameJoltSave, GameJolt.API.username, Value), String) - Case "position" - Dim v() As String = Value.Split(CChar(",")) - startPosition.X = CSng(v(0).Replace(".", GameController.DecSeparator)) - startPosition.Y = CSng(v(1).Replace(".", GameController.DecSeparator)) - startPosition.Z = CSng(v(2).Replace(".", GameController.DecSeparator)) - Case "lastpokemonposition" - Dim v() As String = Value.Split(CChar(",")) - LastPokemonPosition.X = CSng(v(0).Replace(".", GameController.DecSeparator)) - LastPokemonPosition.Y = CSng(v(1).Replace(".", GameController.DecSeparator)) - LastPokemonPosition.Z = CSng(v(2).Replace(".", GameController.DecSeparator)) - Case "mapfile" - startMap = Value - Case "rivalname" - RivalName = Value - Case "money" - Money = CInt(Value) - Case "badges" - Badges.Clear() - If Value = "0" Then - Badges = New List(Of Integer) - Else - If Value.Contains(",") = False Then - Badges = {CInt(Value)}.ToList() - Else - Dim l As List(Of String) = Value.Split(CChar(",")).ToList() - For i = 0 To l.Count - 1 - Badges.Add(CInt(l(i))) - Next - End If - End If - Case "rotation" - startRotation = CSng(Value.Replace(".", GameController.DecSeparator)) - Case "Gender" - If Value = "Male" Then - Male = True - Else - Male = False - End If - Case "playtime" - Dim dd() As String = Value.Split(CChar(",")) - If dd.Count >= 4 Then - PlayTime = New TimeSpan(CInt(dd(3)), CInt(dd(0)), CInt(dd(1)), CInt(dd(2))) - Else - PlayTime = New TimeSpan(CInt(dd(0)), CInt(dd(1)), CInt(dd(2))) - End If - Case "ot" - OT = CStr(CInt(Value).Clamp(0, 99999)) - Case "points" - Points = CInt(Value) - Case "haspokedex" - HasPokedex = CBool(Value) - Case "haspokegear" - HasPokegear = CBool(Value) - Case "freecamera" - startFreeCameraMode = CBool(Value) - Case "thirdperson" - startThirdPerson = CBool(Value) - Case "skin" - Skin = Value - Case "battleanimations" - ShowBattleAnimations = CInt(Value) - Case "boxamount" - BoxAmount = CInt(Value) - Case "lastrestplace" - LastRestPlace = Value - Case "lastrestplaceposition" - LastRestPlacePosition = Value - Case "diagonalmovement" - If GameController.IS_DEBUG_ACTIVE = True Then - DiagonalMovement = CBool(Value) - Else - DiagonalMovement = False - End If - Case "repelsteps" - RepelSteps = CInt(Value) - Case "lastsaveplace" - LastSavePlace = Value - Case "lastsaveplaceposition" - LastSavePlacePosition = Value - Case "difficulty" - DifficultyMode = CInt(Value) - Case "battlestyle" - BattleStyle = CInt(Value) - Case "savecreated" - SaveCreated = Value - Case "autosave" - If IsGameJoltSave = False Then - newFilePrefix = Value - AutosaveUsed = True - End If - Case "daycaresteps" - DaycareSteps = CInt(Value) - Case "gamemode" - GameMode = Value - Case "pokefiles" - If Value <> "" Then - If Value.Contains(",") = True Then - PokeFiles.AddRange(Value.Split(CChar(","))) - Else - PokeFiles.Add(Value) - End If - End If - Case "visitedmaps" - VisitedMaps = Value - Case "tempsurfskin" - TempSurfSkin = Value - Case "surfing" - startSurfing = CBool(Value) - Screen.Level.Surfing = CBool(Value) - Case "bp" - BP = CInt(Value) - Case "gtsstars" - GTSStars = CInt(Value) - Case "showmodels" - ShowModelsInBattle = CBool(Value) - Case "sandboxmode" - SandBoxMode = CBool(Value) - Case "earnedachievements" - If Value <> "" Then - EarnedAchievements = Value.Split(CChar(",")).ToList() - End If - End Select - Else - Logger.Log(Logger.LogTypes.Warning, "Player.vb: The line """ & Line & """ is either empty or does not conform the player.dat file rules.") - End If - Next - If IsGameJoltSave = True And Screen.Level.Surfing = False Then - Skin = GameJolt.Emblem.GetPlayerSpriteFile(GameJolt.Emblem.GetPlayerLevel(GameJoltSave.Points), GameJoltSave.GameJoltID, GameJoltSave.Gender) - Select Case GameJoltSave.Gender - Case "0" - Male = True - Case "1" - Male = False - Case Else - Male = True - End Select - End If - GameStart = Date.Now - - Core.Player.PokedexData = Encryption.DecryptString(Items(11), StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) - Core.Player.RegisterData = Encryption.DecryptString(Items(12), StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) - Core.Player.RoamingPokemonData = Encryption.DecryptString(Items(13), StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) - Core.Player.SecretBaseData = Encryption.DecryptString(Items(14), StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) - PlayerStatistics.Load(Encryption.DecryptString(Items(15), StringObfuscation.Obfuscate(GameJoltSave.GameJoltID))) - Else - Logger.Log(Logger.LogTypes.Warning, "Backup save have been tempered with. Unable to load.") - End If - Catch ex As Exception - Logger.Log(Logger.LogTypes.Warning, "Backup save have been tempered with. Unable to load.") - End Try - End If - -#If DEBUG Then - If Not Directory.Exists(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite") Then - Directory.CreateDirectory(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite") - End If - - If (File.Exists(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\Apricorns.dat")) Then - Core.Player.ApricornData = File.ReadAllText(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\Apricorns.dat") - File.Delete(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\Apricorns.dat") - End If - If (File.Exists(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\Berries.dat")) Then - Core.Player.BerryData = File.ReadAllText(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\Berries.dat") - File.Delete(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\Berries.dat") - End If - If (File.Exists(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\Box.dat")) Then - Core.Player.BoxData = File.ReadAllText(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\Box.dat") - File.Delete(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\Box.dat") - End If - If (File.Exists(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\Daycare.dat")) Then - Core.Player.DaycareData = File.ReadAllText(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\Daycare.dat") - File.Delete(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\Daycare.dat") - End If - If (File.Exists(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\HallOfFame.dat")) Then - Core.Player.HallOfFameData = IO.File.ReadAllText(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\HallOfFame.dat") - File.Delete(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\HallOfFame.dat") - End If - If (File.Exists(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\ItemData.dat")) Then - Core.Player.ItemData = IO.File.ReadAllText(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\ItemData.dat") - File.Delete(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\ItemData.dat") - End If - If (File.Exists(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\Items.dat")) Then - Inventory.Clear() - Mails.Clear() - Dim Data As String = File.ReadAllText(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\Items.dat") - If Not String.IsNullOrWhiteSpace(Data) Then - For Each ItemDat As String In Data.SplitAtNewline() - If Not String.IsNullOrWhiteSpace(ItemDat) Then - If ItemDat.StartsWith("{") AndAlso ItemDat.EndsWith("}") AndAlso ItemDat.Contains("|") Then - Dim ItemID As String = ItemDat.Remove(0, ItemDat.IndexOf("{") + 1) - ItemID = ItemID.Remove(ItemID.IndexOf("}")) - - Dim amount As Integer = CInt(ItemID.Remove(0, ItemID.IndexOf("|") + 1)) - ItemID = ItemID.Remove(ItemID.IndexOf("|")) - - Inventory.AddItem(CInt(ItemID), amount) - ElseIf ItemDat.StartsWith("Mail|") Then - Dim mailData As String = ItemDat.Remove(0, 5) - Mails.Add(Items.MailItem.GetMailDataFromString(mailData)) - End If - End If - Next - End If - File.Delete(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\Items.dat") - End If - If (File.Exists(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\NPC.dat")) Then - Core.Player.NPCData = File.ReadAllText(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\NPC.dat") - File.Delete(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\NPC.dat") - End If - If (File.Exists(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\Options.dat")) Then - Dim Data As String = File.ReadAllText(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\Options.dat") - For Each Line As String In Data.SplitAtNewline() - If Line.Contains("|") Then - Dim ID As String = Line.Remove(Line.IndexOf("|")) - Dim Value As String = Line.Remove(0, Line.IndexOf("|") + 1) - Select Case ID.ToLower() - Case "fov" - startFOV = CSng(Value.Replace(".", GameController.DecSeparator)).Clamp(1, 179) - Case "textspeed" - TextBox.TextSpeed = CInt(Value) - Case "mousespeed" - startRotationSpeed = CInt(Value) - End Select - End If - Next - File.Delete(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\Options.dat") - End If - If (File.Exists(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\Party.dat")) Then - Pokemons.Clear() - Dim PokeData As String = File.ReadAllText(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\Party.dat") - For Each Line As String In PokeData.SplitAtNewline() - If Line.StartsWith("{") AndAlso Line.EndsWith("}") Then - Dim p As Pokemon = Pokemon.GetPokemonByData(Line) - If p.IsEgg() = False Then - If p.IsShiny = True Then - PokedexData = Pokedex.ChangeEntry(PokedexData, p.Number, 3) - Else - PokedexData = Pokedex.ChangeEntry(PokedexData, p.Number, 2) - End If - End If - Pokemons.Add(p) - End If - Next - File.Delete(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\Party.dat") - End If - If (File.Exists(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\Player.dat")) Then - Dim Data As String = File.ReadAllText(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\Player.dat") - Screen.Level.Riding = False - For Each Line As String In Data.SplitAtNewline() - If Not String.IsNullOrWhiteSpace(Line) AndAlso Line.Contains("|") Then - Dim ID As String = Line.Remove(Line.IndexOf("|")) - Dim Value As String = Line.Remove(0, Line.IndexOf("|") + 1) - Select Case ID.ToLower() - Case "name" - Name = CType(IIf(IsGameJoltSave, GameJolt.API.username, Value), String) - Case "position" - Dim v() As String = Value.Split(CChar(",")) - startPosition.X = CSng(v(0).Replace(".", GameController.DecSeparator)) - startPosition.Y = CSng(v(1).Replace(".", GameController.DecSeparator)) - startPosition.Z = CSng(v(2).Replace(".", GameController.DecSeparator)) - Case "lastpokemonposition" - Dim v() As String = Value.Split(CChar(",")) - LastPokemonPosition.X = CSng(v(0).Replace(".", GameController.DecSeparator)) - LastPokemonPosition.Y = CSng(v(1).Replace(".", GameController.DecSeparator)) - LastPokemonPosition.Z = CSng(v(2).Replace(".", GameController.DecSeparator)) - Case "mapfile" - startMap = Value - Case "rivalname" - RivalName = Value - Case "money" - Money = CInt(Value) - Case "badges" - Badges.Clear() - If Value = "0" Then - Badges = New List(Of Integer) - Else - If Value.Contains(",") = False Then - Badges = {CInt(Value)}.ToList() - Else - Dim l As List(Of String) = Value.Split(CChar(",")).ToList() - For i = 0 To l.Count - 1 - Badges.Add(CInt(l(i))) - Next - End If - End If - Case "rotation" - startRotation = CSng(Value.Replace(".", GameController.DecSeparator)) - Case "Gender" - If Value = "Male" Then - Male = True - Else - Male = False - End If - Case "playtime" - Dim dd() As String = Value.Split(CChar(",")) - If dd.Count >= 4 Then - PlayTime = New TimeSpan(CInt(dd(3)), CInt(dd(0)), CInt(dd(1)), CInt(dd(2))) - Else - PlayTime = New TimeSpan(CInt(dd(0)), CInt(dd(1)), CInt(dd(2))) - End If - Case "ot" - OT = CStr(CInt(Value).Clamp(0, 99999)) - Case "points" - Points = CInt(Value) - Case "haspokedex" - HasPokedex = CBool(Value) - Case "haspokegear" - HasPokegear = CBool(Value) - Case "freecamera" - startFreeCameraMode = CBool(Value) - Case "thirdperson" - startThirdPerson = CBool(Value) - Case "skin" - Skin = Value - Case "battleanimations" - ShowBattleAnimations = CInt(Value) - Case "boxamount" - BoxAmount = CInt(Value) - Case "lastrestplace" - LastRestPlace = Value - Case "lastrestplaceposition" - LastRestPlacePosition = Value - Case "diagonalmovement" - If GameController.IS_DEBUG_ACTIVE = True Then - DiagonalMovement = CBool(Value) - Else - DiagonalMovement = False - End If - Case "repelsteps" - RepelSteps = CInt(Value) - Case "lastsaveplace" - LastSavePlace = Value - Case "lastsaveplaceposition" - LastSavePlacePosition = Value - Case "difficulty" - DifficultyMode = CInt(Value) - Case "battlestyle" - BattleStyle = CInt(Value) - Case "savecreated" - SaveCreated = Value - Case "autosave" - If IsGameJoltSave = False Then - newFilePrefix = Value - AutosaveUsed = True - End If - Case "daycaresteps" - DaycareSteps = CInt(Value) - Case "gamemode" - GameMode = Value - Case "pokefiles" - If Value <> "" Then - If Value.Contains(",") = True Then - PokeFiles.AddRange(Value.Split(CChar(","))) - Else - PokeFiles.Add(Value) - End If - End If - Case "visitedmaps" - VisitedMaps = Value - Case "tempsurfskin" - TempSurfSkin = Value - Case "surfing" - startSurfing = CBool(Value) - Screen.Level.Surfing = CBool(Value) - Case "bp" - BP = CInt(Value) - Case "gtsstars" - GTSStars = CInt(Value) - Case "showmodels" - ShowModelsInBattle = CBool(Value) - Case "sandboxmode" - SandBoxMode = CBool(Value) - Case "earnedachievements" - If Value <> "" Then - EarnedAchievements = Value.Split(CChar(",")).ToList() - End If - End Select - Else - Logger.Log(Logger.LogTypes.Warning, "Player.vb: The line """ & Line & """ is either empty or does not conform the player.dat file rules.") - End If - Next - If IsGameJoltSave = True And Screen.Level.Surfing = False Then - Skin = GameJolt.Emblem.GetPlayerSpriteFile(GameJolt.Emblem.GetPlayerLevel(GameJoltSave.Points), GameJoltSave.GameJoltID, GameJoltSave.Gender) - Select Case GameJoltSave.Gender - Case "0" - Male = True - Case "1" - Male = False - Case Else - Male = True - End Select - End If - GameStart = Date.Now - File.Delete(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\Player.dat") - End If - If (File.Exists(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\Pokedex.dat")) Then - Core.Player.PokedexData = File.ReadAllText(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\Pokedex.dat") - File.Delete(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\Pokedex.dat") - End If - If (File.Exists(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\Register.dat")) Then - Core.Player.RegisterData = File.ReadAllText(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\Register.dat") - File.Delete(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\Register.dat") - End If - If (File.Exists(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\RoamingPokemon.dat")) Then - Core.Player.RoamingPokemonData = File.ReadAllText(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\RoamingPokemon.dat") - File.Delete(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\RoamingPokemon.dat") - End If - If (File.Exists(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\SecretBase.dat")) Then - Core.Player.SecretBaseData = File.ReadAllText(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\SecretBase.dat") - File.Delete(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\SecretBase.dat") - End If - If (File.Exists(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\Statistics.dat")) Then - PlayerStatistics.Load(File.ReadAllText(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\Statistics.dat")) - File.Delete(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\OverWrite\Statistics.dat") - End If -#End If - - File.WriteAllText(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\Apricorns.dat", GameJoltSave.Apricorns) - File.WriteAllText(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\Berries.dat", GameJoltSave.Berries) - File.WriteAllText(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\Box.dat", GameJoltSave.Box) - File.WriteAllText(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\Daycare.dat", GameJoltSave.Daycare) - File.WriteAllText(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\HallOfFame.dat", GameJoltSave.HallOfFame) - File.WriteAllText(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\ItemData.dat", GameJoltSave.ItemData) - File.WriteAllText(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\Items.dat", GameJoltSave.Items) - File.WriteAllText(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\NPC.dat", GameJoltSave.NPC) - File.WriteAllText(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\Options.dat", GameJoltSave.Options) - File.WriteAllText(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\Party.dat", GameJoltSave.Party) - File.WriteAllText(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\Player.dat", GameJoltSave.Player) - File.WriteAllText(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\Pokedex.dat", GameJoltSave.Pokedex) - File.WriteAllText(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\Register.dat", GameJoltSave.Register) - File.WriteAllText(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\RoamingPokemon.dat", GameJoltSave.RoamingPokemon) - File.WriteAllText(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\SecretBase.dat", GameJoltSave.SecretBase) - File.WriteAllText(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\Statistics.dat", GameJoltSave.Statistics) - End If - ''' Indev 0.54 Removal List ''' 1. All Mega Stones. [ID: 507 - 553] ''' 2. Shiny Candy [ID: 501] @@ -1151,6 +629,63 @@ ActionScript.RegisterID("PokemonIndev054Update") End If + ''' Indev 0.54.2 OT Fix List. + If Not ActionScript.IsRegistered("PokemonIndev0542Update") Then + ' Check Party Pokemon. + For Each Pokemon As Pokemon In Pokemons + If Pokemon.CatchTrainerName = Core.Player.Name AndAlso Pokemon.OT <> GameJoltSave.GameJoltID Then + Pokemon.OT = GameJoltSave.GameJoltID + End If + Next + + ' Check PC Boxes. + If Not String.IsNullOrWhiteSpace(BoxData) Then + Dim TempBoxData As New List(Of String) + TempBoxData.AddRange(BoxData.SplitAtNewline()) + + For Each item As String In TempBoxData + If Not String.IsNullOrWhiteSpace(item) AndAlso Not item.StartsWith("BOX") Then + Dim TempString As String = item.Remove(item.IndexOf("{")) + Dim TempPokemon As Pokemon = Pokemon.GetPokemonByData(item.Remove(0, item.IndexOf("{"))) + + If TempPokemon.CatchTrainerName = Core.Player.Name AndAlso TempPokemon.OT <> GameJoltSave.GameJoltID Then + TempPokemon.OT = GameJoltSave.GameJoltID + End If + + item = TempString & TempPokemon.ToString() + End If + Next + + BoxData = String.Join(vbNewLine, TempBoxData) + End If + + ' Check Day Care. + If Not String.IsNullOrWhiteSpace(DaycareData) Then + Dim TempDaycareData As New List(Of String) + TempDaycareData.AddRange(DaycareData.SplitAtNewline()) + + For Each item As String In TempDaycareData + If Not String.IsNullOrWhiteSpace(item) AndAlso item.Contains("{") Then + Dim TempString As String = ItemData.Remove(item.IndexOf("{")) + Dim TempPokemon As Pokemon = Pokemon.GetPokemonByData(item.Remove(0, item.IndexOf("{"))) + + If TempPokemon.CatchTrainerName = Core.Player.Name AndAlso TempPokemon.OT <> GameJoltSave.GameJoltID Then + TempPokemon.OT = GameJoltSave.GameJoltID + End If + + item = TempString & TempPokemon.ToString() + End If + Next + + DaycareData = String.Join(vbNewLine, TempDaycareData) + End If + + ' Remove Duplicate data. + Core.Player.PokeFiles = Core.Player.PokeFiles.Distinct().ToList() + + ActionScript.RegisterID("PokemonIndev0542Update") + End If + loadedSave = True End Sub @@ -1583,8 +1118,8 @@ If IsGameJoltSave = True Then If Core.GameOptions.Extras.Contains("Backup Save") Then - If Not Directory.Exists(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\Encrypted") Then - Directory.CreateDirectory(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\Encrypted") + If Not Directory.Exists(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID.ToString() & "/Encrypted") Then + Directory.CreateDirectory(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID.ToString() & "/Encrypted") End If Dim OriginalHASH As String = @@ -1605,8 +1140,31 @@ Encryption.EncryptString(GetSecretBaseData, StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) & "|" & Encryption.EncryptString(GetStatisticsData, StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) - File.WriteAllText(GameController.GamePath & "\Backup Save\" & GameJoltSave.GameJoltID & "\Encrypted\Encrypted.dat", + File.WriteAllText(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID.ToString() & "/Encrypted/Encrypted.dat", OriginalHASH & "|" & Encryption.EncryptString(OriginalHASH, StringObfuscation.Obfuscate(GameJoltSave.GameJoltID))) + + Dim timestamp As String = Date.Now.ToString("yyyy-MM-dd_HH.mm.ss") + + If Not Directory.Exists(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID & "/" & timestamp) Then + Directory.CreateDirectory(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID & "/" & timestamp) + End If + + File.WriteAllText(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID & "/" & timestamp & "/Apricorns.dat", GetApricornsData) + File.WriteAllText(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID & "/" & timestamp & "/Berries.dat", GetBerriesData) + File.WriteAllText(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID & "/" & timestamp & "/Box.dat", GetBoxData) + File.WriteAllText(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID & "/" & timestamp & "/Daycare.dat", GetDaycareData) + File.WriteAllText(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID & "/" & timestamp & "/HallOfFame.dat", GetHallOfFameData) + File.WriteAllText(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID & "/" & timestamp & "/ItemData.dat", GetItemDataData) + File.WriteAllText(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID & "/" & timestamp & "/Items.dat", GetItemsData) + File.WriteAllText(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID & "/" & timestamp & "/NPC.dat", GetNPCDataData) + File.WriteAllText(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID & "/" & timestamp & "/Options.dat", GetOptionsData) + File.WriteAllText(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID & "/" & timestamp & "/Party.dat", GetPartyData) + File.WriteAllText(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID & "/" & timestamp & "/Player.dat", GetPlayerData(False)) + File.WriteAllText(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID & "/" & timestamp & "/Pokedex.dat", GetPokedexData) + File.WriteAllText(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID & "/" & timestamp & "/Register.dat", GetRegisterData) + File.WriteAllText(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID & "/" & timestamp & "/RoamingPokemon.dat", GetRoamingPokemonData) + File.WriteAllText(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID & "/" & timestamp & "/SecretBase.dat", GetSecretBaseData) + File.WriteAllText(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID & "/" & timestamp & "/Statistics.dat", GetStatisticsData) End If Dim APICallSave As New GameJolt.APICall(AddressOf SaveGameHelpers.CompleteGameJoltSave) diff --git a/2.5DHero/2.5DHero/Screens/MainMenu/MainMenuScreen.vb b/2.5DHero/2.5DHero/Screens/MainMenu/MainMenuScreen.vb index 4b36875f9..475ae8f1a 100644 --- a/2.5DHero/2.5DHero/Screens/MainMenu/MainMenuScreen.vb +++ b/2.5DHero/2.5DHero/Screens/MainMenu/MainMenuScreen.vb @@ -900,6 +900,216 @@ Public Class MainMenuScreen If Controls.Accept(True, True) = True Then If Core.GameInstance.IsMouseVisible = False And loadGameJoltIndex = 0 Or Core.ScaleScreenRec(New Rectangle(CInt(Core.ScreenSize.Width / 2) - 256, 300, 512, 128)).Contains(MouseHandler.MousePosition) = True And Core.GameInstance.IsMouseVisible = True Then Core.Player.IsGameJoltSave = True + + ' Backup Save module + ' 1. Load Encrypted.dat file. + ' 2. Load OverWrite folder + ' 3. Apply Extra Fixes. + + ' Enable Backup Save functionality. + If (Core.GameOptions.Extras.Contains("Backup Save")) Then + ' Make a copy of last known good gamejolt save! + Dim timestamp As String = Date.Now.ToString("yyyy-MM-dd_HH.mm.ss") + + If Not Directory.Exists(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID & "/" & timestamp) Then + Directory.CreateDirectory(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID & "/" & timestamp) + End If + + File.WriteAllText(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID & "/" & timestamp & "/Apricorns.dat", Core.GameJoltSave.Apricorns) + File.WriteAllText(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID & "/" & timestamp & "/Berries.dat", Core.GameJoltSave.Berries) + File.WriteAllText(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID & "/" & timestamp & "/Box.dat", Core.GameJoltSave.Box) + File.WriteAllText(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID & "/" & timestamp & "/Daycare.dat", Core.GameJoltSave.Daycare) + File.WriteAllText(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID & "/" & timestamp & "/HallOfFame.dat", Core.GameJoltSave.HallOfFame) + File.WriteAllText(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID & "/" & timestamp & "/ItemData.dat", Core.GameJoltSave.ItemData) + File.WriteAllText(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID & "/" & timestamp & "/Items.dat", Core.GameJoltSave.Items) + File.WriteAllText(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID & "/" & timestamp & "/NPC.dat", Core.GameJoltSave.NPC) + File.WriteAllText(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID & "/" & timestamp & "/Options.dat", Core.GameJoltSave.Options) + File.WriteAllText(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID & "/" & timestamp & "/Party.dat", Core.GameJoltSave.Party) + File.WriteAllText(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID & "/" & timestamp & "/Player.dat", Core.GameJoltSave.Player) + File.WriteAllText(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID & "/" & timestamp & "/Pokedex.dat", Core.GameJoltSave.Pokedex) + File.WriteAllText(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID & "/" & timestamp & "/Register.dat", Core.GameJoltSave.Register) + File.WriteAllText(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID & "/" & timestamp & "/RoamingPokemon.dat", Core.GameJoltSave.RoamingPokemon) + File.WriteAllText(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID & "/" & timestamp & "/SecretBase.dat", Core.GameJoltSave.SecretBase) + File.WriteAllText(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID & "/" & timestamp & "/Statistics.dat", Core.GameJoltSave.Statistics) + + If Directory.Exists(GameController.GamePath & "/Backup Save/" & Core.GameJoltSave.GameJoltID.ToString() & "/Encrypted/") Then + If File.Exists(GameController.GamePath & "/Backup Save/" & Core.GameJoltSave.GameJoltID.ToString() & "/Encrypted/Encrypted.dat") Then + Dim Items() As String = File.ReadAllText(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID.ToString() & "/Encrypted/Encrypted.dat").Split(CChar("|")) + Dim Hash As String = String.Join("|", Items.Take(16)) + + ' Ensure that the items count is 17. Last index is for validation purpose. + If Items.Count() = 17 Then + ' Try using the new algorithm. + Try + If String.Equals(Hash, Encryption.DecryptString(Items.Last(), StringObfuscation.Obfuscate(GameJoltSave.GameJoltID))) Then + Core.GameJoltSave._apricorns = Encryption.DecryptString(Items(0), StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) + Core.GameJoltSave._berries = Encryption.DecryptString(Items(1), StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) + Core.GameJoltSave._box = Encryption.DecryptString(Items(2), StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) + Core.GameJoltSave._daycare = Encryption.DecryptString(Items(3), StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) + Core.GameJoltSave._hallOfFame = Encryption.DecryptString(Items(4), StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) + Core.GameJoltSave._itemData = Encryption.DecryptString(Items(5), StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) + Core.GameJoltSave._items = Encryption.DecryptString(Items(6), StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) + Core.GameJoltSave._NPC = Encryption.DecryptString(Items(7), StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) + Core.GameJoltSave._options = Encryption.DecryptString(Items(8), StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) + Core.GameJoltSave._party = Encryption.DecryptString(Items(9), StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) + Core.GameJoltSave._player = Encryption.DecryptString(Items(10), StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) + Core.GameJoltSave._pokedex = Encryption.DecryptString(Items(11), StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) + Core.GameJoltSave._register = Encryption.DecryptString(Items(12), StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) + Core.GameJoltSave._roamingPokemon = Encryption.DecryptString(Items(13), StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) + Core.GameJoltSave._secretBase = Encryption.DecryptString(Items(14), StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) + Core.GameJoltSave._statistics = Encryption.DecryptString(Items(15), StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) + End If + Catch ex As Exception + + End Try + + ' Try again using the old algorithm. + Try + If String.Equals(Hash, Encryption.DecryptString(Items.Last(), StringObfuscation.Obfuscate("TheDialgaTeam"))) Then + ' Ensure that you are not cheating. + Dim PlayerData() As String = Items(10).SplitAtNewline() + If (PlayerData.Any(Function(a) + Return String.Equals(a, "OT|" & GameJoltSave.GameJoltID) + End Function)) Then + Core.GameJoltSave._apricorns = Encryption.DecryptString(Items(0), StringObfuscation.Obfuscate("TheDialgaTeam")) + Core.GameJoltSave._berries = Encryption.DecryptString(Items(1), StringObfuscation.Obfuscate("TheDialgaTeam")) + Core.GameJoltSave._box = Encryption.DecryptString(Items(2), StringObfuscation.Obfuscate("TheDialgaTeam")) + Core.GameJoltSave._daycare = Encryption.DecryptString(Items(3), StringObfuscation.Obfuscate("TheDialgaTeam")) + Core.GameJoltSave._hallOfFame = Encryption.DecryptString(Items(4), StringObfuscation.Obfuscate("TheDialgaTeam")) + Core.GameJoltSave._itemData = Encryption.DecryptString(Items(5), StringObfuscation.Obfuscate("TheDialgaTeam")) + Core.GameJoltSave._items = Encryption.DecryptString(Items(6), StringObfuscation.Obfuscate("TheDialgaTeam")) + Core.GameJoltSave._NPC = Encryption.DecryptString(Items(7), StringObfuscation.Obfuscate("TheDialgaTeam")) + Core.GameJoltSave._options = Encryption.DecryptString(Items(8), StringObfuscation.Obfuscate("TheDialgaTeam")) + Core.GameJoltSave._party = Encryption.DecryptString(Items(9), StringObfuscation.Obfuscate("TheDialgaTeam")) + Core.GameJoltSave._player = Encryption.DecryptString(Items(10), StringObfuscation.Obfuscate("TheDialgaTeam")) + Core.GameJoltSave._pokedex = Encryption.DecryptString(Items(11), StringObfuscation.Obfuscate("TheDialgaTeam")) + Core.GameJoltSave._register = Encryption.DecryptString(Items(12), StringObfuscation.Obfuscate("TheDialgaTeam")) + Core.GameJoltSave._roamingPokemon = Encryption.DecryptString(Items(13), StringObfuscation.Obfuscate("TheDialgaTeam")) + Core.GameJoltSave._secretBase = Encryption.DecryptString(Items(14), StringObfuscation.Obfuscate("TheDialgaTeam")) + Core.GameJoltSave._statistics = Encryption.DecryptString(Items(15), StringObfuscation.Obfuscate("TheDialgaTeam")) + Else + MsgBox("The game detected that you are trying to load the legacy Backup Save from Indev 0.53.3 Patch Update 6/7. Due to the nature of cloning account via Backup Save, we are unable to load this save." & vbNewLine & vbNewLine & "Please contact jianmingyong at http://pokemon3d.net/forum/ for more detail.", MsgBoxStyle.OkOnly, "Error") + End If + End If + Catch ex As Exception + + End Try + + ' Disable the older support for security reason. + Try + If File.Exists(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Encrypted/Apricorns.dat") AndAlso + File.Exists(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Encrypted/Berries.dat") AndAlso + File.Exists(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Encrypted/Box.dat") AndAlso + File.Exists(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Encrypted/Daycare.dat") AndAlso + File.Exists(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Encrypted/HallOfFame.dat") AndAlso + File.Exists(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Encrypted/ItemData.dat") AndAlso + File.Exists(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Encrypted/Items.dat") AndAlso + File.Exists(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Encrypted/NPC.dat") AndAlso + File.Exists(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Encrypted/Options.dat") AndAlso + File.Exists(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Encrypted/Party.dat") AndAlso + File.Exists(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Encrypted/Player.dat") AndAlso + File.Exists(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Encrypted/Pokedex.dat") AndAlso + File.Exists(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Encrypted/Register.dat") AndAlso + File.Exists(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Encrypted/RoamingPokemon.dat") AndAlso + File.Exists(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Encrypted/SecretBase.dat") AndAlso + File.Exists(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Encrypted/Statistics.dat") Then + MsgBox("The game detected that you are trying to load the legacy Backup Save from Indev 0.53.3 Patch Update 5 and below. Due to the nature of cloning account via Backup Save, we are unable to load this save." & vbNewLine & vbNewLine & "Please contact jianmingyong at http://pokemon3d.net/forum/ for more detail.", MsgBoxStyle.OkOnly, "Error") + End If + Catch ex As Exception + + End Try + End If + End If + End If +#If DEBUG Then + If Not Directory.Exists(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID.ToString() & "/Overwrite") Then + Directory.CreateDirectory(GameController.GamePath & "/Backup Save/" & GameJoltSave.GameJoltID.ToString() & "/Overwrite") + End If + + If Directory.Exists(GameController.GamePath & "/Backup Save/" & Core.GameJoltSave.GameJoltID.ToString() & "/Overwrite/") Then + If File.Exists(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/Apricorns.dat") Then + Core.GameJoltSave._apricorns = File.ReadAllText(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/Apricorns.dat") + File.Delete(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/Apricorns.dat") + End If + + If File.Exists(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/Berries.dat") Then + Core.GameJoltSave._berries = File.ReadAllText(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/Berries.dat") + File.Delete(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/Berries.dat") + End If + + If File.Exists(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/Box.dat") Then + Core.GameJoltSave._box = File.ReadAllText(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/Box.dat") + File.Delete(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/Box.dat") + End If + + If File.Exists(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/Daycare.dat") Then + Core.GameJoltSave._daycare = File.ReadAllText(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/Daycare.dat") + File.Delete(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/Daycare.dat") + End If + + If File.Exists(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/HallOfFame.dat") Then + Core.GameJoltSave._hallOfFame = File.ReadAllText(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/HallOfFame.dat") + File.Delete(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/HallOfFame.dat") + End If + + If File.Exists(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/ItemData.dat") Then + Core.GameJoltSave._itemData = File.ReadAllText(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/ItemData.dat") + File.Delete(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/ItemData.dat") + End If + + If File.Exists(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/Items.dat") Then + Core.GameJoltSave._items = File.ReadAllText(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/Items.dat") + File.Delete(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/Items.dat") + End If + + If File.Exists(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/NPC.dat") Then + Core.GameJoltSave._NPC = File.ReadAllText(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/NPC.dat") + File.Delete(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/NPC.dat") + End If + + If File.Exists(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/Options.dat") Then + Core.GameJoltSave._options = File.ReadAllText(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/Options.dat") + File.Delete(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/Options.dat") + End If + + If File.Exists(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/Party.dat") Then + Core.GameJoltSave._party = File.ReadAllText(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/Party.dat") + File.Delete(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/Party.dat") + End If + + If File.Exists(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/Player.dat") Then + Core.GameJoltSave._player = File.ReadAllText(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/Player.dat") + File.Delete(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/Player.dat") + End If + + If File.Exists(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/Pokedex.dat") Then + Core.GameJoltSave._pokedex = File.ReadAllText(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/Pokedex.dat") + File.Delete(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/Pokedex.dat") + End If + + If File.Exists(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/Register.dat") Then + Core.GameJoltSave._register = File.ReadAllText(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/Register.dat") + File.Delete(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/Register.dat") + End If + + If File.Exists(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/RoamingPokemon.dat") Then + Core.GameJoltSave._roamingPokemon = File.ReadAllText(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/RoamingPokemon.dat") + File.Delete(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/RoamingPokemon.dat") + End If + + If File.Exists(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/SecretBase.dat") Then + Core.GameJoltSave._secretBase = File.ReadAllText(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/SecretBase.dat") + File.Delete(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/SecretBase.dat") + End If + + If File.Exists(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/Statistics.dat") Then + Core.GameJoltSave._statistics = File.ReadAllText(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/Statistics.dat") + File.Delete(GameController.GamePath + "/Backup Save/" + Core.GameJoltSave.GameJoltID.ToString() + "/Overwrite/Statistics.dat") + End If + End If +#End If + End If + Core.Player.LoadGame("GAMEJOLTSAVE") Core.SetScreen(New JoinServerScreen(Me))