Beispiel #1
0
 public static void Postfix(WorldEnvironment __instance, World ___m_World)
 {
     if (GamePrefs.GetString(EnumGamePrefs.GameWorld) == "Empty" || GamePrefs.GetString(EnumGamePrefs.GameWorld) == "Playtesting")
     {
         if (DistantTerrain.Instance != null)
         {
             DistantTerrain.Instance.Cleanup();
             DistantTerrain.Instance = null;
         }
         return;
     }
     if (!GameManager.IsDedicatedServer && !GameManager.IsSplatMapAvailable())
     {
         Debug.Log("Creating Legacy Distant Terrain");
         if (DistantTerrain.Instance == null && !GameManager.Instance.World.ChunkClusters[0].IsFixedSize)
         {
             DistantTerrain.cShiftHiResChunks = new Vector3(0f, 0.5f, 0f);
             DistantTerrain.Instance          = new DistantTerrain();
             DistantTerrain.Instance.Init();
         }
         DistantTerrainConstants.SeaLevel = 0f;
         DistantTerrain.Instance.Configure(new DelegateGetTerrainHeight(terrainHeightFuncAllOtherWorlds), GameManager.Instance.World.wcd, 0f);
         if (DistantTerrain.Instance != null)
         {
             DistantTerrain.Instance.SetTerrainVisible(true);
         }
     }
 }
Beispiel #2
0
    public override BlockActivationCommand[] GetBlockActivationCommands(WorldBase _world, BlockValue _blockValue, int _clrIdx, Vector3i _blockPos, EntityAlive _entityFocusing)
    {
        var tileEntity       = _world.GetTileEntity(_clrIdx, _blockPos);
        var secureLootEntity = tileEntity as TileEntitySecureLootContainer;

        if (secureLootEntity == null)
        {
            return(new BlockActivationCommand[0]);
        }
        string _steamID = GamePrefs.GetString(EnumGamePrefs.PlayerId);
        PersistentPlayerData playerData = _world.GetGameManager().GetPersistentPlayerList().GetPlayerData(secureLootEntity.GetOwner());
        bool flag = !secureLootEntity.IsOwner(_steamID) && (playerData != null && playerData.ACL != null && playerData.ACL.Contains(_steamID));

        _activationCommands[0].enabled = true;
        _activationCommands[1].enabled = !secureLootEntity.IsLocked() && (secureLootEntity.IsOwner(_steamID) || flag);
        _activationCommands[2].enabled = secureLootEntity.IsLocked() && secureLootEntity.IsOwner(_steamID);
        _activationCommands[3].enabled = !secureLootEntity.IsUserAllowed(_steamID) && secureLootEntity.HasPassword() && secureLootEntity.IsLocked() || secureLootEntity.IsOwner(_steamID);
        bool isMyLandProtectedBlock = _world.IsMyLandProtectedBlock(_blockPos, _world.GetGameManager().GetPersistentLocalPlayer(), false);

        _activationCommands[4].enabled = isMyLandProtectedBlock && secureLootEntity.IsOwner(_steamID) && _takeDelay > 0.0;

        _activationCommands[5].enabled = secureLootEntity.IsOwner(_steamID);

        return(_activationCommands);
    }
Beispiel #3
0
        private void Init()
        {
            // Configure remote logging
            RemoteLogger.SetTag("game", Title.ToLower());
            RemoteLogger.SetTag("version", GamePrefs.GetString(EnumGamePrefs.GameVersion));

            // Setup the default permission groups
            if (permission.IsLoaded)
            {
                var rank = 0;
                for (var i = DefaultGroups.Length - 1; i >= 0; i--)
                {
                    var defaultGroup = DefaultGroups[i];
                    if (!permission.GroupExists(defaultGroup))
                    {
                        permission.CreateGroup(defaultGroup, defaultGroup, rank++);
                    }
                }
                permission.RegisterValidate(s =>
                {
                    ulong temp;
                    if (!ulong.TryParse(s, out temp))
                    {
                        return(false);
                    }
                    var digits = temp == 0 ? 1 : (int)Math.Floor(Math.Log10(temp) + 1);
                    return(digits >= 17);
                });
                permission.CleanUp();
            }
        }
