public static bool IsOptionActive(GameModeOption mode, GameModeOption option, ref bool __result)
        {
            var currentConfig     = TranslateConfig(mode);
            var shouldRunOriginal = false;

            switch (option)
            {
            case GameModeOption.NoSurvival:
                __result = !currentConfig.Food.Enabled && !currentConfig.Water.Enabled;
                break;

            case GameModeOption.NoOxygen:
                __result = !currentConfig.Oxygen.Enabled;
                break;

            case GameModeOption.NoCold:
                __result = !currentConfig.Cold.Enabled;
                break;

            case GameModeOption.NoAggression:
                __result = !currentConfig.Health.Enabled;
                break;

            default:
                shouldRunOriginal = true;
                break;
            }

            return(shouldRunOriginal);
        }
예제 #2
0
        public static Game GetGame(GameModeOption gameMode)
        {
            string gameTypeName = ConfigurationManager.AppSettings[gameMode.ToString()];
            Type   gameType     = Type.GetType(gameTypeName);
            object game         = Activator.CreateInstance(gameType, (int)gameMode);

            return(game as Game);
        }
예제 #3
0
        private GameModeOption ParseGameMode(string stringGameMode)
        {
            GameModeOption gameMode = GameModeOption.Survival;

            stringGameMode = stringGameMode.ToLower(); // Lets be frank people have habits

            gameModeByConfig.TryGetValue(stringGameMode, out gameMode);
            return(gameMode);
        }
예제 #4
0
        public static Game InitializeGame(GameModeOption gameMode)
        {
            Game game = null;

            switch (gameMode.ToString())
            {
            case "Normal": game = new NormalChess((int)gameMode); break;

            case "Blitz": game = new BlitzChess((int)gameMode); break;
                //case "Custom": game = new CustomChess(); break;
            }

            return(game);
        }
예제 #5
0
        public static bool GameModeChanged(GameModeOption gameMode, uGUI_SceneHUD __instance)
        {
            ResetHUD.Invoke(__instance, EmptyParams);

            _mode.SetValue(__instance, 2);
            foreach (var _show in _shows)
            {
                _show.SetValue(__instance, true);
            }

            UpdateElements.Invoke(__instance, EmptyParams);

            return(false);
        }
        static VitalityConfig TranslateConfig(GameModeOption gameMode)
        {
            switch (gameMode)
            {
            case GameModeOption.Survival:
                return(C.Survival);

            case GameModeOption.Hardcore:
                return(C.Hardcore);

            case GameModeOption.Freedom:
                return(C.Freedom);

            case GameModeOption.Creative:
            default:
                return(C.Creative);
            }
        }
예제 #7
0
 public InitialPlayerSync(string playerGuid, bool firstTimeConnecting, List <EscapePodModel> escapePodsData, string assignedEscapePodGuid, List <EquippedItemData> equipment, List <BasePiece> basePieces, List <VehicleModel> vehicles, List <ItemData> inventoryItems, InitialPdaData pdaData, Vector3 playerSpawnData, Optional <string> playerSubRootGuid, PlayerStatsData playerStatsData, List <InitialRemotePlayerData> remotePlayerData, List <Entity> globalRootEntities, GameModeOption gameMode, Perms perms)
 {
     EscapePodsData        = escapePodsData;
     AssignedEscapePodGuid = assignedEscapePodGuid;
     PlayerGuid            = playerGuid;
     FirstTimeConnecting   = firstTimeConnecting;
     EquippedItems         = equipment;
     BasePieces            = basePieces;
     Vehicles           = vehicles;
     InventoryItems     = inventoryItems;
     PDAData            = pdaData;
     PlayerSpawnData    = playerSpawnData;
     PlayerSubRootGuid  = playerSubRootGuid;
     PlayerStatsData    = playerStatsData;
     RemotePlayerData   = remotePlayerData;
     GlobalRootEntities = globalRootEntities;
     GameMode           = gameMode;
     Permissions        = perms;
 }
