Implemented Player.dat from experimental branch. Backup save stuff needs to be reapplied

This commit is contained in:
CaptainSegis 2017-04-15 11:42:31 -05:00
parent 886d0c92a3
commit 9ccb4616e6
24 changed files with 260 additions and 297 deletions

View File

@ -693,7 +693,7 @@
Private Sub MainMenuOpenPokemon(ByVal BattleScreen As BattleScreen)
TempBattleScreen = BattleScreen
Player.Temp.PokemonScreenIndex = BattleScreen.OwnPokemonIndex
Core.Player.Temp.PokemonScreenIndex = BattleScreen.OwnPokemonIndex
Dim selScreen = New PartyScreen(Core.CurrentScreen, Item.GetItemByID(5), AddressOf ShowPokemonMenu, "Choose Pokémon", True) With {.Mode = Screens.UI.ISelectionScreen.ScreenMode.Selection, .CanExit = True}
AddHandler selScreen.SelectedObject, AddressOf ShowPokemonMenuHandler

View File

@ -11,7 +11,7 @@
<ScriptCommand("Save", RequiredContext:=ScriptContext.Overworld)>
<ScriptDescription("Saves the game.")>
Private Function M_Save(ByVal argument As String) As String
Game.Core.Player.SaveGame(False)
Game.Core.Player.SaveGame()
Return Core.Null
End Function

View File

@ -137,7 +137,7 @@
Core.Player.PokedexData = Pokedex.ChangeEntry(Core.Player.PokedexData, InboxList(Selected).Pokemon.Number, pokedexType)
End If
Core.Player.SaveGame(False)
Core.Player.SaveGame()
If Me.PreScreen.Identification = Identifications.GTSMainScreen Then
CType(Me.PreScreen, GTSMainScreen).PokemonGTSCount -= 1

View File

@ -361,7 +361,7 @@
Private Sub FetchTradeBack(ByVal result As String)
Core.Player.Pokemons.Add(FetchBack.Pokemon)
Core.Player.SaveGame(False)
Core.Player.SaveGame()
loaded = False
End Sub
@ -828,7 +828,7 @@
End If
End If
Core.Player.SaveGame(False)
Core.Player.SaveGame()
Me.GTSSetupScreen.loaded = False
Core.SetScreen(Me.GTSSetupScreen)

View File

@ -370,7 +370,7 @@
End If
PlayerStatistics.Track("GTS trades", 1)
Core.Player.SaveGame(False)
Core.Player.SaveGame()
UploadDone = True
End If

View File

@ -314,7 +314,7 @@
Core.Player.Pokemons.Add(Pokemon.GetPokemonByData(Me.WonderTradePokemonData))
Core.Player.PokedexData = Pokedex.RegisterPokemon(Core.Player.PokedexData, Core.Player.Pokemons(Core.Player.Pokemons.Count - 1))
PlayerStatistics.Track("Wondertrades", 1)
Core.Player.SaveGame(False)
Core.Player.SaveGame()
Else
Me.ScreenState = ScreenStates.Stopped
Me.DisconnectMessage = "Trade not successful. Press any key to exit."

View File

@ -396,7 +396,7 @@
Core.Player.Pokemons.RemoveAt(OfferPokemonIndex)
Core.Player.Pokemons.Add(Pokemon.GetPokemonByData(TradePokemon.GetSaveData()))
Core.Player.PokedexData = Pokedex.RegisterPokemon(Core.Player.PokedexData, Core.Player.Pokemons(Core.Player.Pokemons.Count - 1))
Core.Player.SaveGame(False)
Core.Player.SaveGame()
SentTradeOffer = False
ReceivedTradeOffer = False

View File