Beispiel #4
0
        internal static void ServerConsole()
        {
            if (Interface.Oxide.ServerConsole == null)
            {
                return;
            }

            Interface.Oxide.ServerConsole.Title = () => $"{GameManager.Instance.World.Players.Count} | {GamePrefs.GetString(EnumGamePrefs.ServerName)}";

            Interface.Oxide.ServerConsole.Status1Left  = () => GamePrefs.GetString(EnumGamePrefs.ServerName);
            Interface.Oxide.ServerConsole.Status1Right = () =>
            {
                var time   = TimeSpan.FromSeconds(Time.realtimeSinceStartup);
                var uptime = $"{time.TotalHours:00}h{time.Minutes:00}m{time.Seconds:00}s".TrimStart(' ', 'd', 'h', 'm', 's', '0');
                return($"{Mathf.RoundToInt(1f / Time.smoothDeltaTime)}fps, {uptime}");
            };

            Interface.Oxide.ServerConsole.Status2Left = () =>
            {
                var players  = $"{GameManager.Instance.World.Players.Count}/{GamePrefs.GetInt(EnumGamePrefs.ServerMaxPlayerCount)}";
                var entities = GameManager.Instance.World.Entities.Count;
                return($"{players}, {entities + (entities.Equals(1) ? " entity" : " entities")}");
            };
            Interface.Oxide.ServerConsole.Status2Right = () => string.Empty; // TODO: Network in/out

            Interface.Oxide.ServerConsole.Status3Left = () =>
            {
                var gameTime = GameManager.Instance.World.worldTime;
                var dateTime = Convert.ToDateTime($"{GameUtils.WorldTimeToHours(gameTime)}:{GameUtils.WorldTimeToMinutes(gameTime)}").ToString("h:mm tt");
                return($"{dateTime.ToLower()}, {GamePrefs.GetString(EnumGamePrefs.GameWorld)} [{GamePrefs.GetString(EnumGamePrefs.GameName)}]");
            };
            Interface.Oxide.ServerConsole.Status3Right      = () => $"Oxide {OxideMod.Version} for {GamePrefs.GetString(EnumGamePrefs.GameVersion)}";
            Interface.Oxide.ServerConsole.Status3RightColor = ConsoleColor.Yellow;
        }
Beispiel #5
0
 public override void GameAwake()
 {
     if (!Directory.Exists(string.Format("{0}/ServerTools", GamePrefs.GetString(EnumGamePrefs.SaveGameFolder))))
     {
         Directory.CreateDirectory(string.Format("{0}/ServerTools", GamePrefs.GetString(EnumGamePrefs.SaveGameFolder)));
     }
     Config.Init();
 }
Beispiel #6
0
    private static void TestWriter(List <string> _params)
    {
        // Printer.Write("TestWriter");
        Printer.Print("SGF", GamePrefs.GetString(EnumGamePrefs.SaveGameFolder)); // C:\Users\N4TH\AppData\Roaming/7DaysToDie/Saves
        Printer.Print("USF", GamePrefs.GetString(EnumGamePrefs.UserDataFolder)); // C:\Users\N4TH\AppData\Roaming/7DaysToDie
        string modpth = (Application.platform == RuntimePlatform.OSXPlayer) ? (Application.dataPath + "/../../Mods") : (Application.dataPath + "/../Mods");

        Printer.Print("MF", modpth); // ModManager.MOD_PATH);  //
    }
Beispiel #7
0
        public static bool Prefix(Prefab __instance, ref Vector3i _destinationPos, ChunkCluster _cluster, QuestTags _questTags)
        {
            // If they are pre-generated Winter Project worlds, don't apply this. They'd have already been applied.
            if (GamePrefs.GetString(EnumGamePrefs.GameWorld).ToLower().Contains("winter project"))
            {
                return(true);
            }

            _destinationPos.y -= 8;
            return(true);
        }
Beispiel #8
0
        private void OnServerInitialized()
        {
            if (serverInitialized)
            {
                return;
            }
            serverInitialized = true;

            // Configure the hostname after it has been set
            RemoteLogger.SetTag("hostname", GamePrefs.GetString(EnumGamePrefs.ServerName));
        }
        public override WWWResponse ProcessRequest(WWWRequest request)
        {
            //GameManager.Instance.adminTools.IsWhiteListEnabled
            WWWResponse response = null;

            if (!request.Form.ContainsKey("password") || request.Form["password"] == "")
            {
                string loginTemplate = WWW._templates ["loginform"];
                if (GameManager.Instance.adminTools.IsWhiteListEnabled())
                {
                    string steamButton = WWW._templates["steambutton"];
                    string hostAndPort = "http://" + request._request.Url.Host + ":" + request._request.Url.Port;

                    string steamLoginUrl = EndPoint_SteamLogin.GetSteamLoginUrl(hostAndPort, hostAndPort + "/steam");

                    steamButton = steamButton.Replace("{login_url}", steamLoginUrl);

                    loginTemplate = loginTemplate.Replace("{steam_button}", steamButton);
                    loginTemplate = loginTemplate.Replace("{steam_button_title}", "Login with Steam");
                }
                else
                {
                    loginTemplate = loginTemplate.Replace("{steam_button}", "");
                }

                response = new WWWResponse(loginTemplate);
            }
            else
            {
                string pw = request.Form["password"];

                if (pw == GamePrefs.GetString(EnumGamePrefs.ServerPassword))
                {
                    request.User.SetType("user");
                    response = new WWWResponse("/", 302);
                }
                else
                {
                    if (pw == GamePrefs.GetString(EnumGamePrefs.ControlPanelPassword))
                    {
                        request.User.SetType("admin");
                        response = new WWWResponse("/", 302);
                    }
                    else
                    {
                        response = new WWWResponse("/login/?err=InvalidPassword", 302);
                    }
                }
            }

            return(response);
        }