예제 #8
0
        private World CreateWorld(DateTime serverStartTime,
                                  EntityData entityData,
                                  BaseData baseData,
                                  VehicleData vehicleData,
                                  InventoryData inventoryData,
                                  PlayerData playerData,
                                  GameData gameData,
                                  List <Int3> ParsedBatchCells,
                                  EscapePodData escapePodData,
                                  GameModeOption gameMode)
        {
            World world = new World();

            world.TimeKeeper = new TimeKeeper();
            world.TimeKeeper.ServerStartTime = serverStartTime;

            world.SimulationOwnershipData = new SimulationOwnershipData();
            world.PlayerManager           = new PlayerManager(playerData, config);
            world.EntityData       = entityData;
            world.EventTriggerer   = new EventTriggerer(world.PlayerManager);
            world.BaseData         = baseData;
            world.VehicleData      = vehicleData;
            world.InventoryData    = inventoryData;
            world.PlayerData       = playerData;
            world.GameData         = gameData;
            world.EscapePodData    = escapePodData;
            world.EscapePodManager = new EscapePodManager(escapePodData);
            world.EntitySimulation = new EntitySimulation(world.EntityData, world.SimulationOwnershipData, world.PlayerManager);
            world.GameMode         = gameMode;

            ResourceAssets resourceAssets = ResourceAssetsParser.Parse();

            world.BatchEntitySpawner = new BatchEntitySpawner(resourceAssets, ParsedBatchCells, serializer);

            Log.Info("World GameMode: " + gameMode);

            Log.Info("Server Password: "******"None. Public Server." : config.ServerPassword));
            Log.Info("Admin Password: "******"To get help for commands, run help in console or /help in chatbox");

            return(world);
        }
        public static void SetGameMode(GameModeOption mode, GameModeOption cheats)
        {
            currentConfig = TranslateConfig(mode);

            var name = "Creative";

            if (currentConfig == C.Freedom)
            {
                name = "Freedom";
            }
            else if (currentConfig == C.Hardcore)
            {
                name = "Hardcore";
            }
            else if (currentConfig == C.Survival)
            {
                name = "Survival";
            }

            ModUtils.LogDebug("Switching game mode to " + name);
        }
예제 #10
0
        private World CreateWorld(DateTime serverStartTime,
                                  EntityData entityData,
                                  BaseData baseData,
                                  VehicleData vehicleData,
                                  InventoryData inventoryData,
                                  PlayerData playerData,
                                  GameData gameData,
                                  List <Int3> ParsedBatchCells,
                                  EscapePodData escapePodData,
                                  GameModeOption gameMode)
        {
            World world = new World();

            world.TimeKeeper = new TimeKeeper();
            world.TimeKeeper.ServerStartTime = serverStartTime;

            world.SimulationOwnershipData = new SimulationOwnershipData();
            world.PlayerManager           = new PlayerManager(playerData);
            world.EntityData       = entityData;
            world.EventTriggerer   = new EventTriggerer(world.PlayerManager);
            world.BaseData         = baseData;
            world.VehicleData      = vehicleData;
            world.InventoryData    = inventoryData;
            world.PlayerData       = playerData;
            world.GameData         = gameData;
            world.EscapePodData    = escapePodData;
            world.EscapePodManager = new EscapePodManager(escapePodData);
            world.EntitySimulation = new EntitySimulation(world.EntityData, world.SimulationOwnershipData, world.PlayerManager);
            world.GameMode         = gameMode;

            ResourceAssets resourceAssets = ResourceAssetsParser.Parse();

            world.BatchEntitySpawner = new BatchEntitySpawner(resourceAssets, ParsedBatchCells, serializer);

            Log.Info("World GameMode " + gameMode);

            Log.Info("Server Admin Password : "******" You can set your own password in the server config file or by using the /changepassword command");

            return(world);
        }
예제 #11
0
        private World CreateWorld(DateTime serverStartTime,
                                  EntityData entityData,
                                  BaseData baseData,
                                  VehicleData vehicleData,
                                  InventoryData inventoryData,
                                  PlayerData playerData,
                                  GameData gameData,
                                  List <Int3> ParsedBatchCells,
                                  EscapePodData escapePodData,
                                  GameModeOption gameMode)
        {
            World world = new World();

            world.TimeKeeper = new TimeKeeper();
            world.TimeKeeper.ServerStartTime = serverStartTime;

            world.SimulationOwnershipData = new SimulationOwnershipData();
            world.PlayerManager           = new PlayerManager(playerData);
            world.EntityData       = entityData;
            world.EventTriggerer   = new EventTriggerer(world.PlayerManager);
            world.BaseData         = baseData;
            world.VehicleData      = vehicleData;
            world.InventoryData    = inventoryData;
            world.PlayerData       = playerData;
            world.GameData         = gameData;
            world.EscapePodData    = escapePodData;
            world.EscapePodManager = new EscapePodManager(escapePodData);
            world.EntitySimulation = new EntitySimulation(world.EntityData, world.SimulationOwnershipData, world.PlayerManager);
            world.GameMode         = gameMode;

            ResourceAssets resourceAssets = ResourceAssetsParser.Parse();

            world.BatchEntitySpawner = new BatchEntitySpawner(resourceAssets, ParsedBatchCells);

            Log.Info("World GameMode " + gameMode);

            return(world);
        }
예제 #12
0
 private void SetPlayerGameMode(GameModeOption gameMode)
 {
     Log.Info("Recieved initial sync packet with game mode " + gameMode);
     GameModeUtils.SetGameMode(gameMode, GameModeOption.None);
 }
예제 #13
0
 public CheatChange(GameModeOption cheats)
 {
     backupCheats = GetCheats();
     SetCheats(backupCheats | cheats);
 }
예제 #14
0
 private void SetCheats(GameModeOption newCheats)
 {
     TARGET_FIELD.SetValue(null, newCheats);
 }