@ -360,8 +360,8 @@ Namespace Servers
Private ReadOnly Property GetPlayerPositionString() As String
Get
Dim PositionString As String = ""
If net.Pokemon3D.Game.Player.Temp.IsInBattle = True Then
PositionString = net.Pokemon3D.Game.Player.Temp.BeforeBattlePosition.X.ToString() & "|" & (net.Pokemon3D.Game.Player.Temp.BeforeBattlePosition.Y - 0.1F).ToString() & "|" & net.Pokemon3D.Game.Player.Temp.BeforeBattlePosition.Z.ToString()
If net.Pokemon3D.Game.Core.Player.Temp.IsInBattle = True Then
PositionString = net.Pokemon3D.Game.Core.Player.Temp.BeforeBattlePosition.X.ToString() & "|" & (net.Pokemon3D.Game.Core.Player.Temp.BeforeBattlePosition.Y - 0.1F).ToString() & "|" & net.Pokemon3D.Game.Core.Player.Temp.BeforeBattlePosition.Z.ToString()
Else
PositionString = Screen.Camera.Position.X.ToString() & "|" & (Screen.Camera.Position.Y - 0.1F).ToString() & "|" & Screen.Camera.Position.Z.ToString()
End If
@ -372,8 +372,8 @@ Namespace Servers
Private ReadOnly Property GetLevelFile() As String
Get
Dim levelFile As String = Screen.Level.LevelFile
If net.Pokemon3D.Game.Player.Temp.IsInBattle = True Then
levelFile = net.Pokemon3D.Game.Player.Temp.BeforeBattleLevelFile
If net.Pokemon3D.Game.Core.Player.Temp.IsInBattle = True Then
levelFile = net.Pokemon3D.Game.Core.Player.Temp.BeforeBattleLevelFile
End If
Return levelFile
End Get
@ -382,8 +382,8 @@ Namespace Servers
Private ReadOnly Property GetFacing() As Integer
Get
Dim facing As Integer = 0
If net.Pokemon3D.Game.Player.Temp.IsInBattle = True Then
facing = net.Pokemon3D.Game.Player.Temp.BeforeBattleFacing
If net.Pokemon3D.Game.Core.Player.Temp.IsInBattle = True Then
facing = net.Pokemon3D.Game.Core.Player.Temp.BeforeBattleFacing
Else
facing = Screen.Camera.GetPlayerFacingDirection()
End If
@ -407,7 +407,7 @@ Namespace Servers
If Core.CurrentScreen.Identification = Screen.Identifications.ChatScreen Then
busyType = "2" 'In chat
End If
If net.Pokemon3D.Game.Player.Temp.IsInBattle = True Then
If net.Pokemon3D.Game.Core.Player.Temp.IsInBattle = True Then
busyType = "1" 'in battle
End If
If Core.CurrentScreen.Identification = Screen.Identifications.PauseScreen Then
@ -419,7 +419,7 @@ Namespace Servers
Private ReadOnly Property GetPokemonVisible() As String
Get
If Screen.Level.OverworldPokemon.Visible = True And Screen.Level.Surfing = False And Screen.Level.Riding = False And net.Pokemon3D.Game.Player.Temp.IsInBattle = False Then
If Screen.Level.OverworldPokemon.Visible = True And Screen.Level.Surfing = False And Screen.Level.Riding = False And net.Pokemon3D.Game.Core.Player.Temp.IsInBattle = False Then
Return "1"
End If
Return "0"
@ -428,7 +428,7 @@ Namespace Servers
Private ReadOnly Property GetPokemonPosition() As String
Get
If net.Pokemon3D.Game.Player.Temp.IsInBattle = False Then
If net.Pokemon3D.Game.Core.Player.Temp.IsInBattle = False Then
Return Screen.Level.OverworldPokemon.Position.X.ToString() & "|" & Math.Floor(Screen.Level.OverworldPokemon.Position.Y).ToString() & "|" & Screen.Level.OverworldPokemon.Position.Z.ToString()
End If
Return "0|-10|0"

View File