Beispiel #10
0
    private static bool IsInit = false; // prevent on 2nd game ?
    public static void Init(int playerId)
    {
        /*
         * Should be safe to do multiple calls ...
         * - Depends on Map so need re apply on game change
         * - Should only be called once per game (mostly because of thread start)
         *
         * - Check: multiplayer local
         *  - Called twice with 2 local players -> if below
         *  - Each player triggers on connect ?
         */

        /* I should put this all in the buff ?? Anythin here may be duplicate */
        if (IsInit)
        {
            Printer.Write("Zombiome is already init !", playerId);
            // if (AutoStart) {
            //     ZombiomeManager.Reset(playerId, "");
            // }
            return;
        }

        Printer.Write("Zombiome.Init():", playerId);

        CSutils.Routines.Sanitizer.Fixer = () => ZombiomeManager._Reset(-1);
        CSutils.Catcher.SwallowErrors    = SwallowError;

        rand      = GameRandomManager.Instance.CreateGameRandom();
        worldSeed = GamePrefs.GetString(EnumGamePrefs.WorldGenSeed);
        worldSize = GamePrefs.GetInt(EnumGamePrefs.WorldGenSize);

        ZBiomeInfo.Define();

        if (nz4)
        {
            Zone.Get = Zone.GetFour;
        }
        else
        {
            Zone.Get = position => new Zone[] { Zone.GetSingle(position) }
        };
        ZBActivity.ZombiomeActivitySelector.Initialize();

        if (AutoStart)
        {
            ZombiomeManager.Reset(playerId, "");
        }
        IsInit = true; // bugs on restart new game coz no one set to none - use World hash ?

        Printer.Write("Zombiome..Init: Done");
        // ZombiomeManager.Start(playerId); // manually until release
    }
Beispiel #11
0
        public static bool Prefix(ref Prefab __instance, ref Vector3i _prefabTargetPos)
        {
            // If they are pre-generated Winter Project worlds, don't apply this. They'd have already been applied.
            if (GamePrefs.GetString(EnumGamePrefs.GameWorld).ToLower().Contains("winter project"))
            {
                return(true);
            }

            _prefabTargetPos.y               -= 8;
            __instance.bTraderArea            = false;
            __instance.bExcludeDistantPOIMesh = true;
            __instance.bCopyAirBlocks         = true;
            return(true);
        }
Beispiel #12
0
        private void OnServerInitialized()
        {
            if (serverInitialized)
            {
                return;
            }
            serverInitialized = true;

            // Configure the hostname after it has been set
            RemoteLogger.SetTag("hostname", GamePrefs.GetString(EnumGamePrefs.ServerName));

            // Update server console window and status bars
            SevenDaysExtension.ServerConsole();
        }
