| using System; |
| using System; |
| using System.Collections; |
| using System.Collections; |
| using System.Collections.Generic; |
| using System.Collections.Generic; |
| using System.Globalization; |
| using System.Globalization; |
| using System.Runtime.CompilerServices; |
| using System.Runtime.CompilerServices; |
| using System.Threading; |
| using System.Threading; |
| using SoftReferenceableAssets.SceneManagement; |
| using SoftReferenceableAssets.SceneManagement; |
| using TMPro; |
| using TMPro; |
| using UnityEngine; |
| using UnityEngine; |
| . | |
| using Valheim.SettingsGui; |
| |
| |
| public class Game : MonoBehaviour |
| public class Game : MonoBehaviour |
| { |
| { |
| public static Game instance { get; private set; } |
| public static Game instance { get; private set; } |
| |
| |
| private void Awake() |
| private void Awake() |
| { |
| { |
| if (string.IsNullOrEmpty(Thread.CurrentThread.Name)) |
| if (string.IsNullOrEmpty(Thread.CurrentThread.Name)) |
| { |
| { |
| Thread.CurrentThread.Name = "MainValheimThread"; |
| Thread.CurrentThread.Name = "MainValheimThread"; |
| } |
| } |
| Game.instance = this; |
| Game.instance = this; |
| foreach (GameObject gameObject in this.m_portalPrefabs) |
| foreach (GameObject gameObject in this.m_portalPrefabs) |
| { |
| { |
| this.PortalPrefabHash.Add(gameObject.name.GetStableHashCode()); |
| this.PortalPrefabHash.Add(gameObject.name.GetStableHashCode()); |
| } |
| } |
| if (!FejdStartup.AwakePlatforms()) |
| if (!FejdStartup.AwakePlatforms()) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| FileHelpers.UpdateCloudEnabledStatus(); |
| FileHelpers.UpdateCloudEnabledStatus(); |
| PrivilegeManager.FlushCache(); |
| PrivilegeManager.FlushCache(); |
| Settings.SetPlatformDefaultPrefs(); |
| Settings.SetPlatformDefaultPrefs(); |
| . | |
| GameplaySettings.SetControllerSpecificFirstTimeSettings(); |
| ZInput.Initialize(); |
| ZInput.Initialize(); |
| if (!global::Console.instance) |
| if (!global::Console.instance) |
| { |
| { |
| UnityEngine.Object.Instantiate<GameObject>(this.m_consolePrefab); |
| UnityEngine.Object.Instantiate<GameObject>(this.m_consolePrefab); |
| } |
| } |
| if (!ServerOptionsGUI.m_instance) |
| if (!ServerOptionsGUI.m_instance) |
| { |
| { |
| UnityEngine.Object.Instantiate<GameObject>(this.m_serverOptionPrefab); |
| UnityEngine.Object.Instantiate<GameObject>(this.m_serverOptionPrefab); |
| } |
| } |
| Settings.ApplyStartupSettings(); |
| Settings.ApplyStartupSettings(); |
| if (string.IsNullOrEmpty(Game.m_profileFilename)) |
| if (string.IsNullOrEmpty(Game.m_profileFilename)) |
| { |
| { |
| this.m_playerProfile = new PlayerProfile(this.m_devProfileName, FileHelpers.FileSource.Local); |
| this.m_playerProfile = new PlayerProfile(this.m_devProfileName, FileHelpers.FileSource.Local); |
| this.m_playerProfile.SetName(this.m_devPlayerName); |
| this.m_playerProfile.SetName(this.m_devPlayerName); |
| this.m_playerProfile.Load(); |
| this.m_playerProfile.Load(); |
| } |
| } |
| else |
| else |
| { |
| { |
| ZLog.Log("Loading player profile " + Game.m_profileFilename); |
| ZLog.Log("Loading player profile " + Game.m_profileFilename); |
| this.m_playerProfile = new PlayerProfile(Game.m_profileFilename, Game.m_profileFileSource); |
| this.m_playerProfile = new PlayerProfile(Game.m_profileFilename, Game.m_profileFileSource); |
| this.m_playerProfile.Load(); |
| this.m_playerProfile.Load(); |
| } |
| } |
| base.InvokeRepeating("CollectResourcesCheckPeriodic", 3600f, 3600f); |
| base.InvokeRepeating("CollectResourcesCheckPeriodic", 3600f, 3600f); |
| Gogan.LogEvent("Screen", "Enter", "InGame", 0L); |
| Gogan.LogEvent("Screen", "Enter", "InGame", 0L); |
| Gogan.LogEvent("Game", "InputMode", ZInput.IsGamepadActive() ? "Gamepad" : "MK", 0L); |
| Gogan.LogEvent("Game", "InputMode", ZInput.IsGamepadActive() ? "Gamepad" : "MK", 0L); |
| ZLog.Log("isModded: " + Game.isModded.ToString()); |
| ZLog.Log("isModded: " + Game.isModded.ToString()); |
| } |
| } |
| |
| |
| private void OnDestroy() |
| private void OnDestroy() |
| { |
| { |
| Game.instance = null; |
| Game.instance = null; |
| } |
| } |
| |
| |
| private void Start() |
| private void Start() |
| { |
| { |
| Application.targetFrameRate = ((Settings.FPSLimit == 29 || Settings.FPSLimit > 360) ? (-1) : Settings.FPSLimit); |
| Application.targetFrameRate = ((Settings.FPSLimit == 29 || Settings.FPSLimit > 360) ? (-1) : Settings.FPSLimit); |
| ZRoutedRpc.instance.Register("SleepStart", new Action<long>(this.SleepStart)); |
| ZRoutedRpc.instance.Register("SleepStart", new Action<long>(this.SleepStart)); |
| ZRoutedRpc.instance.Register("SleepStop", new Action<long>(this.SleepStop)); |
| ZRoutedRpc.instance.Register("SleepStop", new Action<long>(this.SleepStop)); |
| ZRoutedRpc.instance.Register<float>("Ping", new Action<long, float>(this.RPC_Ping)); |
| ZRoutedRpc.instance.Register<float>("Ping", new Action<long, float>(this.RPC_Ping)); |
| ZRoutedRpc.instance.Register<float>("Pong", new Action<long, float>(this.RPC_Pong)); |
| ZRoutedRpc.instance.Register<float>("Pong", new Action<long, float>(this.RPC_Pong)); |
| ZRoutedRpc.instance.Register<ZDOID, ZDOID>("RPC_SetConnection", new Action<long, ZDOID, ZDOID>(this.RPC_SetConnection)); |
| ZRoutedRpc.instance.Register<ZDOID, ZDOID>("RPC_SetConnection", new Action<long, ZDOID, ZDOID>(this.RPC_SetConnection)); |
| ZRoutedRpc.instance.Register<string, int, Vector3, bool>("RPC_DiscoverLocationResponse", new RoutedMethod<string, int, Vector3, bool>.Method(this.RPC_DiscoverLocationResponse)); |
| ZRoutedRpc.instance.Register<string, int, Vector3, bool>("RPC_DiscoverLocationResponse", new RoutedMethod<string, int, Vector3, bool>.Method(this.RPC_DiscoverLocationResponse)); |
| if (ZNet.instance.IsServer()) |
| if (ZNet.instance.IsServer()) |
| { |
| { |
| ZRoutedRpc.instance.Register<string, Vector3, string, int, bool, bool>("RPC_DiscoverClosestLocation", new RoutedMethod<string, Vector3, string, int, bool, bool>.Method(this.RPC_DiscoverClosestLocation)); |
| ZRoutedRpc.instance.Register<string, Vector3, string, int, bool, bool>("RPC_DiscoverClosestLocation", new RoutedMethod<string, Vector3, string, int, bool, bool>.Method(this.RPC_DiscoverClosestLocation)); |
| base.InvokeRepeating("UpdateSleeping", 2f, 2f); |
| base.InvokeRepeating("UpdateSleeping", 2f, 2f); |
| base.StartCoroutine("ConnectPortalsCoroutine"); |
| base.StartCoroutine("ConnectPortalsCoroutine"); |
| } |
| } |
| } |
| } |
| |
| |
| private void ServerLog() |
| private void ServerLog() |
| { |
| { |
| int peerConnections = ZNet.instance.GetPeerConnections(); |
| int peerConnections = ZNet.instance.GetPeerConnections(); |
| int num = ZDOMan.instance.NrOfObjects(); |
| int num = ZDOMan.instance.NrOfObjects(); |
| int sentZDOs = ZDOMan.instance.GetSentZDOs(); |
| int sentZDOs = ZDOMan.instance.GetSentZDOs(); |
| int recvZDOs = ZDOMan.instance.GetRecvZDOs(); |
| int recvZDOs = ZDOMan.instance.GetRecvZDOs(); |
| ZLog.Log(string.Concat(new string[] |
| ZLog.Log(string.Concat(new string[] |
| { |
| { |
| " Connections ", |
| " Connections ", |
| peerConnections.ToString(), |
| peerConnections.ToString(), |
| " ZDOS:", |
| " ZDOS:", |
| num.ToString(), |
| num.ToString(), |
| " sent:", |
| " sent:", |
| sentZDOs.ToString(), |
| sentZDOs.ToString(), |
| " recv:", |
| " recv:", |
| recvZDOs.ToString() |
| recvZDOs.ToString() |
| })); |
| })); |
| } |
| } |
| |
| |
| public void CollectResources(bool displayMessage = false) |
| public void CollectResources(bool displayMessage = false) |
| { |
| { |
| if (displayMessage && Player.m_localPlayer) |
| if (displayMessage && Player.m_localPlayer) |
| { |
| { |
| Player.m_localPlayer.Message(MessageHud.MessageType.TopLeft, "Unloading unused assets", 0, null); |
| Player.m_localPlayer.Message(MessageHud.MessageType.TopLeft, "Unloading unused assets", 0, null); |
| } |
| } |
| ZLog.Log("Unloading unused assets"); |
| ZLog.Log("Unloading unused assets"); |
| Resources.UnloadUnusedAssets(); |
| Resources.UnloadUnusedAssets(); |
| this.m_lastCollectResources = DateTime.Now; |
| this.m_lastCollectResources = DateTime.Now; |
| } |
| } |
| |
| |
| public void CollectResourcesCheckPeriodic() |
| public void CollectResourcesCheckPeriodic() |
| { |
| { |
| if (DateTime.Now - TimeSpan.FromSeconds(3599.0) > this.m_lastCollectResources) |
| if (DateTime.Now - TimeSpan.FromSeconds(3599.0) > this.m_lastCollectResources) |
| { |
| { |
| this.CollectResources(true); |
| this.CollectResources(true); |
| return; |
| return; |
| } |
| } |
| ZLog.Log("Skipping unloading unused assets"); |
| ZLog.Log("Skipping unloading unused assets"); |
| } |
| } |
| |
| |
| public void CollectResourcesCheck() |
| public void CollectResourcesCheck() |
| { |
| { |
| if (DateTime.Now - TimeSpan.FromSeconds(1200.0) > this.m_lastCollectResources) |
| if (DateTime.Now - TimeSpan.FromSeconds(1200.0) > this.m_lastCollectResources) |
| { |
| { |
| this.CollectResources(true); |
| this.CollectResources(true); |
| return; |
| return; |
| } |
| } |
| ZLog.Log("Skipping unloading unused assets"); |
| ZLog.Log("Skipping unloading unused assets"); |
| } |
| } |
| |
| |
| public void Logout(bool save = true, bool changeToStartScene = true) |
| public void Logout(bool save = true, bool changeToStartScene = true) |
| { |
| { |
| if (this.m_shuttingDown) |
| if (this.m_shuttingDown) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| bool shouldExit = false; |
| bool shouldExit = false; |
| bool flag; |
| bool flag; |
| save = ZNet.instance.EnoughDiskSpaceAvailable(out flag, true, delegate(bool exit) |
| save = ZNet.instance.EnoughDiskSpaceAvailable(out flag, true, delegate(bool exit) |
| { |
| { |
| shouldExit = exit; |
| shouldExit = exit; |
| this.ContinueLogout(save, shouldExit, changeToStartScene); |
| this.ContinueLogout(save, shouldExit, changeToStartScene); |
| }); |
| }); |
| if (!flag) |
| if (!flag) |
| { |
| { |
| this.ContinueLogout(save, shouldExit, changeToStartScene); |
| this.ContinueLogout(save, shouldExit, changeToStartScene); |
| } |
| } |
| } |
| } |
| |
| |
| private void ContinueLogout(bool save, bool shouldExit, bool changeToStartScene) |
| private void ContinueLogout(bool save, bool shouldExit, bool changeToStartScene) |
| { |
| { |
| if (!save && !shouldExit) |
| if (!save && !shouldExit) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| this.Shutdown(save); |
| this.Shutdown(save); |
| if (changeToStartScene) |
| if (changeToStartScene) |
| { |
| { |
| SceneManager.LoadScene(this.m_startScene, LoadSceneMode.Single); |
| SceneManager.LoadScene(this.m_startScene, LoadSceneMode.Single); |
| } |
| } |
| } |
| } |
| |
| |
| public bool IsShuttingDown() |
| public bool IsShuttingDown() |
| { |
| { |
| return this.m_shuttingDown; |
| return this.m_shuttingDown; |
| } |
| } |
| |
| |
| private void OnApplicationQuit() |
| private void OnApplicationQuit() |
| { |
| { |
| if (this.m_shuttingDown) |
| if (this.m_shuttingDown) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| ZLog.Log("Game - OnApplicationQuit"); |
| ZLog.Log("Game - OnApplicationQuit"); |
| bool flag2; |
| bool flag2; |
| bool flag = ZNet.instance.EnoughDiskSpaceAvailable(out flag2, false, null); |
| bool flag = ZNet.instance.EnoughDiskSpaceAvailable(out flag2, false, null); |
| this.Shutdown(flag); |
| this.Shutdown(flag); |
| HeightmapBuilder.instance.Dispose(); |
| HeightmapBuilder.instance.Dispose(); |
| FileHelpers.TerminateCloudStorage(); |
| FileHelpers.TerminateCloudStorage(); |
| Thread.Sleep(2000); |
| Thread.Sleep(2000); |
| } |
| } |
| |
| |
| private void Shutdown(bool saveWorld = true) |
| private void Shutdown(bool saveWorld = true) |
| { |
| { |
| if (this.m_shuttingDown) |
| if (this.m_shuttingDown) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| ZLog.Log("Shutting down"); |
| ZLog.Log("Shutting down"); |
| this.m_shuttingDown = true; |
| this.m_shuttingDown = true; |
| if (saveWorld) |
| if (saveWorld) |
| { |
| { |
| this.SavePlayerProfile(true); |
| this.SavePlayerProfile(true); |
| } |
| } |
| ZNetScene.instance.Shutdown(); |
| ZNetScene.instance.Shutdown(); |
| ZNet.instance.Shutdown(saveWorld); |
| ZNet.instance.Shutdown(saveWorld); |
| } |
| } |
| |
| |
| public void SavePlayerProfile(bool setLogoutPoint) |
| public void SavePlayerProfile(bool setLogoutPoint) |
| { |
| { |
| this.m_saveTimer = 0f; |
| this.m_saveTimer = 0f; |
| if (Player.m_localPlayer) |
| if (Player.m_localPlayer) |
| { |
| { |
| this.m_playerProfile.SavePlayerData(Player.m_localPlayer); |
| this.m_playerProfile.SavePlayerData(Player.m_localPlayer); |
| Minimap.instance.SaveMapData(); |
| Minimap.instance.SaveMapData(); |
| if (setLogoutPoint) |
| if (setLogoutPoint) |
| { |
| { |
| this.m_playerProfile.SaveLogoutPoint(); |
| this.m_playerProfile.SaveLogoutPoint(); |
| } |
| } |
| } |
| } |
| if (this.m_playerProfile.m_fileSource == FileHelpers.FileSource.Cloud) |
| if (this.m_playerProfile.m_fileSource == FileHelpers.FileSource.Cloud) |
| { |
| { |
| ulong num = 1048576UL; |
| ulong num = 1048576UL; |
| if (FileHelpers.FileExistsCloud(this.m_playerProfile.GetPath())) |
| if (FileHelpers.FileExistsCloud(this.m_playerProfile.GetPath())) |
| { |
| { |
| num += FileHelpers.GetFileSize(this.m_playerProfile.GetPath(), FileHelpers.FileSource.Cloud); |
| num += FileHelpers.GetFileSize(this.m_playerProfile.GetPath(), FileHelpers.FileSource.Cloud); |
| } |
| } |
| num *= 3UL; |
| num *= 3UL; |
| if (FileHelpers.OperationExceedsCloudCapacity(num)) |
| if (FileHelpers.OperationExceedsCloudCapacity(num)) |
| { |
| { |
| string path = this.m_playerProfile.GetPath(); |
| string path = this.m_playerProfile.GetPath(); |
| this.m_playerProfile.m_fileSource = FileHelpers.FileSource.Local; |
| this.m_playerProfile.m_fileSource = FileHelpers.FileSource.Local; |
| string path2 = this.m_playerProfile.GetPath(); |
| string path2 = this.m_playerProfile.GetPath(); |
| if (FileHelpers.FileExistsCloud(path)) |
| if (FileHelpers.FileExistsCloud(path)) |
| { |
| { |
| FileHelpers.FileCopyOutFromCloud(path, path2, true); |
| FileHelpers.FileCopyOutFromCloud(path, path2, true); |
| } |
| } |
| SaveSystem.InvalidateCache(); |
| SaveSystem.InvalidateCache(); |
| ZLog.LogWarning("The character save operation may exceed the cloud save quota and it has therefore been moved to local storage!"); |
| ZLog.LogWarning("The character save operation may exceed the cloud save quota and it has therefore been moved to local storage!"); |
| } |
| } |
| } |
| } |
| this.m_playerProfile.Save(); |
| this.m_playerProfile.Save(); |
| } |
| } |
| |
| |
| private Player SpawnPlayer(Vector3 spawnPoint) |
| private Player SpawnPlayer(Vector3 spawnPoint) |
| { |
| { |
| ZLog.DevLog("Spawning player:" + Time.frameCount.ToString()); |
| ZLog.DevLog("Spawning player:" + Time.frameCount.ToString()); |
| Player component = UnityEngine.Object.Instantiate<GameObject>(this.m_playerPrefab, spawnPoint, Quaternion.identity).GetComponent<Player>(); |
| Player component = UnityEngine.Object.Instantiate<GameObject>(this.m_playerPrefab, spawnPoint, Quaternion.identity).GetComponent<Player>(); |
| component.SetLocalPlayer(); |
| component.SetLocalPlayer(); |
| this.m_playerProfile.LoadPlayerData(component); |
| this.m_playerProfile.LoadPlayerData(component); |
| ZNet.instance.SetCharacterID(component.GetZDOID()); |
| ZNet.instance.SetCharacterID(component.GetZDOID()); |
| component.OnSpawned(); |
| component.OnSpawned(); |
| return component; |
| return component; |
| } |
| } |
| |
| |
| private Bed FindBedNearby(Vector3 point, float maxDistance) |
| private Bed FindBedNearby(Vector3 point, float maxDistance) |
| { |
| { |
| foreach (Bed bed in UnityEngine.Object.FindObjectsOfType<Bed>()) |
| foreach (Bed bed in UnityEngine.Object.FindObjectsOfType<Bed>()) |
| { |
| { |
| if (bed.IsCurrent()) |
| if (bed.IsCurrent()) |
| { |
| { |
| return bed; |
| return bed; |
| } |
| } |
| } |
| } |
| return null; |
| return null; |
| } |
| } |
| |
| |
| private bool FindSpawnPoint(out Vector3 point, out bool usedLogoutPoint, float dt) |
| private bool FindSpawnPoint(out Vector3 point, out bool usedLogoutPoint, float dt) |
| { |
| { |
| this.m_respawnWait += dt; |
| this.m_respawnWait += dt; |
| usedLogoutPoint = false; |
| usedLogoutPoint = false; |
| if (!this.m_respawnAfterDeath && this.m_playerProfile.HaveLogoutPoint()) |
| if (!this.m_respawnAfterDeath && this.m_playerProfile.HaveLogoutPoint()) |
| { |
| { |
| Vector3 logoutPoint = this.m_playerProfile.GetLogoutPoint(); |
| Vector3 logoutPoint = this.m_playerProfile.GetLogoutPoint(); |
| ZNet.instance.SetReferencePosition(logoutPoint); |
| ZNet.instance.SetReferencePosition(logoutPoint); |
| . | if (this.m_respawnWait <= 8f || !ZNetScene.instance.IsAreaReady(logoutPoint)) |
| if (this.m_respawnWait <= this.m_respawnLoadDuration || !ZNetScene.instance.IsAreaReady(logoutPoint)) |
| { |
| { |
| point = Vector3.zero; |
| point = Vector3.zero; |
| return false; |
| return false; |
| } |
| } |
| float num; |
| float num; |
| if (!ZoneSystem.instance.GetGroundHeight(logoutPoint, out num)) |
| if (!ZoneSystem.instance.GetGroundHeight(logoutPoint, out num)) |
| { |
| { |
| string text = "Invalid spawn point, no ground "; |
| string text = "Invalid spawn point, no ground "; |
| Vector3 vector = logoutPoint; |
| Vector3 vector = logoutPoint; |
| ZLog.Log(text + vector.ToString()); |
| ZLog.Log(text + vector.ToString()); |
| this.m_respawnWait = 0f; |
| this.m_respawnWait = 0f; |
| this.m_playerProfile.ClearLoguoutPoint(); |
| this.m_playerProfile.ClearLoguoutPoint(); |
| point = Vector3.zero; |
| point = Vector3.zero; |
| return false; |
| return false; |
| } |
| } |
| this.m_playerProfile.ClearLoguoutPoint(); |
| this.m_playerProfile.ClearLoguoutPoint(); |
| point = logoutPoint; |
| point = logoutPoint; |
| if (point.y < num) |
| if (point.y < num) |
| { |
| { |
| point.y = num; |
| point.y = num; |
| } |
| } |
| point.y += 0.25f; |
| point.y += 0.25f; |
| usedLogoutPoint = true; |
| usedLogoutPoint = true; |
| ZLog.Log("Spawned after " + this.m_respawnWait.ToString()); |
| ZLog.Log("Spawned after " + this.m_respawnWait.ToString()); |
| return true; |
| return true; |
| } |
| } |
| else if (this.m_playerProfile.HaveCustomSpawnPoint()) |
| else if (this.m_playerProfile.HaveCustomSpawnPoint()) |
| { |
| { |
| Vector3 customSpawnPoint = this.m_playerProfile.GetCustomSpawnPoint(); |
| Vector3 customSpawnPoint = this.m_playerProfile.GetCustomSpawnPoint(); |
| ZNet.instance.SetReferencePosition(customSpawnPoint); |
| ZNet.instance.SetReferencePosition(customSpawnPoint); |
| . | if (this.m_respawnWait <= 8f || !ZNetScene.instance.IsAreaReady(customSpawnPoint)) |
| if (this.m_respawnWait <= this.m_respawnLoadDuration || !ZNetScene.instance.IsAreaReady(customSpawnPoint)) |
| { |
| { |
| point = Vector3.zero; |
| point = Vector3.zero; |
| return false; |
| return false; |
| } |
| } |
| Bed bed = this.FindBedNearby(customSpawnPoint, 5f); |
| Bed bed = this.FindBedNearby(customSpawnPoint, 5f); |
| if (bed != null) |
| if (bed != null) |
| { |
| { |
| ZLog.Log("Found bed at custom spawn point"); |
| ZLog.Log("Found bed at custom spawn point"); |
| point = bed.GetSpawnPoint(); |
| point = bed.GetSpawnPoint(); |
| return true; |
| return true; |
| } |
| } |
| ZLog.Log("Failed to find bed at custom spawn point, using original"); |
| ZLog.Log("Failed to find bed at custom spawn point, using original"); |
| this.m_playerProfile.ClearCustomSpawnPoint(); |
| this.m_playerProfile.ClearCustomSpawnPoint(); |
| this.m_respawnWait = 0f; |
| this.m_respawnWait = 0f; |
| point = Vector3.zero; |
| point = Vector3.zero; |
| return false; |
| return false; |
| } |
| } |
| else |
| else |
| { |
| { |
| Vector3 vector2; |
| Vector3 vector2; |
| if (ZoneSystem.instance.GetLocationIcon(this.m_StartLocation, out vector2)) |
| if (ZoneSystem.instance.GetLocationIcon(this.m_StartLocation, out vector2)) |
| { |
| { |
| point = vector2 + Vector3.up * 2f; |
| point = vector2 + Vector3.up * 2f; |
| ZNet.instance.SetReferencePosition(point); |
| ZNet.instance.SetReferencePosition(point); |
| return ZNetScene.instance.IsAreaReady(point); |
| return ZNetScene.instance.IsAreaReady(point); |
| } |
| } |
| ZNet.instance.SetReferencePosition(Vector3.zero); |
| ZNet.instance.SetReferencePosition(Vector3.zero); |
| point = Vector3.zero; |
| point = Vector3.zero; |
| return false; |
| return false; |
| } |
| } |
| } |
| } |
| |
| |
| public void RemoveCustomSpawnPoint(Vector3 point) |
| public void RemoveCustomSpawnPoint(Vector3 point) |
| { |
| { |
| if (this.m_playerProfile.HaveCustomSpawnPoint()) |
| if (this.m_playerProfile.HaveCustomSpawnPoint()) |
| { |
| { |
| Vector3 customSpawnPoint = this.m_playerProfile.GetCustomSpawnPoint(); |
| Vector3 customSpawnPoint = this.m_playerProfile.GetCustomSpawnPoint(); |
| if (point == customSpawnPoint) |
| if (point == customSpawnPoint) |
| { |
| { |
| this.m_playerProfile.ClearCustomSpawnPoint(); |
| this.m_playerProfile.ClearCustomSpawnPoint(); |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| |
| private static Vector3 GetPointOnCircle(float distance, float angle) |
| private static Vector3 GetPointOnCircle(float distance, float angle) |
| { |
| { |
| return new Vector3(Mathf.Sin(angle) * distance, 0f, Mathf.Cos(angle) * distance); |
| return new Vector3(Mathf.Sin(angle) * distance, 0f, Mathf.Cos(angle) * distance); |
| } |
| } |
| |
| |
| public void RequestRespawn(float delay, bool afterDeath = false) |
| public void RequestRespawn(float delay, bool afterDeath = false) |
| { |
| { |
| this.m_respawnAfterDeath = afterDeath; |
| this.m_respawnAfterDeath = afterDeath; |
| base.CancelInvoke("_RequestRespawn"); |
| base.CancelInvoke("_RequestRespawn"); |
| base.Invoke("_RequestRespawn", delay); |
| base.Invoke("_RequestRespawn", delay); |
| } |
| } |
| |
| |
| private void _RequestRespawn() |
| private void _RequestRespawn() |
| { |
| { |
| ZLog.Log("Starting respawn"); |
| ZLog.Log("Starting respawn"); |
| if (Player.m_localPlayer) |
| if (Player.m_localPlayer) |
| { |
| { |
| this.m_playerProfile.SavePlayerData(Player.m_localPlayer); |
| this.m_playerProfile.SavePlayerData(Player.m_localPlayer); |
| } |
| } |
| if (Player.m_localPlayer) |
| if (Player.m_localPlayer) |
| { |
| { |
| ZNetScene.instance.Destroy(Player.m_localPlayer.gameObject); |
| ZNetScene.instance.Destroy(Player.m_localPlayer.gameObject); |
| ZNet.instance.SetCharacterID(ZDOID.None); |
| ZNet.instance.SetCharacterID(ZDOID.None); |
| } |
| } |
| this.m_respawnWait = 0f; |
| this.m_respawnWait = 0f; |
| this.m_requestRespawn = true; |
| this.m_requestRespawn = true; |
| MusicMan.instance.TriggerMusic("respawn"); |
| MusicMan.instance.TriggerMusic("respawn"); |
| } |
| } |
| |
| |
| private void Update() |
| private void Update() |
| { |
| { |
| if (this.m_shuttingDown) |
| if (this.m_shuttingDown) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| bool flag = Settings.FPSLimit != 29 && Settings.FPSLimit <= 360; |
| bool flag = Settings.FPSLimit != 29 && Settings.FPSLimit <= 360; |
| if (Settings.ReduceBackgroundUsage && !Application.isFocused) |
| if (Settings.ReduceBackgroundUsage && !Application.isFocused) |
| { |
| { |
| Application.targetFrameRate = (flag ? Mathf.Min(30, Settings.FPSLimit) : 30); |
| Application.targetFrameRate = (flag ? Mathf.Min(30, Settings.FPSLimit) : 30); |
| } |
| } |
| else if (Game.IsPaused()) |
| else if (Game.IsPaused()) |
| { |
| { |
| Application.targetFrameRate = (flag ? Mathf.Min(60, Settings.FPSLimit) : 60); |
| Application.targetFrameRate = (flag ? Mathf.Min(60, Settings.FPSLimit) : 60); |
| } |
| } |
| else |
| else |
| { |
| { |
| Application.targetFrameRate = (flag ? Settings.FPSLimit : (-1)); |
| Application.targetFrameRate = (flag ? Settings.FPSLimit : (-1)); |
| } |
| } |
| if (Terminal.m_showTests) |
| if (Terminal.m_showTests) |
| { |
| { |
| Terminal.m_testList["fps limit"] = Application.targetFrameRate.ToString(); |
| Terminal.m_testList["fps limit"] = Application.targetFrameRate.ToString(); |
| } |
| } |
| Game.UpdatePause(); |
| Game.UpdatePause(); |
| ZInput.Update(Time.unscaledDeltaTime); |
| ZInput.Update(Time.unscaledDeltaTime); |
| this.UpdateSaving(Time.unscaledDeltaTime); |
| this.UpdateSaving(Time.unscaledDeltaTime); |
| LightLod.UpdateLights(Time.deltaTime); |
| LightLod.UpdateLights(Time.deltaTime); |
| } |
| } |
| |
| |
| private void OnGUI() |
| private void OnGUI() |
| { |
| { |
| ZInput.OnGUI(); |
| ZInput.OnGUI(); |
| } |
| } |
| |
| |
| private void FixedUpdate() |
| private void FixedUpdate() |
| { |
| { |
| if (ZNet.m_loadError) |
| if (ZNet.m_loadError) |
| { |
| { |
| this.Logout(true, true); |
| this.Logout(true, true); |
| ZLog.LogError("World load failed, exiting without save. Check backups!"); |
| ZLog.LogError("World load failed, exiting without save. Check backups!"); |
| } |
| } |
| if (!this.m_haveSpawned && ZNet.GetConnectionStatus() == ZNet.ConnectionStatus.Connected) |
| if (!this.m_haveSpawned && ZNet.GetConnectionStatus() == ZNet.ConnectionStatus.Connected) |
| { |
| { |
| this.m_haveSpawned = true; |
| this.m_haveSpawned = true; |
| this.RequestRespawn(0f, false); |
| this.RequestRespawn(0f, false); |
| } |
| } |
| ZInput.FixedUpdate(Time.fixedDeltaTime); |
| ZInput.FixedUpdate(Time.fixedDeltaTime); |
| if (ZNet.GetConnectionStatus() != ZNet.ConnectionStatus.Connecting && ZNet.GetConnectionStatus() != ZNet.ConnectionStatus.Connected) |
| if (ZNet.GetConnectionStatus() != ZNet.ConnectionStatus.Connecting && ZNet.GetConnectionStatus() != ZNet.ConnectionStatus.Connected) |
| { |
| { |
| ZLog.Log("Lost connection to server:" + ZNet.GetConnectionStatus().ToString()); |
| ZLog.Log("Lost connection to server:" + ZNet.GetConnectionStatus().ToString()); |
| this.Logout(true, true); |
| this.Logout(true, true); |
| return; |
| return; |
| } |
| } |
| this.UpdateRespawn(Time.fixedDeltaTime); |
| this.UpdateRespawn(Time.fixedDeltaTime); |
| } |
| } |
| |
| |
| private void UpdateSaving(float dt) |
| private void UpdateSaving(float dt) |
| { |
| { |
| if (Game.m_saveInterval - this.m_saveTimer > 30f && Game.m_saveInterval - (this.m_saveTimer + dt) <= 30f && MessageHud.instance && ZNet.instance.IsServer()) |
| if (Game.m_saveInterval - this.m_saveTimer > 30f && Game.m_saveInterval - (this.m_saveTimer + dt) <= 30f && MessageHud.instance && ZNet.instance.IsServer()) |
| { |
| { |
| MessageHud.instance.MessageAll(MessageHud.MessageType.Center, "$msg_worldsavewarning " + 30f.ToString() + "s"); |
| MessageHud.instance.MessageAll(MessageHud.MessageType.Center, "$msg_worldsavewarning " + 30f.ToString() + "s"); |
| } |
| } |
| this.m_saveTimer += dt; |
| this.m_saveTimer += dt; |
| if (this.m_saveTimer > Game.m_saveInterval) |
| if (this.m_saveTimer > Game.m_saveInterval) |
| { |
| { |
| bool flag; |
| bool flag; |
| if (!ZNet.instance.EnoughDiskSpaceAvailable(out flag, false, null)) |
| if (!ZNet.instance.EnoughDiskSpaceAvailable(out flag, false, null)) |
| { |
| { |
| this.m_saveTimer -= 300f; |
| this.m_saveTimer -= 300f; |
| return; |
| return; |
| } |
| } |
| this.SavePlayerProfile(false); |
| this.SavePlayerProfile(false); |
| if (ZNet.instance) |
| if (ZNet.instance) |
| { |
| { |
| ZNet.instance.Save(false, true); |
| ZNet.instance.Save(false, true); |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| |
| private void UpdateRespawn(float dt) |
| private void UpdateRespawn(float dt) |
| { |
| { |
| if (!this.m_requestRespawn) |
| if (!this.m_requestRespawn) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| Vector3 vector; |
| Vector3 vector; |
| bool flag; |
| bool flag; |
| if (!this.FindSpawnPoint(out vector, out flag, dt)) |
| if (!this.FindSpawnPoint(out vector, out flag, dt)) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| TextViewer.instance.HideIntro(); |
| TextViewer.instance.HideIntro(); |
| if (!flag) |
| if (!flag) |
| { |
| { |
| this.m_playerProfile.SetHomePoint(vector); |
| this.m_playerProfile.SetHomePoint(vector); |
| } |
| } |
| this.SpawnPlayer(vector); |
| this.SpawnPlayer(vector); |
| this.m_requestRespawn = false; |
| this.m_requestRespawn = false; |
| if (this.m_firstSpawn) |
| if (this.m_firstSpawn) |
| { |
| { |
| this.m_firstSpawn = false; |
| this.m_firstSpawn = false; |
| Chat.instance.SendText(Talker.Type.Shout, Localization.instance.Localize("$text_player_arrived")); |
| Chat.instance.SendText(Talker.Type.Shout, Localization.instance.Localize("$text_player_arrived")); |
| Game.UpdateNoMap(); |
| Game.UpdateNoMap(); |
| JoinCode.Show(true); |
| JoinCode.Show(true); |
| if (ZNet.m_loadError) |
| if (ZNet.m_loadError) |
| { |
| { |
| Player.m_localPlayer.Message(MessageHud.MessageType.Center, "World load error, saving disabled! Recover your .old file or backups!", 0, null); |
| Player.m_localPlayer.Message(MessageHud.MessageType.Center, "World load error, saving disabled! Recover your .old file or backups!", 0, null); |
| Hud.instance.m_betaText.GetComponent<TMP_Text>().text = ""; |
| Hud.instance.m_betaText.GetComponent<TMP_Text>().text = ""; |
| Hud.instance.m_betaText.transform.GetChild(0).GetComponent<TMP_Text>().text = "WORLD SAVE DISABLED! (World load error)"; |
| Hud.instance.m_betaText.transform.GetChild(0).GetComponent<TMP_Text>().text = "WORLD SAVE DISABLED! (World load error)"; |
| Hud.instance.m_betaText.SetActive(true); |
| Hud.instance.m_betaText.SetActive(true); |
| } |
| } |
| } |
| } |
| Game.instance.CollectResourcesCheck(); |
| Game.instance.CollectResourcesCheck(); |
| } |
| } |
| |
| |
| public bool WaitingForRespawn() |
| public bool WaitingForRespawn() |
| { |
| { |
| return this.m_requestRespawn; |
| return this.m_requestRespawn; |
| } |
| } |
| |
| |
| public PlayerProfile GetPlayerProfile() |
| public PlayerProfile GetPlayerProfile() |
| { |
| { |
| return this.m_playerProfile; |
| return this.m_playerProfile; |
| } |
| } |
| |
| |
| public void IncrementPlayerStat(PlayerStatType stat, float amount = 1f) |
| public void IncrementPlayerStat(PlayerStatType stat, float amount = 1f) |
| { |
| { |
| this.m_playerProfile.IncrementStat(stat, amount); |
| this.m_playerProfile.IncrementStat(stat, amount); |
| } |
| } |
| |
| |
| public static void SetProfile(string filename, FileHelpers.FileSource fileSource) |
| public static void SetProfile(string filename, FileHelpers.FileSource fileSource) |
| { |
| { |
| Game.m_profileFilename = filename; |
| Game.m_profileFilename = filename; |
| Game.m_profileFileSource = fileSource; |
| Game.m_profileFileSource = fileSource; |
| } |
| } |
| |
| |
| private IEnumerator ConnectPortalsCoroutine() |
| private IEnumerator ConnectPortalsCoroutine() |
| { |
| { |
| for (;;) |
| for (;;) |
| { |
| { |
| this.ConnectPortals(); |
| this.ConnectPortals(); |
| yield return new WaitForSeconds(5f); |
| yield return new WaitForSeconds(5f); |
| } |
| } |
| yield break; |
| yield break; |
| } |
| } |
| |
| |
| public void ConnectPortals() |
| public void ConnectPortals() |
| { |
| { |
| . | |
| this.ClearCurrentlyConnectingPortals(); |
| List<ZDO> portals = ZDOMan.instance.GetPortals(); |
| List<ZDO> portals = ZDOMan.instance.GetPortals(); |
| int num = 0; |
| int num = 0; |
| foreach (ZDO zdo in portals) |
| foreach (ZDO zdo in portals) |
| { |
| { |
| ZDOID connectionZDOID = zdo.GetConnectionZDOID(ZDOExtraData.ConnectionType.Portal); |
| ZDOID connectionZDOID = zdo.GetConnectionZDOID(ZDOExtraData.ConnectionType.Portal); |
| string @string = zdo.GetString(ZDOVars.s_tag, ""); |
| string @string = zdo.GetString(ZDOVars.s_tag, ""); |
| if (!connectionZDOID.IsNone()) |
| if (!connectionZDOID.IsNone()) |
| { |
| { |
| ZDO zdo2 = ZDOMan.instance.GetZDO(connectionZDOID); |
| ZDO zdo2 = ZDOMan.instance.GetZDO(connectionZDOID); |
| if (zdo2 == null || zdo2.GetString(ZDOVars.s_tag, "") != @string) |
| if (zdo2 == null || zdo2.GetString(ZDOVars.s_tag, "") != @string) |
| { |
| { |
| . | zdo.SetOwner(ZDOMan.GetSessionID()); |
| this.SetConnection(zdo, ZDOID.None, false); |
| zdo.UpdateConnection(ZDOExtraData.ConnectionType.Portal, ZDOID.None); |
| |
| ZDOMan.instance.ForceSendZDO(zdo.m_uid); |
| |
| } |
| } |
| } |
| } |
| } |
| } |
| foreach (ZDO zdo3 in portals) |
| foreach (ZDO zdo3 in portals) |
| { |
| { |
| . | if (zdo3.GetConnectionZDOID(ZDOExtraData.ConnectionType.Portal).IsNone()) |
| if (!this.IsCurrentlyConnectingPortal(zdo3) && zdo3.GetConnectionZDOID(ZDOExtraData.ConnectionType.Portal).IsNone()) |
| { |
| { |
| string string2 = zdo3.GetString(ZDOVars.s_tag, ""); |
| string string2 = zdo3.GetString(ZDOVars.s_tag, ""); |
| ZDO zdo4 = this.FindRandomUnconnectedPortal(portals, zdo3, string2); |
| ZDO zdo4 = this.FindRandomUnconnectedPortal(portals, zdo3, string2); |
| if (zdo4 != null) |
| if (zdo4 != null) |
| { |
| { |
| . | this.SetConnection(zdo3, zdo4); |
| this.AddToCurrentlyConnectingPortals(zdo3, zdo4); |
| this.SetConnection(zdo4, zdo3); |
| this.SetConnection(zdo3, zdo4.m_uid, false); |
| |
| this.SetConnection(zdo4, zdo3.m_uid, false); |
| num++; |
| num++; |
| string text = "Connected portals "; |
| string text = "Connected portals "; |
| ZDO zdo5 = zdo3; |
| ZDO zdo5 = zdo3; |
| string text2 = ((zdo5 != null) ? zdo5.ToString() : null); |
| string text2 = ((zdo5 != null) ? zdo5.ToString() : null); |
| string text3 = " <-> "; |
| string text3 = " <-> "; |
| ZDO zdo6 = zdo4; |
| ZDO zdo6 = zdo4; |
| ZLog.Log(text + text2 + text3 + ((zdo6 != null) ? zdo6.ToString() : null)); |
| ZLog.Log(text + text2 + text3 + ((zdo6 != null) ? zdo6.ToString() : null)); |
| } |
| } |
| } |
| } |
| } |
| } |
| if (num > 0) |
| if (num > 0) |
| { |
| { |
| ZLog.Log("[ Connected " + num.ToString() + " portals ]"); |
| ZLog.Log("[ Connected " + num.ToString() + " portals ]"); |
| } |
| } |
| } |
| } |
| |
| |
| . | private void SetConnection(ZDO portal, ZDO connection) |
| private void ForceSetConnection(ZDO portal, ZDOID connection) |
| |
| { |
| |
| if (portal.GetConnectionZDOID(ZDOExtraData.ConnectionType.Portal) != connection) |
| |
| { |
| |
| this.SetConnection(portal, connection, true); |
| |
| } |
| |
| } |
| |
| |
| |
| private void SetConnection(ZDO portal, ZDOID connection, bool forceImmediateConnection = false) |
| { |
| { |
| long owner = portal.GetOwner(); |
| long owner = portal.GetOwner(); |
| . | if (owner == 0L) |
| bool flag = ZNet.instance.GetPeer(owner) != null; |
| |
| if (owner == 0L || !flag || forceImmediateConnection) |
| { |
| { |
| portal.SetOwner(ZDOMan.GetSessionID()); |
| portal.SetOwner(ZDOMan.GetSessionID()); |
| . | portal.SetConnection(ZDOExtraData.ConnectionType.Portal, connection.m_uid); |
| portal.SetConnection(ZDOExtraData.ConnectionType.Portal, connection); |
| ZDOMan.instance.ForceSendZDO(portal.m_uid); |
| ZDOMan.instance.ForceSendZDO(portal.m_uid); |
| return; |
| return; |
| } |
| } |
| . | ZRoutedRpc.instance.InvokeRoutedRPC(owner, "RPC_SetConnection", new object[] { portal.m_uid, connection.m_uid }); |
| ZRoutedRpc.instance.InvokeRoutedRPC(owner, "RPC_SetConnection", new object[] { portal.m_uid, connection }); |
| } |
| } |
| |
| |
| private void RPC_SetConnection(long sender, ZDOID portalID, ZDOID connectionID) |
| private void RPC_SetConnection(long sender, ZDOID portalID, ZDOID connectionID) |
| { |
| { |
| ZDO zdo = ZDOMan.instance.GetZDO(portalID); |
| ZDO zdo = ZDOMan.instance.GetZDO(portalID); |
| if (zdo == null) |
| if (zdo == null) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| . | |
| zdo.SetOwner(ZDOMan.GetSessionID()); |
| zdo.SetConnection(ZDOExtraData.ConnectionType.Portal, connectionID); |
| zdo.SetConnection(ZDOExtraData.ConnectionType.Portal, connectionID); |
| ZDOMan.instance.ForceSendZDO(portalID); |
| ZDOMan.instance.ForceSendZDO(portalID); |
| } |
| } |
| |
| |
| private ZDO FindRandomUnconnectedPortal(List<ZDO> portals, ZDO skip, string tag) |
| private ZDO FindRandomUnconnectedPortal(List<ZDO> portals, ZDO skip, string tag) |
| { |
| { |
| List<ZDO> list = new List<ZDO>(); |
| List<ZDO> list = new List<ZDO>(); |
| foreach (ZDO zdo in portals) |
| foreach (ZDO zdo in portals) |
| { |
| { |
| . | if (zdo != skip && !(zdo.GetString(ZDOVars.s_tag, "") != tag) && !(zdo.GetConnectionZDOID(ZDOExtraData.ConnectionType.Portal) != ZDOID.None)) |
| if (zdo != skip && !(zdo.GetString(ZDOVars.s_tag, "") != tag) && !(zdo.GetConnectionZDOID(ZDOExtraData.ConnectionType.Portal) != ZDOID.None) && !this.IsCurrentlyConnectingPortal(zdo)) |
| { |
| { |
| list.Add(zdo); |
| list.Add(zdo); |
| } |
| } |
| } |
| } |
| if (list.Count == 0) |
| if (list.Count == 0) |
| { |
| { |
| return null; |
| return null; |
| } |
| } |
| return list[UnityEngine.Random.Range(0, list.Count)]; |
| return list[UnityEngine.Random.Range(0, list.Count)]; |
| } |
| } |
| |
| |
| . | |
| private void AddToCurrentlyConnectingPortals(ZDO portalA, ZDO portalB) |
| |
| { |
| |
| this.m_currentlyConnectingPortals.Add(new Game.ConnectingPortals |
| |
| { |
| |
| PortalA = portalA, |
| |
| PortalB = portalB |
| |
| }); |
| |
| } |
| |
| |
| |
| private void ClearCurrentlyConnectingPortals() |
| |
| { |
| |
| foreach (Game.ConnectingPortals connectingPortals in this.m_currentlyConnectingPortals) |
| |
| { |
| |
| this.ForceSetConnection(connectingPortals.PortalA, connectingPortals.PortalB.m_uid); |
| |
| this.ForceSetConnection(connectingPortals.PortalB, connectingPortals.PortalA.m_uid); |
| |
| } |
| |
| this.m_currentlyConnectingPortals.Clear(); |
| |
| } |
| |
| |
| |
| private bool IsCurrentlyConnectingPortal(ZDO zdo) |
| |
| { |
| |
| foreach (Game.ConnectingPortals connectingPortals in this.m_currentlyConnectingPortals) |
| |
| { |
| |
| if (zdo == connectingPortals.PortalA || zdo == connectingPortals.PortalB) |
| |
| { |
| |
| return true; |
| |
| } |
| |
| } |
| |
| return false; |
| |
| } |
| |
| |
| private void UpdateSleeping() |
| private void UpdateSleeping() |
| { |
| { |
| if (!ZNet.instance.IsServer()) |
| if (!ZNet.instance.IsServer()) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| if (this.m_sleeping) |
| if (this.m_sleeping) |
| { |
| { |
| if (!EnvMan.instance.IsTimeSkipping()) |
| if (!EnvMan.instance.IsTimeSkipping()) |
| { |
| { |
| this.m_lastSleepTime = ZNet.instance.GetTimeSeconds(); |
| this.m_lastSleepTime = ZNet.instance.GetTimeSeconds(); |
| this.m_sleeping = false; |
| this.m_sleeping = false; |
| ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.Everybody, "SleepStop", Array.Empty<object>()); |
| ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.Everybody, "SleepStop", Array.Empty<object>()); |
| return; |
| return; |
| } |
| } |
| } |
| } |
| else if (!EnvMan.instance.IsTimeSkipping()) |
| else if (!EnvMan.instance.IsTimeSkipping()) |
| { |
| { |
| . | if (!EnvMan.instance.IsAfternoon() && !EnvMan.instance.IsNight()) |
| if (!EnvMan.IsAfternoon() && !EnvMan.IsNight()) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| if (!this.EverybodyIsTryingToSleep() || ZNet.instance.GetTimeSeconds() - this.m_lastSleepTime < 10.0) |
| if (!this.EverybodyIsTryingToSleep() || ZNet.instance.GetTimeSeconds() - this.m_lastSleepTime < 10.0) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| EnvMan.instance.SkipToMorning(); |
| EnvMan.instance.SkipToMorning(); |
| this.m_sleeping = true; |
| this.m_sleeping = true; |
| ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.Everybody, "SleepStart", Array.Empty<object>()); |
| ZRoutedRpc.instance.InvokeRoutedRPC(ZRoutedRpc.Everybody, "SleepStart", Array.Empty<object>()); |
| } |
| } |
| } |
| } |
| |
| |
| private bool EverybodyIsTryingToSleep() |
| private bool EverybodyIsTryingToSleep() |
| { |
| { |
| List<ZDO> allCharacterZDOS = ZNet.instance.GetAllCharacterZDOS(); |
| List<ZDO> allCharacterZDOS = ZNet.instance.GetAllCharacterZDOS(); |
| if (allCharacterZDOS.Count == 0) |
| if (allCharacterZDOS.Count == 0) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| using (List<ZDO>.Enumerator enumerator = allCharacterZDOS.GetEnumerator()) |
| using (List<ZDO>.Enumerator enumerator = allCharacterZDOS.GetEnumerator()) |
| { |
| { |
| while (enumerator.MoveNext()) |
| while (enumerator.MoveNext()) |
| { |
| { |
| if (!enumerator.Current.GetBool(ZDOVars.s_inBed, false)) |
| if (!enumerator.Current.GetBool(ZDOVars.s_inBed, false)) |
| { |
| { |
| return false; |
| return false; |
| } |
| } |
| } |
| } |
| } |
| } |
| return true; |
| return true; |
| } |
| } |
| |
| |
| private void SleepStart(long sender) |
| private void SleepStart(long sender) |
| { |
| { |
| Player localPlayer = Player.m_localPlayer; |
| Player localPlayer = Player.m_localPlayer; |
| if (localPlayer) |
| if (localPlayer) |
| { |
| { |
| localPlayer.SetSleeping(true); |
| localPlayer.SetSleeping(true); |
| } |
| } |
| } |
| } |
| |
| |
| private void SleepStop(long sender) |
| private void SleepStop(long sender) |
| { |
| { |
| Player localPlayer = Player.m_localPlayer; |
| Player localPlayer = Player.m_localPlayer; |
| if (localPlayer) |
| if (localPlayer) |
| { |
| { |
| localPlayer.SetSleeping(false); |
| localPlayer.SetSleeping(false); |
| localPlayer.AttachStop(); |
| localPlayer.AttachStop(); |
| } |
| } |
| if (this.m_saveTimer > 60f) |
| if (this.m_saveTimer > 60f) |
| { |
| { |
| bool flag; |
| bool flag; |
| if (!ZNet.instance.EnoughDiskSpaceAvailable(out flag, false, null)) |
| if (!ZNet.instance.EnoughDiskSpaceAvailable(out flag, false, null)) |
| { |
| { |
| this.m_saveTimer -= 300f; |
| this.m_saveTimer -= 300f; |
| return; |
| return; |
| } |
| } |
| this.SavePlayerProfile(false); |
| this.SavePlayerProfile(false); |
| if (ZNet.instance) |
| if (ZNet.instance) |
| { |
| { |
| ZNet.instance.Save(false, false); |
| ZNet.instance.Save(false, false); |
| return; |
| return; |
| } |
| } |
| } |
| } |
| else |
| else |
| { |
| { |
| ZLog.Log("Saved recently, skipping sleep save."); |
| ZLog.Log("Saved recently, skipping sleep save."); |
| } |
| } |
| } |
| } |
| |
| |
| public void DiscoverClosestLocation(string name, Vector3 point, string pinName, int pinType, bool showMap = true, bool discoverAll = false) |
| public void DiscoverClosestLocation(string name, Vector3 point, string pinName, int pinType, bool showMap = true, bool discoverAll = false) |
| { |
| { |
| ZLog.Log("DiscoverClosestLocation"); |
| ZLog.Log("DiscoverClosestLocation"); |
| ZRoutedRpc.instance.InvokeRoutedRPC("RPC_DiscoverClosestLocation", new object[] { name, point, pinName, pinType, showMap, discoverAll }); |
| ZRoutedRpc.instance.InvokeRoutedRPC("RPC_DiscoverClosestLocation", new object[] { name, point, pinName, pinType, showMap, discoverAll }); |
| } |
| } |
| |
| |
| private void RPC_DiscoverClosestLocation(long sender, string name, Vector3 point, string pinName, int pinType, bool showMap, bool discoverAll) |
| private void RPC_DiscoverClosestLocation(long sender, string name, Vector3 point, string pinName, int pinType, bool showMap, bool discoverAll) |
| { |
| { |
| if (discoverAll && ZoneSystem.instance.FindLocations(name, ref this.m_tempLocations)) |
| if (discoverAll && ZoneSystem.instance.FindLocations(name, ref this.m_tempLocations)) |
| { |
| { |
| ZLog.Log(string.Format("Found {0} locations of type {1}", this.m_tempLocations.Count, name)); |
| ZLog.Log(string.Format("Found {0} locations of type {1}", this.m_tempLocations.Count, name)); |
| using (List<ZoneSystem.LocationInstance>.Enumerator enumerator = this.m_tempLocations.GetEnumerator()) |
| using (List<ZoneSystem.LocationInstance>.Enumerator enumerator = this.m_tempLocations.GetEnumerator()) |
| { |
| { |
| while (enumerator.MoveNext()) |
| while (enumerator.MoveNext()) |
| { |
| { |
| ZoneSystem.LocationInstance locationInstance = enumerator.Current; |
| ZoneSystem.LocationInstance locationInstance = enumerator.Current; |
| ZRoutedRpc.instance.InvokeRoutedRPC(sender, "RPC_DiscoverLocationResponse", new object[] { pinName, pinType, locationInstance.m_position, showMap }); |
| ZRoutedRpc.instance.InvokeRoutedRPC(sender, "RPC_DiscoverLocationResponse", new object[] { pinName, pinType, locationInstance.m_position, showMap }); |
| } |
| } |
| return; |
| return; |
| } |
| } |
| } |
| } |
| ZoneSystem.LocationInstance locationInstance2; |
| ZoneSystem.LocationInstance locationInstance2; |
| if (!discoverAll && ZoneSystem.instance.FindClosestLocation(name, point, out locationInstance2)) |
| if (!discoverAll && ZoneSystem.instance.FindClosestLocation(name, point, out locationInstance2)) |
| { |
| { |
| ZLog.Log("Found location of type " + name); |
| ZLog.Log("Found location of type " + name); |
| ZRoutedRpc.instance.InvokeRoutedRPC(sender, "RPC_DiscoverLocationResponse", new object[] { pinName, pinType, locationInstance2.m_position, showMap }); |
| ZRoutedRpc.instance.InvokeRoutedRPC(sender, "RPC_DiscoverLocationResponse", new object[] { pinName, pinType, locationInstance2.m_position, showMap }); |
| return; |
| return; |
| } |
| } |
| ZLog.LogWarning("Failed to find location of type " + name); |
| ZLog.LogWarning("Failed to find location of type " + name); |
| } |
| } |
| |
| |
| private void RPC_DiscoverLocationResponse(long sender, string pinName, int pinType, Vector3 pos, bool showMap) |
| private void RPC_DiscoverLocationResponse(long sender, string pinName, int pinType, Vector3 pos, bool showMap) |
| { |
| { |
| Minimap.instance.DiscoverLocation(pos, (Minimap.PinType)pinType, pinName, showMap); |
| Minimap.instance.DiscoverLocation(pos, (Minimap.PinType)pinType, pinName, showMap); |
| if (Player.m_localPlayer && Minimap.instance.m_mode == Minimap.MapMode.None) |
| if (Player.m_localPlayer && Minimap.instance.m_mode == Minimap.MapMode.None) |
| { |
| { |
| Player.m_localPlayer.SetLookDir(pos - Player.m_localPlayer.transform.position, 3.5f); |
| Player.m_localPlayer.SetLookDir(pos - Player.m_localPlayer.transform.position, 3.5f); |
| } |
| } |
| } |
| } |
| |
| |
| public void Ping() |
| public void Ping() |
| { |
| { |
| if (global::Console.instance) |
| if (global::Console.instance) |
| { |
| { |
| global::Console.instance.Print("Ping sent to server"); |
| global::Console.instance.Print("Ping sent to server"); |
| } |
| } |
| ZRoutedRpc.instance.InvokeRoutedRPC("Ping", new object[] { Time.time }); |
| ZRoutedRpc.instance.InvokeRoutedRPC("Ping", new object[] { Time.time }); |
| } |
| } |
| |
| |
| private void RPC_Ping(long sender, float time) |
| private void RPC_Ping(long sender, float time) |
| { |
| { |
| ZRoutedRpc.instance.InvokeRoutedRPC(sender, "Pong", new object[] { time }); |
| ZRoutedRpc.instance.InvokeRoutedRPC(sender, "Pong", new object[] { time }); |
| } |
| } |
| |
| |
| private void RPC_Pong(long sender, float time) |
| private void RPC_Pong(long sender, float time) |
| { |
| { |
| float num = Time.time - time; |
| float num = Time.time - time; |
| string text = "Got ping reply from server: " + ((int)(num * 1000f)).ToString() + " ms"; |
| string text = "Got ping reply from server: " + ((int)(num * 1000f)).ToString() + " ms"; |
| ZLog.Log(text); |
| ZLog.Log(text); |
| if (global::Console.instance) |
| if (global::Console.instance) |
| { |
| { |
| global::Console.instance.Print(text); |
| global::Console.instance.Print(text); |
| } |
| } |
| if (Chat.instance) |
| if (Chat.instance) |
| { |
| { |
| Chat.instance.AddString(text); |
| Chat.instance.AddString(text); |
| } |
| } |
| } |
| } |
| |
| |
| public void SetForcePlayerDifficulty(int players) |
| public void SetForcePlayerDifficulty(int players) |
| { |
| { |
| this.m_forcePlayers = players; |
| this.m_forcePlayers = players; |
| } |
| } |
| |
| |
| public int GetPlayerDifficulty(Vector3 pos) |
| public int GetPlayerDifficulty(Vector3 pos) |
| { |
| { |
| if (this.m_forcePlayers > 0) |
| if (this.m_forcePlayers > 0) |
| { |
| { |
| return this.m_forcePlayers; |
| return this.m_forcePlayers; |
| } |
| } |
| int num = Player.GetPlayersInRangeXZ(pos, this.m_difficultyScaleRange); |
| int num = Player.GetPlayersInRangeXZ(pos, this.m_difficultyScaleRange); |
| if (num < 1) |
| if (num < 1) |
| { |
| { |
| num = 1; |
| num = 1; |
| } |
| } |
| if (num > this.m_difficultyScaleMaxPlayers) |
| if (num > this.m_difficultyScaleMaxPlayers) |
| { |
| { |
| num = this.m_difficultyScaleMaxPlayers; |
| num = this.m_difficultyScaleMaxPlayers; |
| } |
| } |
| return num; |
| return num; |
| } |
| } |
| |
| |
| public float GetDifficultyDamageScalePlayer(Vector3 pos) |
| public float GetDifficultyDamageScalePlayer(Vector3 pos) |
| { |
| { |
| int playerDifficulty = this.GetPlayerDifficulty(pos); |
| int playerDifficulty = this.GetPlayerDifficulty(pos); |
| return 1f + (float)(playerDifficulty - 1) * this.m_damageScalePerPlayer; |
| return 1f + (float)(playerDifficulty - 1) * this.m_damageScalePerPlayer; |
| } |
| } |
| |
| |
| public float GetDifficultyDamageScaleEnemy(Vector3 pos) |
| public float GetDifficultyDamageScaleEnemy(Vector3 pos) |
| { |
| { |
| int playerDifficulty = this.GetPlayerDifficulty(pos); |
| int playerDifficulty = this.GetPlayerDifficulty(pos); |
| float num = 1f + (float)(playerDifficulty - 1) * this.m_healthScalePerPlayer; |
| float num = 1f + (float)(playerDifficulty - 1) * this.m_healthScalePerPlayer; |
| return 1f / num; |
| return 1f / num; |
| } |
| } |
| |
| |
| private static void UpdatePause() |
| private static void UpdatePause() |
| { |
| { |
| if (Game.m_pauseFrom != Game.m_pauseTarget) |
| if (Game.m_pauseFrom != Game.m_pauseTarget) |
| { |
| { |
| if (DateTime.Now >= Game.m_pauseEnd) |
| if (DateTime.Now >= Game.m_pauseEnd) |
| { |
| { |
| Game.m_pauseFrom = Game.m_pauseTarget; |
| Game.m_pauseFrom = Game.m_pauseTarget; |
| Game.m_timeScale = Game.m_pauseTarget; |
| Game.m_timeScale = Game.m_pauseTarget; |
| } |
| } |
| else |
| else |
| { |
| { |
| Game.m_timeScale = Mathf.SmoothStep(Game.m_pauseFrom, Game.m_pauseTarget, (float)((DateTime.Now - Game.m_pauseStart).TotalSeconds / (Game.m_pauseEnd - Game.m_pauseStart).TotalSeconds)); |
| Game.m_timeScale = Mathf.SmoothStep(Game.m_pauseFrom, Game.m_pauseTarget, (float)((DateTime.Now - Game.m_pauseStart).TotalSeconds / (Game.m_pauseEnd - Game.m_pauseStart).TotalSeconds)); |
| } |
| } |
| } |
| } |
| if (Time.timeScale > 0f) |
| if (Time.timeScale > 0f) |
| { |
| { |
| Game.m_pauseRotateFade = 0f; |
| Game.m_pauseRotateFade = 0f; |
| } |
| } |
| Time.timeScale = (Game.IsPaused() ? 0f : ((ZNet.instance.GetPeerConnections() > 0) ? 1f : Game.m_timeScale)); |
| Time.timeScale = (Game.IsPaused() ? 0f : ((ZNet.instance.GetPeerConnections() > 0) ? 1f : Game.m_timeScale)); |
| if (Game.IsPaused()) |
| if (Game.IsPaused()) |
| { |
| { |
| Game.m_pauseTimer += Time.fixedUnscaledDeltaTime; |
| Game.m_pauseTimer += Time.fixedUnscaledDeltaTime; |
| } |
| } |
| else if (Game.m_pauseTimer > 0f) |
| else if (Game.m_pauseTimer > 0f) |
| { |
| { |
| Game.m_pauseTimer = 0f; |
| Game.m_pauseTimer = 0f; |
| } |
| } |
| if (Game.IsPaused() && Menu.IsVisible() && Player.m_localPlayer) |
| if (Game.IsPaused() && Menu.IsVisible() && Player.m_localPlayer) |
| { |
| { |
| if (Game.m_pauseRotateFade < 1f) |
| if (Game.m_pauseRotateFade < 1f) |
| { |
| { |
| Mathf.Min(1f, Game.m_pauseRotateFade += 0.05f * Time.unscaledDeltaTime); |
| Mathf.Min(1f, Game.m_pauseRotateFade += 0.05f * Time.unscaledDeltaTime); |
| } |
| } |
| Transform eye = Player.m_localPlayer.m_eye; |
| Transform eye = Player.m_localPlayer.m_eye; |
| Vector3 forward = Player.m_localPlayer.m_eye.forward; |
| Vector3 forward = Player.m_localPlayer.m_eye.forward; |
| float num = Vector3.Dot(forward, Vector3.up); |
| float num = Vector3.Dot(forward, Vector3.up); |
| float num2 = Vector3.Dot(forward, Vector3.down); |
| float num2 = Vector3.Dot(forward, Vector3.down); |
| float num3 = Mathf.Max(0.05f, 1f - ((num > num2) ? num : num2)); |
| float num3 = Mathf.Max(0.05f, 1f - ((num > num2) ? num : num2)); |
| eye.Rotate(Vector3.up, Time.unscaledDeltaTime * Mathf.Cos(Time.realtimeSinceStartup * 0.3f) * 5f * Game.m_pauseRotateFade * num3); |
| eye.Rotate(Vector3.up, Time.unscaledDeltaTime * Mathf.Cos(Time.realtimeSinceStartup * 0.3f) * 5f * Game.m_pauseRotateFade * num3); |
| Player.m_localPlayer.SetLookDir(eye.forward, 0f); |
| Player.m_localPlayer.SetLookDir(eye.forward, 0f); |
| Game.m_collectTimer += Time.fixedUnscaledDeltaTime; |
| Game.m_collectTimer += Time.fixedUnscaledDeltaTime; |
| if (Game.m_collectTimer > 5f && DateTime.Now > ZInput.instance.GetLastInputTimer() + TimeSpan.FromSeconds(5.0)) |
| if (Game.m_collectTimer > 5f && DateTime.Now > ZInput.instance.GetLastInputTimer() + TimeSpan.FromSeconds(5.0)) |
| { |
| { |
| Game.instance.CollectResourcesCheck(); |
| Game.instance.CollectResourcesCheck(); |
| Game.m_collectTimer = -1000f; |
| Game.m_collectTimer = -1000f; |
| return; |
| return; |
| } |
| } |
| } |
| } |
| else if (Game.m_collectTimer != 0f) |
| else if (Game.m_collectTimer != 0f) |
| { |
| { |
| Game.m_collectTimer = 0f; |
| Game.m_collectTimer = 0f; |
| } |
| } |
| } |
| } |
| |
| |
| public static bool IsPaused() |
| public static bool IsPaused() |
| { |
| { |
| return Game.m_pause && Game.CanPause(); |
| return Game.m_pause && Game.CanPause(); |
| } |
| } |
| |
| |
| public static void Pause() |
| public static void Pause() |
| { |
| { |
| Game.m_pause = true; |
| Game.m_pause = true; |
| } |
| } |
| |
| |
| public static void Unpause() |
| public static void Unpause() |
| { |
| { |
| Game.m_pause = false; |
| Game.m_pause = false; |
| Game.m_timeScale = 1f; |
| Game.m_timeScale = 1f; |
| } |
| } |
| |
| |
| public static void PauseToggle() |
| public static void PauseToggle() |
| { |
| { |
| if (Game.IsPaused()) |
| if (Game.IsPaused()) |
| { |
| { |
| Game.Unpause(); |
| Game.Unpause(); |
| return; |
| return; |
| } |
| } |
| Game.Pause(); |
| Game.Pause(); |
| } |
| } |
| |
| |
| private static bool CanPause() |
| private static bool CanPause() |
| { |
| { |
| return (!ZNet.instance.IsServer() || ZNet.instance.GetPeerConnections() <= 0) && Player.m_localPlayer && ZNet.instance && ((Player.m_debugMode && !ZNet.instance.IsServer() && global::Console.instance && global::Console.instance.IsCheatsEnabled()) || (ZNet.instance.IsServer() && ZNet.instance.GetPeerConnections() == 0)); |
| return (!ZNet.instance.IsServer() || ZNet.instance.GetPeerConnections() <= 0) && Player.m_localPlayer && ZNet.instance && ((Player.m_debugMode && !ZNet.instance.IsServer() && global::Console.instance && global::Console.instance.IsCheatsEnabled()) || (ZNet.instance.IsServer() && ZNet.instance.GetPeerConnections() == 0)); |
| } |
| } |
| |
| |
| public static void FadeTimeScale(float timeScale = 0f, float transitionSec = 0f) |
| public static void FadeTimeScale(float timeScale = 0f, float transitionSec = 0f) |
| { |
| { |
| if (timeScale != 1f && !Game.CanPause()) |
| if (timeScale != 1f && !Game.CanPause()) |
| { |
| { |
| return; |
| return; |
| } |
| } |
| timeScale = Mathf.Clamp(timeScale, 0f, 100f); |
| timeScale = Mathf.Clamp(timeScale, 0f, 100f); |
| if (transitionSec == 0f) |
| if (transitionSec == 0f) |
| { |
| { |
| Game.m_timeScale = timeScale; |
| Game.m_timeScale = timeScale; |
| return; |
| return; |
| } |
| } |
| Game.m_pauseFrom = Time.timeScale; |
| Game.m_pauseFrom = Time.timeScale; |
| Game.m_pauseTarget = timeScale; |
| Game.m_pauseTarget = timeScale; |
| Game.m_pauseStart = DateTime.Now; |
| Game.m_pauseStart = DateTime.Now; |
| Game.m_pauseEnd = DateTime.Now + TimeSpan.FromSeconds((double)transitionSec); |
| Game.m_pauseEnd = DateTime.Now + TimeSpan.FromSeconds((double)transitionSec); |
| } |
| } |
| |
| |
| public int ScaleDrops(GameObject drop, int amount) |
| public int ScaleDrops(GameObject drop, int amount) |
| { |
| { |
| if (Game.m_resourceRate != 1f) |
| if (Game.m_resourceRate != 1f) |
| { |
| { |
| ItemDrop component = drop.GetComponent<ItemDrop>(); |
| ItemDrop component = drop.GetComponent<ItemDrop>(); |
| if (component != null) |
| if (component != null) |
| { |
| { |
| return this.ScaleDrops(component.m_itemData, amount); |
| return this.ScaleDrops(component.m_itemData, amount); |
| } |
| } |
| } |
| } |
| return amount; |
| return amount; |
| } |
| } |
| |
| |
| public int ScaleDrops(ItemDrop.ItemData data, int amount) |
| public int ScaleDrops(ItemDrop.ItemData data, int amount) |
| { |
| { |
| if (Game.m_resourceRate != 1f && !this.m_nonScaledDropTypes.Contains(data.m_shared.m_itemType)) |
| if (Game.m_resourceRate != 1f && !this.m_nonScaledDropTypes.Contains(data.m_shared.m_itemType)) |
| { |
| { |
| amount = (int)Mathf.Clamp(Mathf.Round((float)amount * Game.m_resourceRate), 1f, (float)((data.m_shared.m_maxStackSize > 1) ? data.m_shared.m_maxStackSize : 1000)); |
| amount = (int)Mathf.Clamp(Mathf.Round((float)amount * Game.m_resourceRate), 1f, (float)((data.m_shared.m_maxStackSize > 1) ? data.m_shared.m_maxStackSize : 1000)); |
| } |
| } |
| return amount; |
| return amount; |
| } |
| } |
| |
| |
| public int ScaleDrops(GameObject drop, int randomMin, int randomMax) |
| public int ScaleDrops(GameObject drop, int randomMin, int randomMax) |
| { |
| { |
| if (Game.m_resourceRate != 1f) |
| if (Game.m_resourceRate != 1f) |
| { |
| { |
| ItemDrop component = drop.GetComponent<ItemDrop>(); |
| ItemDrop component = drop.GetComponent<ItemDrop>(); |
| if (component != null) |
| if (component != null) |
| { |
| { |
| return this.ScaleDrops(component.m_itemData, randomMin, randomMax); |
| return this.ScaleDrops(component.m_itemData, randomMin, randomMax); |
| } |
| } |
| } |
| } |
| return UnityEngine.Random.Range(randomMin, randomMax); |
| return UnityEngine.Random.Range(randomMin, randomMax); |
| } |
| } |
| |
| |
| public int ScaleDrops(ItemDrop.ItemData data, int randomMin, int randomMax) |
| public int ScaleDrops(ItemDrop.ItemData data, int randomMin, int randomMax) |
| { |
| { |
| if (Game.m_resourceRate != 1f && !this.m_nonScaledDropTypes.Contains(data.m_shared.m_itemType)) |
| if (Game.m_resourceRate != 1f && !this.m_nonScaledDropTypes.Contains(data.m_shared.m_itemType)) |
| { |
| { |
| return Mathf.Min(this.ScaleDrops(randomMin, randomMax), (data.m_shared.m_maxStackSize > 1) ? data.m_shared.m_maxStackSize : 10000); |
| return Mathf.Min(this.ScaleDrops(randomMin, randomMax), (data.m_shared.m_maxStackSize > 1) ? data.m_shared.m_maxStackSize : 10000); |
| } |
| } |
| return UnityEngine.Random.Range(randomMin, randomMax); |
| return UnityEngine.Random.Range(randomMin, randomMax); |
| } |
| } |
| |
| |
| public int ScaleDrops(int randomMin, int randomMax) |
| public int ScaleDrops(int randomMin, int randomMax) |
| { |
| { |
| return (int)Mathf.Max(1f, Mathf.Round(UnityEngine.Random.Range((float)randomMin, (float)randomMax) * Game.m_resourceRate)); |
| return (int)Mathf.Max(1f, Mathf.Round(UnityEngine.Random.Range((float)randomMin, (float)randomMax) * Game.m_resourceRate)); |
| } |
| } |
| |
| |
| public int ScaleDropsInverse(GameObject drop, int randomMin, int randomMax) |
| public int ScaleDropsInverse(GameObject drop, int randomMin, int randomMax) |
| { |
| { |
| if (Game.m_resourceRate != 1f) |
| if (Game.m_resourceRate != 1f) |
| { |
| { |
| ItemDrop component = drop.GetComponent<ItemDrop>(); |
| ItemDrop component = drop.GetComponent<ItemDrop>(); |
| if (component != null) |
| if (component != null) |
| { |
| { |
| return this.ScaleDropsInverse(component.m_itemData, randomMin, randomMax); |
| return this.ScaleDropsInverse(component.m_itemData, randomMin, randomMax); |
| } |
| } |
| } |
| } |
| return UnityEngine.Random.Range(randomMin, randomMax); |
| return UnityEngine.Random.Range(randomMin, randomMax); |
| } |
| } |
| |
| |
| public int ScaleDropsInverse(ItemDrop.ItemData data, int randomMin, int randomMax) |
| public int ScaleDropsInverse(ItemDrop.ItemData data, int randomMin, int randomMax) |
| { |
| { |
| if (Game.m_resourceRate != 1f && !this.m_nonScaledDropTypes.Contains(data.m_shared.m_itemType)) |
| if (Game.m_resourceRate != 1f && !this.m_nonScaledDropTypes.Contains(data.m_shared.m_itemType)) |
| { |
| { |
| return this.ScaleDropsInverse(randomMin, Mathf.Min(randomMax, (data.m_shared.m_maxStackSize > 1) ? data.m_shared.m_maxStackSize : 1000)); |
| return this.ScaleDropsInverse(randomMin, Mathf.Min(randomMax, (data.m_shared.m_maxStackSize > 1) ? data.m_shared.m_maxStackSize : 1000)); |
| } |
| } |
| return UnityEngine.Random.Range(randomMin, randomMax); |
| return UnityEngine.Random.Range(randomMin, randomMax); |
| } |
| } |
| |
| |
| public int ScaleDropsInverse(int randomMin, int randomMax) |
| public int ScaleDropsInverse(int randomMin, int randomMax) |
| { |
| { |
| return (int)Mathf.Max(1f, Mathf.Round(UnityEngine.Random.Range((float)randomMin, (float)randomMax) / Game.m_resourceRate)); |
| return (int)Mathf.Max(1f, Mathf.Round(UnityEngine.Random.Range((float)randomMin, (float)randomMax) / Game.m_resourceRate)); |
| } |
| } |
| |
| |
| public static void UpdateWorldRates(HashSet<string> globalKeys, Dictionary<string, string> globalKeysValues) |
| public static void UpdateWorldRates(HashSet<string> globalKeys, Dictionary<string, string> globalKeysValues) |
| { |
| { |
| . | Game.<>c__DisplayClass69_0 CS$<>8__locals1; |
| Game.<>c__DisplayClass74_0 CS$<>8__locals1; |
| CS$<>8__locals1.globalKeysValues = globalKeysValues; |
| CS$<>8__locals1.globalKeysValues = globalKeysValues; |
| CS$<>8__locals1.playerKeys = (Player.m_localPlayer ? Player.m_localPlayer.GetUniqueKeys() : null); |
| CS$<>8__locals1.playerKeys = (Player.m_localPlayer ? Player.m_localPlayer.GetUniqueKeys() : null); |
| . | Game.<UpdateWorldRates>g__trySetScalarKey|69_0(GlobalKeys.PlayerDamage, out Game.m_playerDamageRate, 1f, 100f, ref CS$<>8__locals1); |
| Game.<UpdateWorldRates>g__trySetScalarKey|74_0(GlobalKeys.PlayerDamage, out Game.m_playerDamageRate, 1f, 100f, ref CS$<>8__locals1); |
| Game.<UpdateWorldRates>g__trySetScalarKey|69_0(GlobalKeys.EnemyDamage, out Game.m_enemyDamageRate, 1f, 100f, ref CS$<>8__locals1); |
| Game.<UpdateWorldRates>g__trySetScalarKey|74_0(GlobalKeys.EnemyDamage, out Game.m_enemyDamageRate, 1f, 100f, ref CS$<>8__locals1); |
| Game.<UpdateWorldRates>g__trySetScalarKey|69_0(GlobalKeys.ResourceRate, out Game.m_resourceRate, 1f, 100f, ref CS$<>8__locals1); |
| Game.<UpdateWorldRates>g__trySetScalarKey|74_0(GlobalKeys.ResourceRate, out Game.m_resourceRate, 1f, 100f, ref CS$<>8__locals1); |
| Game.<UpdateWorldRates>g__trySetScalarKey|69_0(GlobalKeys.StaminaRate, out Game.m_staminaRate, 1f, 100f, ref CS$<>8__locals1); |
| Game.<UpdateWorldRates>g__trySetScalarKey|74_0(GlobalKeys.StaminaRate, out Game.m_staminaRate, 1f, 100f, ref CS$<>8__locals1); |
| Game.<UpdateWorldRates>g__trySetScalarKey|69_0(GlobalKeys.MoveStaminaRate, out Game.m_moveStaminaRate, 1f, 100f, ref CS$<>8__locals1); |
| Game.<UpdateWorldRates>g__trySetScalarKey|74_0(GlobalKeys.MoveStaminaRate, out Game.m_moveStaminaRate, 1f, 100f, ref CS$<>8__locals1); |
| Game.<UpdateWorldRates>g__trySetScalarKey|69_0(GlobalKeys.StaminaRegenRate, out Game.m_staminaRegenRate, 1f, 100f, ref CS$<>8__locals1); |
| Game.<UpdateWorldRates>g__trySetScalarKey|74_0(GlobalKeys.StaminaRegenRate, out Game.m_staminaRegenRate, 1f, 100f, ref CS$<>8__locals1); |
| Game.<UpdateWorldRates>g__trySetScalarKey|69_0(GlobalKeys.SkillGainRate, out Game.m_skillGainRate, 1f, 100f, ref CS$<>8__locals1); |
| Game.<UpdateWorldRates>g__trySetScalarKey|74_0(GlobalKeys.SkillGainRate, out Game.m_skillGainRate, 1f, 100f, ref CS$<>8__locals1); |
| Game.<UpdateWorldRates>g__trySetScalarKey|69_0(GlobalKeys.SkillReductionRate, out Game.m_skillReductionRate, 1f, 100f, ref CS$<>8__locals1); |
| Game.<UpdateWorldRates>g__trySetScalarKey|74_0(GlobalKeys.SkillReductionRate, out Game.m_skillReductionRate, 1f, 100f, ref CS$<>8__locals1); |
| Game.<UpdateWorldRates>g__trySetScalarKey|69_0(GlobalKeys.EnemySpeedSize, out Game.m_enemySpeedSize, 1f, 100f, ref CS$<>8__locals1); |
| Game.<UpdateWorldRates>g__trySetScalarKey|74_0(GlobalKeys.EnemySpeedSize, out Game.m_enemySpeedSize, 1f, 100f, ref CS$<>8__locals1); |
| Game.<UpdateWorldRates>g__trySetScalarKey|69_0(GlobalKeys.EnemyLevelUpRate, out Game.m_enemyLevelUpRate, 1f, 100f, ref CS$<>8__locals1); |
| Game.<UpdateWorldRates>g__trySetScalarKey|74_0(GlobalKeys.EnemyLevelUpRate, out Game.m_enemyLevelUpRate, 1f, 100f, ref CS$<>8__locals1); |
| Game.<UpdateWorldRates>g__trySetIntKey|69_1(GlobalKeys.WorldLevel, out Game.m_worldLevel, 0, ref CS$<>8__locals1); |
| Game.<UpdateWorldRates>g__trySetIntKey|74_1(GlobalKeys.WorldLevel, out Game.m_worldLevel, 0, ref CS$<>8__locals1); |
| Game.<UpdateWorldRates>g__trySetScalarKey|69_0(GlobalKeys.EventRate, out Game.m_eventRate, 1f, 100f, ref CS$<>8__locals1); |
| Game.<UpdateWorldRates>g__trySetScalarKey|74_0(GlobalKeys.EventRate, out Game.m_eventRate, 1f, 100f, ref CS$<>8__locals1); |
| Game.<UpdateWorldRates>g__trySetScalarKeyPlayer|69_2(PlayerKeys.DamageTaken, out Game.m_localDamgeTakenRate, 1f, 100f, ref CS$<>8__locals1); |
| Game.<UpdateWorldRates>g__trySetScalarKeyPlayer|74_2(PlayerKeys.DamageTaken, out Game.m_localDamgeTakenRate, 1f, 100f, ref CS$<>8__locals1); |
| Game.m_worldLevel = Mathf.Clamp(Game.m_worldLevel, 0, 10); |
| Game.m_worldLevel = Mathf.Clamp(Game.m_worldLevel, 0, 10); |
| Game.UpdateNoMap(); |
| Game.UpdateNoMap(); |
| Game.m_serverOptionsSummary = ServerOptionsGUI.GetWorldModifierSummary(globalKeys, false, ", "); |
| Game.m_serverOptionsSummary = ServerOptionsGUI.GetWorldModifierSummary(globalKeys, false, ", "); |
| PlayerProfile playerProfile = Game.instance.GetPlayerProfile(); |
| PlayerProfile playerProfile = Game.instance.GetPlayerProfile(); |
| for (int i = 0; i < globalKeys.Count; i++) |
| for (int i = 0; i < globalKeys.Count; i++) |
| { |
| { |
| GlobalKeys globalKeys2 = (GlobalKeys)i; |
| GlobalKeys globalKeys2 = (GlobalKeys)i; |
| if (!ZoneSystem.instance.GetGlobalKey(globalKeys2)) |
| if (!ZoneSystem.instance.GetGlobalKey(globalKeys2)) |
| { |
| { |
| playerProfile.m_knownWorldKeys.IncrementOrSet(string.Format("{0} {1}", globalKeys2, "default"), 1f); |
| playerProfile.m_knownWorldKeys.IncrementOrSet(string.Format("{0} {1}", globalKeys2, "default"), 1f); |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| |
| public static void UpdateNoMap() |
| public static void UpdateNoMap() |
| { |
| { |
| Game.m_noMap = (ZoneSystem.instance && ZoneSystem.instance.GetGlobalKey(GlobalKeys.NoMap)) || (Player.m_localPlayer != null && PlayerPrefs.GetFloat("mapenabled_" + Player.m_localPlayer.GetPlayerName(), 1f) == 0f); |
| Game.m_noMap = (ZoneSystem.instance && ZoneSystem.instance.GetGlobalKey(GlobalKeys.NoMap)) || (Player.m_localPlayer != null && PlayerPrefs.GetFloat("mapenabled_" + Player.m_localPlayer.GetPlayerName(), 1f) == 0f); |
| Minimap.instance.SetMapMode(Game.m_noMap ? Minimap.MapMode.None : Minimap.MapMode.Small); |
| Minimap.instance.SetMapMode(Game.m_noMap ? Minimap.MapMode.None : Minimap.MapMode.Small); |
| } |
| } |
| |
| |
| . | |
| public GameObject CheckDropConversion(HitData hitData, ItemDrop itemDrop, GameObject dropPrefab, ref int dropCount) |
| |
| { |
| |
| if (hitData == null) |
| |
| { |
| |
| return dropPrefab; |
| |
| } |
| |
| HitData.DamageType majorityDamageType = hitData.m_damage.GetMajorityDamageType(); |
| |
| HitData.HitType hitType = hitData.m_hitType; |
| |
| bool flag = majorityDamageType == HitData.DamageType.Fire && ZoneSystem.instance.GetGlobalKey(GlobalKeys.Fire); |
| |
| foreach (Game.ItemConversion itemConversion in this.m_damageTypeDropConversions) |
| |
| { |
| |
| if ((itemConversion.m_hitType == HitData.HitType.Undefined || itemConversion.m_hitType == hitType || flag) && itemConversion.m_damageType == majorityDamageType) |
| |
| { |
| |
| using (List<ItemDrop>.Enumerator enumerator2 = itemConversion.m_items.GetEnumerator()) |
| |
| { |
| |
| while (enumerator2.MoveNext()) |
| |
| { |
| |
| if (!(enumerator2.Current.m_itemData.m_shared.m_name != itemDrop.m_itemData.m_shared.m_name)) |
| |
| { |
| |
| dropCount *= itemConversion.m_multiplier; |
| |
| return itemConversion.m_result.gameObject; |
| |
| } |
| |
| } |
| |
| } |
| |
| } |
| |
| } |
| |
| return dropPrefab; |
| |
| } |
| |
| |
| public List<int> PortalPrefabHash { get; private set; } = new List<int>(); |
| public List<int> PortalPrefabHash { get; private set; } = new List<int>(); |
| |
| |
| [CompilerGenerated] |
| [CompilerGenerated] |
| . | internal static void <UpdateWorldRates>g__trySetScalarKey|69_0(GlobalKeys key, out float value, float defaultValue = 1f, float multiplier = 100f, ref Game.<>c__DisplayClass69_0 A_4) |
| internal static void <UpdateWorldRates>g__trySetScalarKey|74_0(GlobalKeys key, out float value, float defaultValue = 1f, float multiplier = 100f, ref Game.<>c__DisplayClass74_0 A_4) |
| { |
| { |
| value = defaultValue; |
| value = defaultValue; |
| string text; |
| string text; |
| float num; |
| float num; |
| if (A_4.globalKeysValues.TryGetValue(key.ToString().ToLower(), out text) && float.TryParse(text, NumberStyles.Any, CultureInfo.InvariantCulture, out num)) |
| if (A_4.globalKeysValues.TryGetValue(key.ToString().ToLower(), out text) && float.TryParse(text, NumberStyles.Any, CultureInfo.InvariantCulture, out num)) |
| { |
| { |
| value = num / multiplier; |
| value = num / multiplier; |
| } |
| } |
| } |
| } |
| |
| |
| [CompilerGenerated] |
| [CompilerGenerated] |
| . | internal static void <UpdateWorldRates>g__trySetIntKey|69_1(GlobalKeys key, out int value, int defaultValue = 1, ref Game.<>c__DisplayClass69_0 A_3) |
| internal static void <UpdateWorldRates>g__trySetIntKey|74_1(GlobalKeys key, out int value, int defaultValue = 1, ref Game.<>c__DisplayClass74_0 A_3) |
| { |
| { |
| value = defaultValue; |
| value = defaultValue; |
| string text; |
| string text; |
| int num; |
| int num; |
| if (A_3.globalKeysValues.TryGetValue(key.ToString().ToLower(), out text) && int.TryParse(text, NumberStyles.Any, CultureInfo.InvariantCulture, out num)) |
| if (A_3.globalKeysValues.TryGetValue(key.ToString().ToLower(), out text) && int.TryParse(text, NumberStyles.Any, CultureInfo.InvariantCulture, out num)) |
| { |
| { |
| value = num; |
| value = num; |
| } |
| } |
| } |
| } |
| |
| |
| [CompilerGenerated] |
| [CompilerGenerated] |
| . | internal static void <UpdateWorldRates>g__trySetScalarKeyPlayer|69_2(PlayerKeys key, out float value, float defaultValue = 1f, float multiplier = 100f, ref Game.<>c__DisplayClass69_0 A_4) |
| internal static void <UpdateWorldRates>g__trySetScalarKeyPlayer|74_2(PlayerKeys key, out float value, float defaultValue = 1f, float multiplier = 100f, ref Game.<>c__DisplayClass74_0 A_4) |
| { |
| { |
| if (A_4.playerKeys == null) |
| if (A_4.playerKeys == null) |
| { |
| { |
| value = defaultValue; |
| value = defaultValue; |
| return; |
| return; |
| } |
| } |
| value = defaultValue; |
| value = defaultValue; |
| foreach (string text in A_4.playerKeys) |
| foreach (string text in A_4.playerKeys) |
| { |
| { |
| string[] array = text.Split(' ', StringSplitOptions.None); |
| string[] array = text.Split(' ', StringSplitOptions.None); |
| float num; |
| float num; |
| if (array.Length >= 2 && array[0].ToLower() == key.ToString().ToLower() && float.TryParse(array[1], NumberStyles.Any, CultureInfo.InvariantCulture, out num)) |
| if (array.Length >= 2 && array[0].ToLower() == key.ToString().ToLower() && float.TryParse(array[1], NumberStyles.Any, CultureInfo.InvariantCulture, out num)) |
| { |
| { |
| value = num / multiplier; |
| value = num / multiplier; |
| break; |
| break; |
| } |
| } |
| } |
| } |
| } |
| } |
| |
| |
| public static readonly string messageForModders = "While we don't officially support mods in Valheim at this time. We ask that you please set the following isModded value to true in your mod. This will place a small text in the menu to inform the player that their game is modded and help us solving support issues. Thank you for your help!"; |
| public static readonly string messageForModders = "While we don't officially support mods in Valheim at this time. We ask that you please set the following isModded value to true in your mod. This will place a small text in the menu to inform the player that their game is modded and help us solving support issues. Thank you for your help!"; |
| |
| |
| public static bool isModded = false; |
| public static bool isModded = false; |
| |
| |
| public const int m_backgroundFPS = 30; |
| public const int m_backgroundFPS = 30; |
| |
| |
| public const int m_menuFPS = 60; |
| public const int m_menuFPS = 60; |
| |
| |
| public const int m_minimumFPSLimit = 30; |
| public const int m_minimumFPSLimit = 30; |
| |
| |
| public const int m_maximumFPSLimit = 360; |
| public const int m_maximumFPSLimit = 360; |
| |
| |
| public GameObject m_playerPrefab; |
| public GameObject m_playerPrefab; |
| |
| |
| public List<GameObject> m_portalPrefabs; |
| public List<GameObject> m_portalPrefabs; |
| |
| |
| public GameObject m_consolePrefab; |
| public GameObject m_consolePrefab; |
| |
| |
| public GameObject m_serverOptionPrefab; |
| public GameObject m_serverOptionPrefab; |
| |
| |
| public SceneReference m_startScene; |
| public SceneReference m_startScene; |
| |
| |
| [Header("Player Startup")] |
| [Header("Player Startup")] |
| public string m_devWorldName = "DevWorld"; |
| public string m_devWorldName = "DevWorld"; |
| |
| |
| public string m_devWorldSeed = ""; |
| public string m_devWorldSeed = ""; |
| |
| |
| public string m_devProfileName = "Developer"; |
| public string m_devProfileName = "Developer"; |
| |
| |
| public string m_devPlayerName = "Odev"; |
| public string m_devPlayerName = "Odev"; |
| |
| |
| public string m_StartLocation = "StartTemple"; |
| public string m_StartLocation = "StartTemple"; |
| |
| |
| private static DateTime m_pauseStart; |
| private static DateTime m_pauseStart; |
| |
| |
| private static DateTime m_pauseEnd; |
| private static DateTime m_pauseEnd; |
| |
| |
| private static float m_pauseFrom; |
| private static float m_pauseFrom; |
| |
| |
| private static float m_pauseTarget; |
| private static float m_pauseTarget; |
| |
| |
| private static float m_timeScale = 1f; |
| private static float m_timeScale = 1f; |
| |
| |
| private static float m_pauseRotateFade; |
| private static float m_pauseRotateFade; |
| |
| |
| private static float m_pauseTimer; |
| private static float m_pauseTimer; |
| |
| |
| private static float m_collectTimer; |
| private static float m_collectTimer; |
| |
| |
| private static bool m_pause; |
| private static bool m_pause; |
| |
| |
| private static string m_profileFilename = null; |
| private static string m_profileFilename = null; |
| |
| |
| private static FileHelpers.FileSource m_profileFileSource = FileHelpers.FileSource.Local; |
| private static FileHelpers.FileSource m_profileFileSource = FileHelpers.FileSource.Local; |
| |
| |
| private PlayerProfile m_playerProfile; |
| private PlayerProfile m_playerProfile; |
| |
| |
| private bool m_requestRespawn; |
| private bool m_requestRespawn; |
| |
| |
| private bool m_respawnAfterDeath; |
| private bool m_respawnAfterDeath; |
| |
| |
| private float m_respawnWait; |
| private float m_respawnWait; |
| |
| |
| . | private const float m_respawnLoadDuration = 8f; |
| public float m_respawnLoadDuration = 8f; |
| |
| |
| |
| public float m_fadeTimeDeath = 9.5f; |
| |
| |
| |
| public float m_fadeTimeSleep = 3f; |
| |
| |
| private bool m_haveSpawned; |
| private bool m_haveSpawned; |
| |
| |
| private bool m_firstSpawn = true; |
| private bool m_firstSpawn = true; |
| |
| |
| private bool m_shuttingDown; |
| private bool m_shuttingDown; |
| |
| |
| private Vector3 m_randomStartPoint = Vector3.zero; |
| private Vector3 m_randomStartPoint = Vector3.zero; |
| |
| |
| private UnityEngine.Random.State m_spawnRandomState; |
| private UnityEngine.Random.State m_spawnRandomState; |
| |
| |
| private List<ZoneSystem.LocationInstance> m_tempLocations = new List<ZoneSystem.LocationInstance>(); |
| private List<ZoneSystem.LocationInstance> m_tempLocations = new List<ZoneSystem.LocationInstance>(); |
| |
| |
| private double m_lastSleepTime; |
| private double m_lastSleepTime; |
| |
| |
| private bool m_sleeping; |
| private bool m_sleeping; |
| |
| |
| . | |
| private List<Game.ConnectingPortals> m_currentlyConnectingPortals = new List<Game.ConnectingPortals>(); |
| |
| |
| private const float m_collectResourcesInterval = 1200f; |
| private const float m_collectResourcesInterval = 1200f; |
| |
| |
| private const float m_collectResourcesIntervalPeriodic = 3600f; |
| private const float m_collectResourcesIntervalPeriodic = 3600f; |
| |
| |
| private DateTime m_lastCollectResources = DateTime.Now; |
| private DateTime m_lastCollectResources = DateTime.Now; |
| |
| |
| [NonSerialized] |
| [NonSerialized] |
| public float m_saveTimer; |
| public float m_saveTimer; |
| |
| |
| public static float m_saveInterval = 1800f; |
| public static float m_saveInterval = 1800f; |
| |
| |
| private const float m_preSaveWarning = 30f; |
| private const float m_preSaveWarning = 30f; |
| |
| |
| [Header("Diffuculty scaling")] |
| [Header("Diffuculty scaling")] |
| public float m_difficultyScaleRange = 100f; |
| public float m_difficultyScaleRange = 100f; |
| |
| |
| public int m_difficultyScaleMaxPlayers = 5; |
| public int m_difficultyScaleMaxPlayers = 5; |
| |
| |
| public float m_damageScalePerPlayer = 0.04f; |
| public float m_damageScalePerPlayer = 0.04f; |
| |
| |
| public float m_healthScalePerPlayer = 0.3f; |
| public float m_healthScalePerPlayer = 0.3f; |
| |
| |
| private int m_forcePlayers; |
| private int m_forcePlayers; |
| |
| |
| . | |
| [Header("Misc")] |
| |
| public float m_ashDamage = 5f; |
| |
| |
| |
| public List<Game.ItemConversion> m_damageTypeDropConversions = new List<Game.ItemConversion>(); |
| |
| |
| [Header("World Level Rates")] |
| [Header("World Level Rates")] |
| public List<ItemDrop.ItemData.ItemType> m_nonScaledDropTypes = new List<ItemDrop.ItemData.ItemType>(); |
| public List<ItemDrop.ItemData.ItemType> m_nonScaledDropTypes = new List<ItemDrop.ItemData.ItemType>(); |
| |
| |
| public int m_worldLevelEnemyBaseAC = 100; |
| public int m_worldLevelEnemyBaseAC = 100; |
| |
| |
| public float m_worldLevelEnemyHPMultiplier = 2f; |
| public float m_worldLevelEnemyHPMultiplier = 2f; |
| |
| |
| public int m_worldLevelEnemyBaseDamage = 85; |
| public int m_worldLevelEnemyBaseDamage = 85; |
| |
| |
| public int m_worldLevelGearBaseAC = 38; |
| public int m_worldLevelGearBaseAC = 38; |
| |
| |
| public int m_worldLevelGearBaseDamage = 120; |
| public int m_worldLevelGearBaseDamage = 120; |
| |
| |
| public float m_worldLevelEnemyLevelUpExponent = 1.15f; |
| public float m_worldLevelEnemyLevelUpExponent = 1.15f; |
| |
| |
| public float m_worldLevelEnemyMoveSpeedMultiplier = 0.2f; |
| public float m_worldLevelEnemyMoveSpeedMultiplier = 0.2f; |
| |
| |
| public int m_worldLevelPieceBaseDamage = 100; |
| public int m_worldLevelPieceBaseDamage = 100; |
| |
| |
| public float m_worldLevelPieceHPMultiplier = 1f; |
| public float m_worldLevelPieceHPMultiplier = 1f; |
| |
| |
| public float m_worldLevelMineHPMultiplier = 2f; |
| public float m_worldLevelMineHPMultiplier = 2f; |
| |
| |
| public static float m_playerDamageRate = 1f; |
| public static float m_playerDamageRate = 1f; |
| |
| |
| public static float m_enemyDamageRate = 1f; |
| public static float m_enemyDamageRate = 1f; |
| |
| |
| public static float m_enemyLevelUpRate = 1f; |
| public static float m_enemyLevelUpRate = 1f; |
| |
| |
| public static float m_localDamgeTakenRate = 1f; |
| public static float m_localDamgeTakenRate = 1f; |
| |
| |
| public static float m_resourceRate = 1f; |
| public static float m_resourceRate = 1f; |
| |
| |
| public static float m_eventRate = 1f; |
| public static float m_eventRate = 1f; |
| |
| |
| public static float m_staminaRate = 1f; |
| public static float m_staminaRate = 1f; |
| |
| |
| public static float m_moveStaminaRate = 1f; |
| public static float m_moveStaminaRate = 1f; |
| |
| |
| public static float m_staminaRegenRate = 1f; |
| public static float m_staminaRegenRate = 1f; |
| |
| |
| public static float m_skillGainRate = 1f; |
| public static float m_skillGainRate = 1f; |
| |
| |
| public static float m_skillReductionRate = 1f; |
| public static float m_skillReductionRate = 1f; |
| |
| |
| public static float m_enemySpeedSize = 1f; |
| public static float m_enemySpeedSize = 1f; |
| |
| |
| public static int m_worldLevel = 0; |
| public static int m_worldLevel = 0; |
| |
| |
| public static string m_serverOptionsSummary = ""; |
| public static string m_serverOptionsSummary = ""; |
| |
| |
| public static bool m_noMap = false; |
| public static bool m_noMap = false; |
| |
| |
| public const string m_keyDefaultString = "default"; |
| public const string m_keyDefaultString = "default"; |
| . | |
| |
| |
| private struct ConnectingPortals |
| |
| { |
| |
| public ZDO PortalA; |
| |
| |
| |
| public ZDO PortalB; |
| |
| } |
| |
| |
| |
| [Serializable] |
| |
| public class ItemConversion |
| |
| { |
| |
| public HitData.DamageType m_damageType; |
| |
| |
| |
| public HitData.HitType m_hitType; |
| |
| |
| |
| public List<ItemDrop> m_items; |
| |
| |
| |
| public ItemDrop m_result; |
| |
| |
| |
| public int m_multiplier = 1; |
| |
| } |
| } |
| } |
| |
| |