@ -421,64 +421,7 @@
Public AutosaveUsed As Boolean = False
Public loadedSave As Boolean = False
Public PlayerTemp As PlayerTemp
Public Structure Temp
Public Shared PokemonScreenIndex As Integer = 0
Public Shared PokemonSummaryPageIndex As Integer = 0
Public Shared PokemonStatusPageIndex As Integer = 0
Public Shared BagIndex As Integer = 0
Public Shared BagSelectIndex As Integer = 0
Public Shared MenuIndex As Integer = 0
Public Shared PokedexIndex As Integer = 0
Public Shared PCBoxIndex As Integer = 0
Public Shared StorageSystemCursorPosition As New Vector2(1, 0)
Public Shared OptionScreenIndex As Integer = 0
Public Shared MapSwitch(3) As Boolean
Public Shared LastPosition As Vector3
Public Shared IsInBattle As Boolean = False
Public Shared BeforeBattlePosition As Vector3 = New Vector3(0)
Public Shared BeforeBattleLevelFile As String = "yourroom.dat"
Public Shared BeforeBattleFacing As Integer = 0
Public Shared PokedexModeIndex As Integer = 0
Public Shared PokedexHabitatIndex As Integer = 0
Public Shared PokegearPage As Integer = 0
Public Shared LastCall As Integer = 32
Public Shared LastUsedRepel As Integer = -1
Public Shared MapSteps As Integer = 0
Public Shared HallOfFameIndex As Integer = 0
Public Shared PCBoxChooseMode As Boolean = False
Public Shared PCSelectionType As StorageSystemScreen.SelectionModes = StorageSystemScreen.SelectionModes.SingleMove
Public Shared RadioStation As Decimal = 0D
Public Shared LastPokegearPage As GameJolt.PokegearScreen.MenuScreens = GameJolt.PokegearScreen.MenuScreens.Main
End Structure
Private Sub ResetTemp()
Temp.PokemonScreenIndex = 0
Temp.PokemonStatusPageIndex = 0
Temp.BagIndex = 0
Temp.BagSelectIndex = 0
Temp.MenuIndex = 0
Temp.PokedexIndex = 0
Temp.PCBoxIndex = 0
Temp.OptionScreenIndex = 0
Temp.IsInBattle = False
For i = 0 To 3
Temp.MapSwitch(i) = True
Next
Temp.PokedexModeIndex = 0
Temp.PokedexHabitatIndex = 0
Temp.PokegearPage = 0
Temp.LastCall = 32
Temp.LastUsedRepel = -1
Temp.MapSteps = 0
Temp.HallOfFameIndex = 0
Temp.PCBoxChooseMode = False
Temp.StorageSystemCursorPosition = New Vector2(1, 0)
Temp.PCSelectionType = StorageSystemScreen.SelectionModes.SingleMove
Temp.RadioStation = 0D
Temp.LastPokegearPage = GameJolt.PokegearScreen.MenuScreens.Main
End Sub
Public Temp As New PlayerTemp
#Region "Load"
@ -539,7 +482,7 @@
LoadRoamingPokemonData()
LoadStatistics()
PlayerTemp = New PlayerTemp()
Temp = New PlayerTemp()
Chat.ClearChat()
If AutosaveUsed = True Then
@ -562,126 +505,125 @@
Entity.MakeShake = Name.ToLower() = "drunknilllzz"
''' Indev 0.54 Removal List
''' 1. All Mega Stones. [ID: 507 - 553]
''' 2. Shiny Candy [ID: 501]
'If Not ActionScript.IsRegistered("PokemonIndev054Update") Then
' ' Check Inventory.
' Inventory.RemoveItem(501)
' For i As Integer = 507 To 553 Step +1
' Inventory.RemoveItem(i)
' Next
If Not Construct.Framework.RegisterHandler.IsRegistered("PokemonIndev054Update") Then
' Check Inventory.
Inventory.RemoveItem(501)
For i As Integer = 507 To 553 Step +1
Inventory.RemoveItem(i)
Next
' ' Check Party Pokemon.
' For Each Pokemon As Pokemon In Pokemons
' If Pokemon.Item IsNot Nothing AndAlso (Pokemon.Item.ID >= 501 OrElse (Pokemon.Item.ID >= 507 AndAlso Pokemon.Item.ID <= 553)) Then
' Pokemon.Item = Nothing
' End If
' Next
' Check Party Pokemon.
For Each Pokemon As Pokemon In Pokemons
If Pokemon.Item IsNot Nothing AndAlso (Pokemon.Item.ID >= 501 OrElse (Pokemon.Item.ID >= 507 AndAlso Pokemon.Item.ID <= 553)) Then
Pokemon.Item = Nothing
End If
Next
' ' Check PC Boxes.
' If Not String.IsNullOrWhiteSpace(BoxData) Then
' Dim TempBoxData As New List(Of String)
' TempBoxData.AddRange(BoxData.SplitAtNewline())
' 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("{")))
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.Item IsNot Nothing AndAlso (TempPokemon.Item.ID >= 501 OrElse (TempPokemon.Item.ID >= 507 AndAlso TempPokemon.Item.ID <= 553)) Then
' TempPokemon.Item = Nothing
' End If
If TempPokemon.Item IsNot Nothing AndAlso (TempPokemon.Item.ID >= 501 OrElse (TempPokemon.Item.ID >= 507 AndAlso TempPokemon.Item.ID <= 553)) Then
TempPokemon.Item = Nothing
End If
' item = TempString & TempPokemon.ToString()
' End If
' Next
item = TempString & TempPokemon.ToString()
End If
Next
' BoxData = String.Join(vbNewLine, TempBoxData)
' End If
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())
' 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("{")))
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.Item IsNot Nothing AndAlso (TempPokemon.Item.ID >= 501 OrElse (TempPokemon.Item.ID >= 507 AndAlso TempPokemon.Item.ID <= 553)) Then
' TempPokemon.Item = Nothing
' End If
If TempPokemon.Item IsNot Nothing AndAlso (TempPokemon.Item.ID >= 501 OrElse (TempPokemon.Item.ID >= 507 AndAlso TempPokemon.Item.ID <= 553)) Then
TempPokemon.Item = Nothing
End If
' item = TempString & TempPokemon.ToString()
' End If
' Next
item = TempString & TempPokemon.ToString()
End If
Next
' DaycareData = String.Join(vbNewLine, TempDaycareData)
' End If
DaycareData = String.Join(vbNewLine, TempDaycareData)
End If
' ActionScript.RegisterID("PokemonIndev054Update")
'End If
Construct.Framework.RegisterHandler.NewRegister("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 String.Equals(Pokemon.CatchTrainerName, Core.Player.Name, StringComparison.OrdinalIgnoreCase) AndAlso Pokemon.OT <> GameJoltSave.GameJoltID Then
' Pokemon.OT = GameJoltSave.GameJoltID
' End If
' Next
''' Indev 0.54.2 OT Fix List.
If Not Construct.Framework.RegisterHandler.IsRegistered("PokemonIndev0542Update") Then
' Check Party Pokemon.
For Each Pokemon As Pokemon In Pokemons
If String.Equals(Pokemon.CatchTrainerName, Core.Player.Name, StringComparison.OrdinalIgnoreCase) 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())
' 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("{")))
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 String.Equals(TempPokemon.CatchTrainerName, Core.Player.Name, StringComparison.OrdinalIgnoreCase) AndAlso TempPokemon.OT <> GameJoltSave.GameJoltID Then
' TempPokemon.OT = GameJoltSave.GameJoltID
' End If
If String.Equals(TempPokemon.CatchTrainerName, Core.Player.Name, StringComparison.OrdinalIgnoreCase) AndAlso TempPokemon.OT <> GameJoltSave.GameJoltID Then
TempPokemon.OT = GameJoltSave.GameJoltID
End If
' item = TempString & TempPokemon.ToString()
' End If
' Next
item = TempString & TempPokemon.ToString()
End If
Next
' BoxData = String.Join(vbNewLine, TempBoxData)
' End If
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())
' 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("{")))
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 String.Equals(TempPokemon.CatchTrainerName, Core.Player.Name, StringComparison.OrdinalIgnoreCase) AndAlso TempPokemon.OT <> GameJoltSave.GameJoltID Then
' TempPokemon.OT = GameJoltSave.GameJoltID
' End If
If String.Equals(TempPokemon.CatchTrainerName, Core.Player.Name, StringComparison.OrdinalIgnoreCase) AndAlso TempPokemon.OT <> GameJoltSave.GameJoltID Then
TempPokemon.OT = GameJoltSave.GameJoltID
End If
' item = TempString & TempPokemon.ToString()
' End If
' Next
item = TempString & TempPokemon.ToString()
End If
Next
' DaycareData = String.Join(vbNewLine, TempDaycareData)
' End If
DaycareData = String.Join(vbNewLine, TempDaycareData)
End If
' ' Remove Duplicate data.
' Core.Player.PokeFiles = Core.Player.PokeFiles.Distinct().ToList()
' Remove Duplicate data.
Core.Player.PokeFiles = Core.Player.PokeFiles.Distinct().ToList()
Construct.Framework.RegisterHandler.NewRegister("PokemonIndev0542Update", "")
End If
' ActionScript.RegisterID("PokemonIndev0542Update")
'End If
loadedSave = True
End Sub
@ -693,8 +635,7 @@
If IsGameJoltSave = True Then
PokeData = GameJoltSave.Party.SplitAtNewline()
Else
Dim PartyData As String = IO.File.ReadAllText(GameController.GamePath & "\Save\" & filePrefix & "\Party.dat")
PokeData = PartyData.SplitAtNewline()
PokeData = IO.File.ReadAllText(GameController.GamePath & "\Save\" & filePrefix & "\Party.dat").SplitAtNewline()
End If
If PokeData.Count > 0 AndAlso PokeData(0) <> "" Then
@ -864,7 +805,7 @@
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.")
Logger.Log("254", Logger.LogTypes.Warning, "Player.vb: The line """ & Line & """ is either empty or does not conform the player.dat file rules.")
End If
Next
@ -985,6 +926,9 @@
Else
RegisterData = IO.File.ReadAllText(GameController.GamePath & "\Save\" & filePrefix & "\Register.dat")
End If
'LEGACY: Converts the old register format into the new one:
RegisterData = Construct.Framework.RegisterHandler.ConvertFromOldRegisterFormat(RegisterData)
End Sub
Private Sub LoadItemData()
@ -1080,26 +1024,13 @@
Dim GameJoltTempStoreString As New Dictionary(Of String, String)
Public Sub SaveGame()
SaveGame(True)
End Sub
Public Sub SaveGame(ByVal IsAutosave As Boolean)
SaveGameHelpers.ResetSaveCounter()
If IsAutosave = True Then
newFilePrefix = filePrefix
filePrefix = "autosave"
If IO.Directory.Exists(GameController.GamePath & "\Save\autosave") = False Then
IO.Directory.CreateDirectory(GameController.GamePath & "\Save\autosave")
End If
Else
newFilePrefix = filePrefix
End If
newFilePrefix = filePrefix
GameJoltTempStoreString.Clear()
SavePlayer(IsAutosave)
SavePlayer()
SaveParty()
SaveItems()
SaveBerries()
@ -1119,60 +1050,7 @@
filePrefix = newFilePrefix
If IsGameJoltSave = True Then
If Core.GameOptions.Extras.Contains("Backup Save") Then
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 =
Encryption.EncryptString(GetApricornsData, StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) & "|" &
Encryption.EncryptString(GetBerriesData, StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) & "|" &
Encryption.EncryptString(GetBoxData, StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) & "|" &
Encryption.EncryptString(GetDaycareData, StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) & "|" &
Encryption.EncryptString(GetHallOfFameData, StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) & "|" &
Encryption.EncryptString(GetItemDataData, StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) & "|" &
Encryption.EncryptString(GetItemsData, StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) & "|" &
Encryption.EncryptString(GetNPCDataData, StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) & "|" &
Encryption.EncryptString(GetOptionsData, StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) & "|" &
Encryption.EncryptString(GetPartyData, StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) & "|" &
Encryption.EncryptString(GetPlayerData(False), StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) & "|" &
Encryption.EncryptString(GetPokedexData, StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) & "|" &
Encryption.EncryptString(GetRegisterData, StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) & "|" &
Encryption.EncryptString(GetRoamingPokemonData, StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) & "|" &
Encryption.EncryptString(GetSecretBaseData, StringObfuscation.Obfuscate(GameJoltSave.GameJoltID)) & "|" &
Encryption.EncryptString(GetStatisticsData, StringObfuscation.Obfuscate(GameJoltSave.GameJoltID))
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)
AddHandler APICallSave.CallFails, Sub(ByVal ex As Exception)
SaveGameHelpers.CompleteGameJoltSave("false" & vbNewLine & "false" & vbNewLine & "false" & vbNewLine & "false" & vbNewLine & "false" & vbNewLine & "false" & vbNewLine & "false" & vbNewLine & "false" & vbNewLine & "false" & vbNewLine & "false" & vbNewLine & "false" & vbNewLine & "false" & vbNewLine & "false" & vbNewLine & "false" & vbNewLine & "false" & vbNewLine & "false")
End Sub
Dim keys As New List(Of String)
Dim dataItems As New List(Of String)
@ -1215,7 +1093,7 @@
Return Data
End Function
Public Function GetPlayerData(ByVal IsAutosave As Boolean) As String
Public Function GetPlayerData() As String
Dim GenderString As String = ""
If Male = True Then
GenderString = "Male"
@ -1327,10 +1205,6 @@
"SandBoxMode|" & SandBoxMode.ToNumberString() & vbNewLine &
"EarnedAchievements|" & EarnedAchievementsString
If IsAutosave = True Then
Data &= vbNewLine & "AutoSave|" & newFilePrefix
End If
Return Data
End Function
@ -1442,8 +1316,8 @@
End If
End Sub
Private Sub SavePlayer(ByVal IsAutosave As Boolean)
Dim Data As String = GetPlayerData(IsAutosave)
Private Sub SavePlayer()
Dim Data As String = GetPlayerData()
If IsGameJoltSave = True Then
GameJoltTempStoreString.Add("saveStorageV" & GameJolt.GamejoltSave.VERSION & "|" & GameJoltSave.GameJoltID & "|player", Data)
@ -1707,8 +1581,8 @@
PlayerStatistics.Track("Steps taken", stepAmount)
'Daycare cycle:
PlayerTemp.DayCareCycle -= stepAmount
If PlayerTemp.DayCareCycle <= 0 Then
Temp.DayCareCycle -= stepAmount
If Temp.DayCareCycle <= 0 Then
Daycare.EggCircle()
'Every 256 steps, add friendship to the Pokémon in the player's team.
@ -1835,12 +1709,12 @@
Private Sub StepEventPokegearCall()
If CanFireStepEvent() = True Then
If Temp.MapSteps > 0 Then
If Temp.LastCall < 256 Then
Temp.LastCall += 1
If Temp.LastPokegearCall < 256 Then
Temp.LastPokegearCall += 1
Else
If Random.Next(0, 700) = 0 Then
GameJolt.PokegearScreen.RandomCall()
Temp.LastCall = 0
Temp.LastPokegearCall = 0
End If
End If
End If
@ -1989,7 +1863,7 @@
End Function
Public Function IsRunning() As Boolean
If KeyBoardHandler.KeyDown(Keys.LeftShift) = True Or ControllerHandler.ButtonDown(Buttons.B) = True Then
If KeyBoardHandler.KeyDown(KeyBindings.SprintingKey) = True Or ControllerHandler.ButtonDown(Buttons.B) = True Then
If Screen.Level.Riding = False And Screen.Level.Surfing = False And Inventory.HasRunningShoes = True Then
Return True
End If
@ -2009,6 +1883,7 @@
Badges.Clear()
PokeFiles.Clear()
EarnedAchievements.Clear()
FileItems.Clear()
PokegearModules.Clear()
PhoneContacts.Clear()
Mails.Clear()
@ -2052,7 +1927,7 @@
startRotation = 0
startFreeCameraMode = False
startMap = "barktown.dat"
startFOV = 45.0F
startFOV = 60.0F
startRotationSpeed = 12
startThirdPerson = False
startSurfing = False

View File

@ -1,22 +1,110 @@
Public Class PlayerTemp
''' <summary>
''' A structure to store temporary data for a save state session.
''' </summary>
Public Class PlayerTemp
Public Property DayCareCycle() As Integer
Get
Return Me._dayCareCycle
End Get
Set(value As Integer)
Me._dayCareCycle = value
End Set
End Property
' Global game states:
Private _dayCareCycle As Integer = 256
''' <summary>
''' The current amount of steps required to complete the next Daycare cycle.
''' </summary>
Public Property DayCareCycle As Integer = 256
Public Sub New()
Me.Reset()
End Sub
''' <summary>
''' The steps since the last Pokégear call.
''' </summary>
Public Property LastPokegearCall As Integer = 32
Public Sub Reset()
Me.DayCareCycle = 256
End Sub
''' <summary>
''' The Item ID of the last used repel item.
''' </summary>
Public Property LastUsedRepel As Integer = -1
''' <summary>
''' Amount of steps on the current map.
''' </summary>
Public Property MapSteps As Integer = 0
''' <summary>
''' The currently playing radio station.
''' </summary>
Public Property RadioStation As Decimal = 0D
' Player related:
''' <summary>
''' The last position of the player.
''' </summary>
Public Property LastPosition As Vector3 = New Vector3()
''' <summary>
''' If the player is currently in battle.
''' </summary>
Public Property IsInBattle As Boolean = False
' Saved overworld stats of the player for network usage:
Public Property BeforeBattlePosition As Vector3 = New Vector3(0)
Public Property BeforeBattleLevelFile As String = "yourroom.dat"
Public Property BeforeBattleFacing As Integer = 0
' Screen menu states:
''' <summary>
''' The pokemon last selected in the <see cref="PartyScreen"/>.
''' </summary>
Public Property PokemonScreenIndex As Integer = 0
''' <summary>
''' The last page selected in the <see cref="SummaryScreen"/>.
''' </summary>
Public Property PokemonStatusPageIndex As Integer = 0
''' <summary>
''' The last tab selected in the <see cref="NewInventoryScreen"/>.
''' </summary>
Public Property InventoryTabIndex As Integer = 0
''' <summary>
''' The selected item in the inventory.
''' </summary>
Public Property InventoryItemIndicies As Integer() = {0, 0, 0, 0, 0, 0, 0}
''' <summary>
''' The selected item in the main menu.
''' </summary>
Public Property MenuIndex As Integer = 0
''' <summary>
''' The index of the last used PC box.
''' </summary>
Public Property PCBoxIndex As Integer = 0
''' <summary>
''' The last position of the cursor in the storage system.
''' </summary>
Public Property StorageSystemCursorPosition As Vector2 = New Vector2(1, 0)
''' <summary>
''' The switches of the map screen that indicate which objects are displayed.
''' </summary>
Public Property MapSwitch As Boolean() = {True, True, True, True}
''' <summary>
''' If the storage system is in box choose mode.
''' </summary>
Public Property PCBoxChooseMode As Boolean = False
''' <summary>
''' The current selection mode for the storage system.
''' </summary>
Public Property PCSelectionType As StorageSystemScreen.SelectionModes = StorageSystemScreen.SelectionModes.SingleMove
''' <summary>
''' The last page selected in the Pokégear.
''' </summary>
Public Property PokegearPage As GameJolt.PokegearScreen.MenuScreens = GameJolt.PokegearScreen.MenuScreens.Main
End Class

View File

@ -122,7 +122,7 @@ Public Class SaveGameHelpers
_tempGJSave.NPC = Core.Player.GetNPCDataData() And
_tempGJSave.Options = Core.Player.GetOptionsData() And
_tempGJSave.Party = Core.Player.GetPartyData() And
GetTimeFixedPlayerData(_tempGJSave.Player) = GetTimeFixedPlayerData(Core.Player.GetPlayerData(False)) And
GetTimeFixedPlayerData(_tempGJSave.Player) = GetTimeFixedPlayerData(Core.Player.GetPlayerData()) And
_tempGJSave.Pokedex = Core.Player.GetPokedexData() And
_tempGJSave.Register = Core.Player.GetRegisterData() And
_tempGJSave.RoamingPokemon = Core.Player.GetRoamingPokemonData() And

View File

@ -11,7 +11,7 @@
Public Overrides Sub Use()
If Core.Player.RepelSteps <= 0 Then
Core.Player.Inventory.RemoveItem(ID, 1)
Player.Temp.LastUsedRepel = ID
Core.Player.Temp.LastUsedRepel = ID
SoundManager.PlaySound("repel_use", False)
Screen.TextBox.Show(Core.Player.Name & " used a~" & Name, {}, True, True)

View File

@ -244,7 +244,7 @@
Core.Player.Pokemons.Add(p)
Else
Dim boxName As String = StorageSystemScreen.GetBoxName(StorageSystemScreen.DepositPokemon(p, Player.Temp.PCBoxIndex))
Dim boxName As String = StorageSystemScreen.GetBoxName(StorageSystemScreen.DepositPokemon(p, Core.Player.Temp.PCBoxIndex))
s = "It was transfered to Box~""" & boxName & """~on your PC."
End If

View File

@ -169,11 +169,11 @@ Public Class NewInventoryScreen
End Sub
Public Sub New(ByVal currentScreen As Screen, ByVal AllowedPages() As Integer, ByVal DoStuff As DoStuff)
Me.New(currentScreen, AllowedPages, Player.Temp.BagIndex, DoStuff)
Me.New(currentScreen, AllowedPages, Core.Player.Temp.InventoryTabIndex, DoStuff)
End Sub
Public Sub New(ByVal currentScreen As Screen)
Me.New(currentScreen, {}, Player.Temp.BagIndex, Nothing)
Me.New(currentScreen, {}, Core.Player.Temp.InventoryTabIndex, Nothing)
End Sub
Public Overrides Sub Draw()

View File

@ -129,7 +129,7 @@
Core.Player.filePrefix = folderPath
Core.Player.GameStart = Date.Now
Core.Player.SaveGame(False)
Core.Player.SaveGame()
Core.Player.LoadGame(folderPath)
Core.Player.startFOV = 60
@ -145,7 +145,7 @@
Construct.Controller.GetInstance().Context = Construct.ScriptContext.Overworld
SetScreen(New TransitionScreen(CurrentScreen, New OverworldScreen(), Color.Black, False))
Core.Player.SaveGame(False)
Core.Player.SaveGame()
End Sub
''' <summary>

View File

@ -39,7 +39,7 @@
Me.regions = regions
Me.regionPointer = startIndex
Me.drawObjects = Player.Temp.MapSwitch
Me.drawObjects = Core.Player.Temp.MapSwitch
Me.MouseVisible = False
@ -266,7 +266,7 @@
End If
If Controls.Dismiss() = True Then
Player.Temp.MapSwitch = Me.drawObjects
Core.Player.Temp.MapSwitch = Me.drawObjects
Core.SetScreen(New TransitionScreen(Me, Me.PreScreen, Color.Black, False))
End If

View File

@ -32,7 +32,7 @@
ConstructMenu()
_menuIndex = Player.Temp.MenuIndex
_menuIndex = Core.Player.Temp.MenuIndex
SetCursorPosition(_menuIndex)
_cursorPosition = _cursorDestPosition
@ -191,7 +191,7 @@
End If
If _buttonIntroFinished = True Then
Player.Temp.MenuIndex = _menuIndex
Core.Player.Temp.MenuIndex = _menuIndex
Dim preMenuIndex As Integer = _menuIndex

View File

@ -155,15 +155,15 @@ Public Class StorageSystemScreen
End Function
Private Sub LoadScreen()
SelectionMode = Player.Temp.PCSelectionType
SelectionMode = Core.Player.Temp.PCSelectionType
CursorMode = CursorModes.Selection
CursorPosition = Player.Temp.StorageSystemCursorPosition
CursorPosition = Core.Player.Temp.StorageSystemCursorPosition
Me.Boxes = LoadBoxes()
Me.CurrentBox = Player.Temp.PCBoxIndex
Me.BoxChooseMode = Player.Temp.PCBoxChooseMode
Me.CurrentBox = Core.Player.Temp.PCBoxIndex
Me.BoxChooseMode = Core.Player.Temp.PCBoxChooseMode
End Sub
#Region "Update"
@ -670,10 +670,10 @@ Public Class StorageSystemScreen
End If
Me.MovingPokemon = Nothing
Else
Player.Temp.StorageSystemCursorPosition = Me.CursorPosition
Player.Temp.PCBoxIndex = Me.CurrentBox
Player.Temp.PCBoxChooseMode = Me.BoxChooseMode
Player.Temp.PCSelectionType = Me.SelectionMode
Core.Player.Temp.StorageSystemCursorPosition = Me.CursorPosition
Core.Player.Temp.PCBoxIndex = Me.CurrentBox
Core.Player.Temp.PCBoxChooseMode = Me.BoxChooseMode
Core.Player.Temp.PCSelectionType = Me.SelectionMode
Core.Player.BoxData = GetBoxSaveData(Me.Boxes)

View File

@ -595,7 +595,7 @@
End Sub
Public Shared Sub EggCircle()
Core.Player.PlayerTemp.DayCareCycle = 256
Core.Player.Temp.DayCareCycle = 256
ObtainEgg()
End Sub

View File

@ -98,7 +98,7 @@ Public Class PartyScreen
_translation = New Globalization.Classes.LOCAL_PartyScreen()
_index = Player.Temp.PokemonScreenIndex
_index = Core.Player.Temp.PokemonScreenIndex
_texture = TextureManager.GetTexture("GUI\Menus\General")
_menuTexture = TextureManager.GetTexture("GUI\Menus\PokemonInfo")
@ -425,7 +425,7 @@ Public Class PartyScreen
_cursorDest = GetBoxPosition(_index)
End If
Player.Temp.PokemonScreenIndex = _index
Core.Player.Temp.PokemonScreenIndex = _index
_cursorPosition.X = MathHelper.Lerp(_cursorDest.X, _cursorPosition.X, 0.8F)
_cursorPosition.Y = MathHelper.Lerp(_cursorDest.Y, _cursorPosition.Y, 0.8F)

View File

@ -55,7 +55,7 @@
_texture = TextureManager.GetTexture("GUI\Menus\General")
_pageIndex = Player.Temp.PokemonSummaryPageIndex
_pageIndex = Core.Player.Temp.PokemonStatusPageIndex
_partyIndex = partyIndex
_party = party
@ -72,7 +72,7 @@
_texture = TextureManager.GetTexture("GUI\Menus\General")
_pageIndex = Player.Temp.PokemonSummaryPageIndex
_pageIndex = Core.Player.Temp.PokemonStatusPageIndex
_selectedPokemon = selectedPokemon
SetDest(_partyIndex)

View File

@ -112,7 +112,7 @@
If ChooseBox.readyForResult = True And savingStarted = False Then
If ChooseBox.result = 0 Then
If ready = False Then
Core.Player.SaveGame(False)
Core.Player.SaveGame()
savingStarted = True

View File

@ -76,7 +76,7 @@
Screen.Level.LevelFile = levelPath
Core.Player.LastSavePlace = Screen.Level.LevelFile
Core.Player.LastSavePlacePosition = Player.Temp.LastPosition.X & "," & Player.Temp.LastPosition.Y.ToString().Replace(GameController.DecSeparator, ".") & "," & Player.Temp.LastPosition.Z
Core.Player.LastSavePlacePosition = Core.Player.Temp.LastPosition.X & "," & Core.Player.Temp.LastPosition.Y.ToString().Replace(GameController.DecSeparator, ".") & "," & Core.Player.Temp.LastPosition.Z
Screen.Level.Entities.Clear()
Screen.Level.Floors.Clear()
@ -93,7 +93,7 @@
LoadedOffsetMapOffsets.Clear()
Floor.ClearFloorTemp()
Player.Temp.MapSteps = 0
Core.Player.Temp.MapSteps = 0
sessionMapsLoaded.Add(levelPath)
End If

@ -1 +1 @@
Subproject commit 853f6b54b18b4ae9b9d6041507e2f937d6bfec06
Subproject commit b7a6b076455b2398f8245af5fb23446f6df47e5b