/// <inheritdoc /> public override int GetHashCode() { unchecked { return(((ValheimVersion != null ? ValheimVersion.GetHashCode() : 0) * 397) ^ (Modules != null ? Modules.GetHashCode() : 0)); } }
public static WorldPlayer Load(ZPackage pkg) { var worldPlayer = new WorldPlayer(); int num = pkg.ReadInt(); if (!ValheimVersion.IsPlayerVersionCompatible(num)) { return(null); } if (num >= 28) { worldPlayer.PlayerStats_kills = pkg.ReadInt(); worldPlayer.PlayerStats_deaths = pkg.ReadInt(); worldPlayer.PlayerStats_crafts = pkg.ReadInt(); worldPlayer.PlayerStats_builds = pkg.ReadInt(); } worldPlayer.WorldPlayerData.Clear(); int num2 = pkg.ReadInt(); for (int i = 0; i < num2; i++) { long key = pkg.ReadLong(); var worldPlayerData = new WorldPlayerData(); worldPlayerData.m_haveCustomSpawnPoint = pkg.ReadBool(); worldPlayerData.m_spawnPoint = pkg.ReadVector3(); worldPlayerData.m_haveLogoutPoint = pkg.ReadBool(); worldPlayerData.m_logoutPoint = pkg.ReadVector3(); if (num >= 30) { worldPlayerData.m_haveDeathPoint = pkg.ReadBool(); worldPlayerData.m_deathPoint = pkg.ReadVector3(); } worldPlayerData.m_homePoint = pkg.ReadVector3(); if (num >= 29 && pkg.ReadBool()) { worldPlayerData.m_mapData = pkg.ReadByteArray(); } worldPlayer.WorldPlayerData.Add(key, worldPlayerData); } worldPlayer.PlayerName = pkg.ReadString(); worldPlayer.PlayerId = pkg.ReadLong(); worldPlayer.StartSeed = pkg.ReadString(); if (pkg.ReadBool()) { var byteArray = pkg.ReadByteArray(); var playerPkg = new ZPackage(byteArray); worldPlayer.Player = PlayerReaderWriter.Load(playerPkg); } else { worldPlayer.Player = null; } return(worldPlayer); }