Beispiel #13
0
        internal static void ServerConsole()
        {
            if (Interface.Oxide.ServerConsole == null)
            {
                return;
            }

            Interface.Oxide.ServerConsole.Title = () =>
            {
                return($"{GameManager.Instance?.World?.Players?.Count} | {GamePrefs.GetString(EnumGamePrefs.ServerName)}");
            };
            Interface.Oxide.ServerConsole.Status1Left  = () => $" {GamePrefs.GetString(EnumGamePrefs.ServerName)}";
            Interface.Oxide.ServerConsole.Status1Right = () =>
            {
                var fps     = Mathf.RoundToInt(1f / Time.smoothDeltaTime);
                var seconds = TimeSpan.FromSeconds(Time.realtimeSinceStartup);
                var uptime  = $"{seconds.TotalHours:00}h{seconds.Minutes:00}m{seconds.Seconds:00}s".TrimStart(' ', 'd', 'h', 'm', 's', '0');
                return(string.Concat(fps, "fps, ", uptime));
            };
            Interface.Oxide.ServerConsole.Status2Left = () =>
            {
                var players       = GameManager.Instance?.World?.Players?.Count;
                var playerLimit   = GamePrefs.GetInt(EnumGamePrefs.ServerMaxPlayerCount);
                var entitiesCount = GameManager.Instance?.World?.Entities?.Count;
                var entities      = entitiesCount + (entitiesCount.Equals(1) ? " entity" : " entities");
                return(string.Concat(" ", players, "/", playerLimit, " players, ", entities));
            };
            Interface.Oxide.ServerConsole.Status2Right = () => string.Empty; // TODO: Network in/out
            Interface.Oxide.ServerConsole.Status3Left  = () =>
            {
                if (GameManager.Instance == null || GameManager.Instance.World == null)
                {
                    return(string.Empty);
                }
                var time  = DateTime.Today.Add(TimeSpan.FromSeconds(GameManager.Instance.World.GetWorldTime())).ToString("h:mm tt").ToLower();
                var world = GamePrefs.GetString(EnumGamePrefs.GameWorld);
                var seed  = GamePrefs.GetString(EnumGamePrefs.GameName);
                return(string.Concat(" ", time, ", ", world, " [", seed, "]"));
            };
            Interface.Oxide.ServerConsole.Status3Right      = () => $"Oxide {OxideMod.Version} for {GamePrefs.GetString(EnumGamePrefs.GameVersion)}";
            Interface.Oxide.ServerConsole.Status3RightColor = ConsoleColor.Yellow;

            Interface.Oxide.ServerConsole.Input     += ServerConsoleOnInput;
            Interface.Oxide.ServerConsole.Completion = input =>
            {
                return(string.IsNullOrEmpty(input) ? null : SdtdConsole.Instance.commands.Keys.Where(c => c.StartsWith(input.ToLower())).ToArray());
            };
        }
Beispiel #14
0
        public static bool PrefabInstance_Prefix(ref Vector3i _position, ref Prefab _bad)
        {
            // Check if this feature is enabled.
            if (!Configuration.CheckFeatureStatus(AdvFeatureClass, Feature))
            {
                return(true);
            }

            // Only apply these changes to navezgane world
            if (GamePrefs.GetString(EnumGamePrefs.GameWorld) == "Navezgane")
            {
                if (_bad != null)
                {
                    _bad.bTraderArea = false;
                }
            }
            return(true);
        }
Beispiel #15
0
 private static void Init9()
 {
     PersistentOperations.ThirtySeconds = true;
     if (AllocsMap.IsEnabled)
     {
         string ip          = GamePrefs.GetString(EnumGamePrefs.ServerIP);
         int    controlPort = GamePrefs.GetInt(EnumGamePrefs.ControlPanelPort);
         string link        = string.Format("http://{0}:{1}", ip, controlPort + 2);
         if (AllocsMap.Link != link)
         {
             AllocsMap.Link = link;
             AllocsMap.SetLink(link);
         }
     }
     if (WebAPI.IsEnabled && !WebAPI.IsRunning)
     {
         WebAPI.Load();
     }
 }
Beispiel #16
0
    public override BlockActivationCommand[] GetBlockActivationCommands(WorldBase _world, BlockValue _blockValue, int _clrIdx, Vector3i _blockPos, EntityAlive _entityFocusing)
    {
        TileEntitySign tileEntitySign = (TileEntitySign)_world.GetTileEntity(_clrIdx, _blockPos);

        if (tileEntitySign == null)
        {
            return(new BlockActivationCommand[0]);
        }
        string @string = GamePrefs.GetString(EnumGamePrefs.PlayerId);
        PersistentPlayerData playerData = _world.GetGameManager().GetPersistentPlayerList().GetPlayerData(tileEntitySign.GetOwner());

        bool flag = !tileEntitySign.IsOwner(@string) && (playerData != null && playerData.ACL != null) && playerData.ACL.Contains(@string);

        this.cmds[0].enabled = true;
        this.cmds[1].enabled = (!tileEntitySign.IsLocked() && (tileEntitySign.IsOwner(@string) || flag));
        this.cmds[2].enabled = (tileEntitySign.IsLocked() && tileEntitySign.IsOwner(@string));
        this.cmds[3].enabled = ((!tileEntitySign.IsUserAllowed(@string) && tileEntitySign.HasPassword() && tileEntitySign.IsLocked()) || tileEntitySign.IsOwner(@string));
        this.cmds[4].enabled = ((!tileEntitySign.IsUserAllowed(@string) && tileEntitySign.HasPassword() && tileEntitySign.IsLocked()) || tileEntitySign.IsOwner(@string));

        return(this.cmds);
    }
Beispiel #17
0
        public static bool Prefix(float ___sunIntensity, float ___sMaxSunIntensity)
        {
            if (!Configuration.CheckFeatureStatus(AdvFeatureClass, Feature))
            {
                return(true);
            }

            if (GamePrefs.GetString(EnumGamePrefs.GameWorld) == "Empty" || GamePrefs.GetString(EnumGamePrefs.GameWorld) == "Playtesting")
            {
                return(true);
            }


            if (GameManager.Instance.World.GetPrimaryPlayer() == null)
            {
                return(true);
            }

            if (GameManager.Instance.World.GetPrimaryPlayer().position.y < 30)
            {
                SkyManager.SetSunIntensity(0.1f);
            }
            return(true);
        }
        private string GetFilePath()
        {
            var path = GameUtils.GetSaveGameDir(GamePrefs.GetString(EnumGamePrefs.GameWorld), GamePrefs.GetString(EnumGamePrefs.GameName));

            return(Path.Combine(path, _fileName));
        }
Beispiel #19
0
        public static bool Prefix(ref Block __instance, int _indexInBlockActivationCommands, WorldBase _world, int _cIdx, Vector3i _blockPos, BlockValue _blockValue, EntityAlive _player)
        {
            // Check if this feature is enabled.
            if (!Configuration.CheckFeatureStatus(AdvFeatureClass, Feature))
            {
                return(true);
            }

            if (_blockValue.ischild)
            {
                return(true);
            }
            TileEntitySecureDoor tileEntitySecureDoor = (TileEntitySecureDoor)_world.GetTileEntity(_cIdx, _blockPos);

            if (tileEntitySecureDoor == null)
            {
                return(true);
            }


            if (!tileEntitySecureDoor.IsLocked() || tileEntitySecureDoor.IsUserAllowed(GamePrefs.GetString(EnumGamePrefs.PlayerId)))
            {
                return(true);
            }


            if (tileEntitySecureDoor.IsLocked())
            {
                // 1 == try to open locked door.
                if (_indexInBlockActivationCommands == 1)
                {
                    // Check if the player has lock picks.
                    LocalPlayerUI        playerUI        = (_player as EntityPlayerLocal).PlayerUI;
                    XUiM_PlayerInventory playerInventory = playerUI.xui.PlayerInventory;
                    ItemValue            item            = ItemClass.GetItem("resourceLockPick", false);
                    if (playerInventory.GetItemCount(item) == 0)
                    {
                        playerUI.xui.CollectedItemList.AddItemStack(new ItemStack(item, 0), true);
                        GameManager.ShowTooltip(_player as EntityPlayerLocal, Localization.Get("ttLockpickMissing"));
                        return(false);
                    }

                    tileEntitySecureDoor.SetLocked(true);
                    XUiC_PickLocking.Open(playerUI, tileEntitySecureDoor, _blockValue, _blockPos);
                    return(false);
                }
            }
            return(true);
        }
Beispiel #20
0
    /*
    NB: EnumGamePrefs.GameDifficulty etc

    */
    public static string Full(string name) {
        // return ""; // for testing
        return GamePrefs.GetString(EnumGamePrefs.SaveGameFolder) + "/" + name;
    }
Beispiel #21
0
 public static string GetCurrentWorldSaveDir()
 {
     return(GamePrefs.GetString(EnumGamePrefs.SaveGameFolder) + Path.DirectorySeparatorChar
            + GamePrefs.GetString(EnumGamePrefs.GameWorld) + Path.DirectorySeparatorChar
            + GamePrefs.GetString(EnumGamePrefs.GameName));
 }
Beispiel #22
0
    public override bool OnBlockActivated(int _indexInBlockActivationCommands, WorldBase _world, int _cIdx,
                                          Vector3i _blockPos, BlockValue _blockValue, EntityAlive _player)
    {
        if (_blockValue.ischild)
        {
            Vector3i   parentPos = Block.list[_blockValue.type].multiBlockPos.GetParentPos(_blockPos, _blockValue);
            BlockValue block     = _world.GetBlock(parentPos);
            return(this.OnBlockActivated(_indexInBlockActivationCommands, _world, _cIdx, parentPos, block, _player));
        }
        TileEntitySign tileEntitySign = _world.GetTileEntity(_cIdx, _blockPos) as TileEntitySign;

        if (tileEntitySign == null)
        {
            return(false);
        }
        switch (_indexInBlockActivationCommands)
        {
        case 0:
            if (GameManager.Instance.IsEditMode() || !tileEntitySign.IsLocked() || tileEntitySign.IsUserAllowed(GamePrefs.GetString(EnumGamePrefs.PlayerId)))
            {
                return(this.OnBlockActivated(_world, _cIdx, _blockPos, _blockValue, _player));
            }
            Manager.BroadcastPlayByLocalPlayer(_blockPos.ToVector3() + Vector3.one * 0.5f, "Misc/locked");
            return(false);

        case 1:
            tileEntitySign.SetLocked(true);
            Manager.BroadcastPlayByLocalPlayer(_blockPos.ToVector3() + Vector3.one * 0.5f, "Misc/locking");
            GameManager.ShowTooltip(_player as EntityPlayerLocal, "containerLocked");
            return(true);

        case 2:
            tileEntitySign.SetLocked(false);
            Manager.BroadcastPlayByLocalPlayer(_blockPos.ToVector3() + Vector3.one * 0.5f, "Misc/unlocking");
            GameManager.ShowTooltip(_player as EntityPlayerLocal, "containerUnlocked");
            return(true);

        case 3:
            XUiC_KeypadWindow.Open(LocalPlayerUI.GetUIForPlayer(_player as EntityPlayerLocal), tileEntitySign);
            return(true);

        case 4:
            LocalPlayerUI uiforPlayer = LocalPlayerUI.GetUIForPlayer(_player as EntityPlayerLocal);
            ItemStack     itemStack   = new ItemStack(_blockValue.ToItemValue(), 1);
            if (!uiforPlayer.xui.PlayerInventory.AddItem(itemStack))
            {
                uiforPlayer.xui.PlayerInventory.DropItem(itemStack);
            }
            _world.SetBlockRPC(_cIdx, _blockPos, BlockValue.Air);

            return(true);

        default:
            return(false);
        }
    }
Beispiel #23
0
        public override WWWResponse ProcessRequest(WWWRequest request)
        {
            if (request.Form.Count > 0)
            {
                bool wasChanged = false;
                if (request.Form.ContainsKey("tickrate"))
                {
                    int passedRate = 0;

                    if (int.TryParse(request.Form["tickrate"], out passedRate))
                    {
                        if (API.Instance.tickRate != passedRate)
                        {
                            API.Instance.tickRate = passedRate;
                            wasChanged            = true;
                        }
                    }
                }

                if (request.Form.ContainsKey("overridegamepref"))
                {
                    if (API.OverrideGamePrefs == false)
                    {
                        API.OverrideGamePrefs = true;
                        wasChanged            = true;
                    }

                    //see if anything else has been changed
                    foreach (string fieldName in request.Form.Keys)
                    {
                        if (fieldName == "tickrate" || fieldName == "overridegamepref")
                        {
                            continue;
                        }

                        switch (fieldName)
                        {
                        case "world_type":
                            API.Instance.SetConfig("worldtype", request.Form [fieldName], false, true);
                            wasChanged = true;
                            break;

                        case "world_name":

                            API.Instance.SetConfig("worldname", request.Form [fieldName], false, true);
                            wasChanged = true;
                            break;
                        }
                    }
                }
                else
                {
                    if (API.OverrideGamePrefs == true)
                    {
                        API.OverrideGamePrefs = false;
                        wasChanged            = true;
                    }
                }

                if (request.Form.ContainsKey("webconsole_enabled"))
                {
                    API.WebConsoleEnabled = true;
                    API.WebConsolePort    = request.Form ["webconsole_port"];
                    wasChanged            = true;
                }
                else
                {
                    API.WebConsoleEnabled = false;
                    wasChanged            = true;
                }

                if (request.Form.ContainsKey("chatcommands_enabled"))
                {
                    API.ChatCommandsEnabled = true;
                    wasChanged = true;
                }
                else
                {
                    API.ChatCommandsEnabled = false;
                    wasChanged = true;
                }

                if (wasChanged)
                {
                    API.Instance.SaveConfig();
                }
            }

            string html = Servers.HTTP.WWW._templates["settingsform"];

            html = html.Replace("{tickrate}", API.Instance.tickRate.ToString());
            html = html.Replace("{chatcommands_enabled}", API.ChatCommandsEnabled.ToString().ToLower());
            html = html.Replace("{overridegameprefs}", API.OverrideGamePrefs.ToString().ToLower());
            html = html.Replace("{world_type}", GamePrefs.GetString(EnumGamePrefs.GameWorld).ToLower());
            html = html.Replace("{world_name}", GamePrefs.GetString(EnumGamePrefs.GameName));
            html = html.Replace("{webconsole_enabled}", API.WebConsoleEnabled.ToString().ToLower());
            html = html.Replace("{webconsole_port}", API.WebConsolePort);
            WWWResponse response = new WWWResponse(html);

            return(response);
        }
Beispiel #24
0
    public override void ExecuteAction(ItemActionData _actionData, bool _bReleased)
    {
        ItemActionSpawnCustomVehicle.ItemActionDataSpawnCustomVehicle itemActionDataSpawnMinibike = (ItemActionSpawnCustomVehicle.ItemActionDataSpawnCustomVehicle)_actionData;
        if (!(_actionData.invData.holdingEntity is EntityPlayerLocal))
        {
            return;
        }
        if (!_bReleased)
        {
            return;
        }
        if (Time.time - _actionData.lastUseTime < this.Delay)
        {
            return;
        }
        if (Time.time - _actionData.lastUseTime < Constants.cBuildIntervall)
        {
            return;
        }
        if (!itemActionDataSpawnMinibike.ValidPosition)
        {
            return;
        }
        ItemInventoryData invData = _actionData.invData;

        if (this.entityId < 0)
        {
            foreach (int v in EntityClass.list.Keys)
            {
                if (EntityClass.list[v].entityClassName == this.entityToSpawn)
                {
                    this.entityId = v;
                    break;
                }
            }
            if (this.entityId == 0)
            {
                return;
            }
        }
        if (!Steam.Network.IsServer)
        {
            SingletonMonoBehaviour <ConnectionManager> .Instance.SendToServer(new NetPackageVehicleSpawn(this.entityId, itemActionDataSpawnMinibike.Position, new Vector3(0f, _actionData.invData.holdingEntity.rotation.y + 90f, 0f), invData.holdingEntity.inventory.holdingItemItemValue.Clone(), _actionData.invData.holdingEntity.entityId), true);
        }
        else
        {
            EntityVehicle entityVehicle = (EntityVehicle)EntityFactory.CreateEntity(this.entityId, itemActionDataSpawnMinibike.Position, new Vector3(0f, _actionData.invData.holdingEntity.rotation.y + 90f, 0f));
            entityVehicle.SetSpawnerSource(EnumSpawnerSource.StaticSpawner);
            Vehicle vehicle = entityVehicle.GetVehicle();
            string  tag     = "chassis";
            if (invData.holdingEntity.inventory.holdingItem != null)
            {
                tag = invData.holdingEntity.inventory.holdingItem.VehicleSlotType;
            }
            vehicle.SetPartInSlot(tag, invData.holdingEntity.inventory.holdingItemItemValue.Clone());
            vehicle.SaveVehiclePartsToInventory();
            entityVehicle.SetOwner(GamePrefs.GetString(EnumGamePrefs.PlayerId));
            GameManager.Instance.World.SpawnEntityInWorld(entityVehicle);
        }
        invData.holdingEntity.RightArmAnimationUse = true;
        GameManager.Instance.StartCoroutine(this.EB(invData, invData.holdingEntity.inventory.holdingItemIdx));
    }
Beispiel #25
0
 private void Init()
 {
     // Configure remote logging
     RemoteLogger.SetTag("game", "7 days to die");
     RemoteLogger.SetTag("version", GamePrefs.GetString(EnumGamePrefs.GameVersion));
 }
        public static void Load()
        {
            Timers.TimerStart();
            Timers.Timer2Start();
            string    _sql    = "SELECT pollOpen FROM Polls WHERE pollOpen = 'true'";
            DataTable _result = SQL.TypeQuery(_sql);

            if (_result.Rows.Count > 0)
            {
                PollConsole.Check();
            }
            _result.Dispose();
            if (!ClanManager.IsEnabled)
            {
                ClanManager.Clans.Clear();
                ClanManager.ClanMember.Clear();
            }
            if (!InfoTicker.IsEnabled && InfoTicker.IsRunning)
            {
                InfoTicker.Unload();
            }
            if (InfoTicker.IsEnabled && !InfoTicker.IsRunning)
            {
                InfoTicker.Load();
            }
            if (Gimme.IsRunning && !Gimme.IsEnabled)
            {
                Gimme.Unload();
            }
            if (!Gimme.IsRunning && Gimme.IsEnabled)
            {
                Gimme.Load();
            }
            if (Badwords.IsRunning && !Badwords.IsEnabled)
            {
                Badwords.Unload();
            }
            if (!Badwords.IsRunning && Badwords.IsEnabled)
            {
                Badwords.Load();
            }
            if (!LoginNotice.IsRunning && LoginNotice.IsEnabled)
            {
                LoginNotice.Load();
            }
            if (LoginNotice.IsRunning && !LoginNotice.IsEnabled)
            {
                LoginNotice.Unload();
            }
            if (!Zones.IsRunning && Zones.IsEnabled)
            {
                Zones.Load();
            }
            if (Zones.IsRunning && !Zones.IsEnabled)
            {
                Zones.Unload();
            }
            if (!VoteReward.IsRunning && VoteReward.IsEnabled)
            {
                VoteReward.Load();
            }
            if (VoteReward.IsRunning && !VoteReward.IsEnabled)
            {
                VoteReward.Unload();
            }
            if (!Watchlist.IsRunning && Watchlist.IsEnabled)
            {
                Watchlist.Load();
            }
            if (Watchlist.IsRunning && !Watchlist.IsEnabled)
            {
                Watchlist.Unload();
            }
            if (!ReservedSlots.IsRunning && ReservedSlots.IsEnabled)
            {
                ReservedSlots.Load();
            }
            if (ReservedSlots.IsRunning && !ReservedSlots.IsEnabled)
            {
                ReservedSlots.Unload();
            }
            if (!StartingItems.IsRunning && StartingItems.IsEnabled)
            {
                StartingItems.Load();
            }
            if (StartingItems.IsRunning && !StartingItems.IsEnabled)
            {
                StartingItems.Unload();
            }
            if (!Travel.IsRunning && Travel.IsEnabled)
            {
                Travel.Load();
            }
            if (Travel.IsRunning && !Travel.IsEnabled)
            {
                Travel.Unload();
            }
            if (!Shop.IsRunning && Shop.IsEnabled)
            {
                Shop.Load();
            }
            if (Shop.IsRunning && !Shop.IsEnabled)
            {
                Shop.Unload();
            }
            if (!Motd.IsRunning && Motd.IsEnabled)
            {
                Motd.Load();
            }
            if (Motd.IsRunning && !Motd.IsEnabled)
            {
                Motd.Unload();
            }
            if (InventoryCheck.IsRunning && !InventoryCheck.IsEnabled)
            {
                InventoryCheck.Unload();
            }
            if (!InventoryCheck.IsRunning && InventoryCheck.IsEnabled)
            {
                InventoryCheck.Load();
            }
            if (HighPingKicker.IsEnabled)
            {
                HighPingKicker.Load();
            }
            if (CredentialCheck.IsRunning && !CredentialCheck.IsEnabled)
            {
                CredentialCheck.Unload();
            }
            if (!CredentialCheck.IsRunning && CredentialCheck.IsEnabled)
            {
                CredentialCheck.Load();
            }
            if (CustomCommands.IsRunning && !CustomCommands.IsEnabled)
            {
                CustomCommands.Unload();
            }
            if (!CustomCommands.IsRunning && CustomCommands.IsEnabled)
            {
                CustomCommands.Load();
            }
            if (DupeLog.IsRunning && !DupeLog.IsEnabled)
            {
                DupeLog.Unload();
            }
            if (!DupeLog.IsRunning && DupeLog.IsEnabled)
            {
                DupeLog.Load();
            }
            if (ChatColorPrefix.IsRunning && !ChatColorPrefix.IsEnabled)
            {
                ChatColorPrefix.Unload();
            }
            if (!ChatColorPrefix.IsRunning && ChatColorPrefix.IsEnabled)
            {
                ChatColorPrefix.Load();
            }
            if (KillNotice.IsRunning && !KillNotice.IsEnabled)
            {
                KillNotice.Unload();
            }
            if (!KillNotice.IsRunning && KillNotice.IsEnabled)
            {
                KillNotice.Load();
            }
            if (!Prayer.IsRunning && Prayer.IsEnabled)
            {
                Prayer.Load();
            }
            if (Prayer.IsRunning && !Prayer.IsEnabled)
            {
                Prayer.Unload();
            }
            if (LoadTriggers.IsRunning)
            {
                LoadTriggers.Unload();
            }
            if (!LoadTriggers.IsRunning)
            {
                LoadTriggers.Load();
            }
            if (ProtectedSpace.IsRunning)
            {
                ProtectedSpace.Unload();
            }
            if (!ProtectedSpace.IsRunning)
            {
                ProtectedSpace.Load();
            }
            if (ClanManager.IsEnabled)
            {
                ClanManager.ClanList();
            }
            if (AuctionBox.IsEnabled)
            {
                AuctionBox.AuctionList();
            }
            if (Mute.IsEnabled)
            {
                Mute.MuteList();
            }
            if (Jail.IsEnabled)
            {
                Jail.JailList();
            }
            if (BattleLogger.IsEnabled && !BattleLogger.LogFound && !string.IsNullOrEmpty(Utils.GetApplicationScratchPath()))
            {
                if (!GamePrefs.GetString(EnumGamePrefs.ServerDisabledNetworkProtocols).ToLower().Contains("litenetlib"))
                {
                    BattleLogger.LogDirectory = Utils.GetApplicationScratchPath();
                    BattleLogger.ConfirmLog();
                }
                else
                {
                    Log.Out("--------------------------------------------------------------------------");
                    Log.Out("[SERVERTOOLS] Unable to verify log file. Battle_Loggers has been disabled.");
                    Log.Out("[SERVERTOOLS] Network protocol litenetlib is required for this tool.");
                    Log.Out("--------------------------------------------------------------------");
                }
            }
            PatchTools.ApplyPatches();
        }