Exemplo n.º 1
0
        void cmdChatPlaceback(BasePlayer player, string command, string[] args)
        {
            if (player.net.connection.authLevel < 1)
            {
                SendReply(player, "You are not allowed to use this command");
                return;
            }
            if (args == null || args.Length == 0)
            {
                SendReply(player, "You need to set the name of the copy file: /placeback NAME");
                return;
            }
            heightAdjustment = 0;
            filename         = string.Format("copypaste-{0}", args[0].ToString());

            Core.Configuration.DynamicConfigFile PasteData = Interface.GetMod().DataFileSystem.GetDatafile(filename);
            if (PasteData["structure"] == null || PasteData["default"] == null)
            {
                SendReply(player, "This is not a correct copypaste file, or it\'s empty.");
                return;
            }
            Dictionary <string, object> defaultData = PasteData["default"] as Dictionary <string, object>;
            Dictionary <string, object> defaultPos  = defaultData["position"] as Dictionary <string, object>;
            Vector3       defaultposition           = new Vector3(Convert.ToSingle(defaultPos["x"]), Convert.ToSingle(defaultPos["y"]), Convert.ToSingle(defaultPos["z"]));
            List <object> structureData             = PasteData["structure"] as List <object>;
            List <object> deployablesData           = PasteData["deployables"] as List <object>;

            PasteBuilding(structureData, defaultposition, Convert.ToSingle(defaultData["yrotation"]), heightAdjustment);
            PasteDeployables(deployablesData, defaultposition, Convert.ToSingle(defaultData["yrotation"]), heightAdjustment, player);
        }
Exemplo n.º 2
0
        void Init()
        {
            LoadConfig();
            mySave = Interface.GetMod().DataFileSystem.GetDatafile("UniqueName");

            if (mySave["UserNames"] != null)
            {
                if (((Dictionary <string, object>)mySave["UserNames"]).Count != 0)
                {
                    UserNames = (Dictionary <string, object>)mySave["UserNames"];
                }
            }
            if (mySave["Users"] != null)
            {
                if (((Dictionary <string, object>)mySave["Users"]).Count != 0)
                {
                    Users = (Dictionary <string, object>)mySave["Users"];
                }
            }

            foreach (BasePlayer CurrentPlayer in BasePlayer.activePlayerList)
            {
                CheckPlayer(CurrentPlayer);
            }
            mySaveData();
        }
Exemplo n.º 3
0
        void cmdChatPaste(BasePlayer player, string command, string[] args)
        {
            if (!hasAccess(player))
            {
                return;
            }
            if (args == null || args.Length == 0)
            {
                SendReply(player, "You need to set the name of the copy file: /paste NAME optional:HeightAdjustment");
                return;
            }

            // Adjust height so you don't automatically paste in the ground
            heightAdjustment = 0.5f;
            if (args.Length > 1)
            {
                float.TryParse(args[1].ToString(), out heightAdjustment);
            }

            // Get player camera view directly from the player
            if (!TryGetPlayerView(player, out currentRot))
            {
                SendReply(player, "Couldn\'t find your eyes");
                return;
            }

            // Get what the player is looking at
            if (!TryGetClosestRayPoint(player.transform.position, currentRot, out closestEnt, out closestHitpoint))
            {
                SendReply(player, "Couldn\'t find any Entity");
                return;
            }

            // Check if what the player is looking at is a collider
            var baseentity = closestEnt as Collider;

            if (baseentity == null)
            {
                SendReply(player, "You are not looking at a Structure, or something is blocking the view.");
                return;
            }
            closestHitpoint.y = closestHitpoint.y + heightAdjustment;

            filename = string.Format("copypaste-{0}", args[0].ToString());
            Core.Configuration.DynamicConfigFile PasteData = Interface.GetMod().DataFileSystem.GetDatafile(filename);
            if (PasteData["structure"] == null || PasteData["default"] == null)
            {
                SendReply(player, "This is not a correct copypaste file, or it\'s empty.");
                return;
            }
            List <object> structureData   = PasteData["structure"] as List <object>;
            List <object> deployablesData = PasteData["deployables"] as List <object>;
            List <object> spawnablesData  = PasteData["spawnables"] as List <object>;

            PasteBuilding(structureData, closestHitpoint, currentRot.ToEulerAngles().y, heightAdjustment);
            PasteDeployables(deployablesData, closestHitpoint, currentRot.ToEulerAngles().y, heightAdjustment, player);
            PasteSpawnables(spawnablesData, closestHitpoint, currentRot.ToEulerAngles().y, heightAdjustment, player);
        }
Exemplo n.º 4
0
 private void LoadBeaconData()
 {
     //Debug.Log("Loading data...");
     try
     {
         //BeaconData = Interface.GetMod().DataFileSystem.ReadObject<Oxide.Core.Configuration.DynamicConfigFile>("PersonalBeacon_Data");
         BeaconData = Interface.GetMod().DataFileSystem.GetDatafile("PersonalBeacon_Data");
     }
     catch
     {
         Debug.Log("Failed to load datafile.");
     }
     //Debug.Log("Data should be loaded.");
 }
Exemplo n.º 5
0
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // Oxide Hooks
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////

        void Loaded()
        {
            BuildingOwnersData = Interface.GetMod().DataFileSystem.GetDatafile("BuildingOwners");

            lang.RegisterMessages(new Dictionary <string, string>
            {
                { "You don't have the permissions to use this command.", "You don't have the permissions to use this command." },
                { "You are not allowed to use this command.", "You are not allowed to use this command." },
                { "Syntax: /changeowner PLAYERNAME/STEAMID", "Syntax: /changeowner PLAYERNAME/STEAMID" },
                { "Target player not found.", "Target player not found." },
                { "New owner of this house is: {0}", "New owner of this house is: {0}" },
                { "An admin gave you the ownership of this house", "An admin gave you the ownership of this house" }
            }, this);
        }
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////
        // Oxide Hooks
        //////////////////////////////////////////////////////////////////////////////////////////////////////////////

        void Loaded()
        {
            BuildingOwnersData = Interface.GetMod().DataFileSystem.GetDatafile("BuildingOwners");

            lang.RegisterMessages(new Dictionary<string, string>
            {
                {"You don't have the permissions to use this command.","You don't have the permissions to use this command." },
                {"You are not allowed to use this command.","You are not allowed to use this command." },
                {"Syntax: /changeowner PLAYERNAME/STEAMID","Syntax: /changeowner PLAYERNAME/STEAMID" },
                {"Target player not found.","Target player not found." },
                {"New owner of this house is: {0}","New owner of this house is: {0}" },
                {"An admin gave you the ownership of this house","An admin gave you the ownership of this house" }
            }, this);
        }
Exemplo n.º 7
0
 void Init()
 {
     LoadConfig();
     mySave = Interface.GetMod().DataFileSystem.GetDatafile("HappyHour");
     if (mySave["Users"] != null)
     {
         if (((Dictionary <string, object>)mySave["Users"]).Count != 0)
         {
             Users = (Dictionary <string, object>)mySave["Users"];
         }
     }
     mySaveData();
     MainTimer = Interface.GetMod().GetLibrary <Oxide.Core.Libraries.Timer>("Timer");
     MainTime  = Interface.GetMod().GetLibrary <Time>("Time");
 }
Exemplo n.º 8
0
        void cmdChatPaste(NetUser player, string command, string[] args)
        {
            if (!hasAccess(player))
            {
                return;
            }
            if (args == null || args.Length == 0)
            {
                SendReply(player, "You need to set the name of the copy file: /paste NAME optional:HeightAdjustment");
                return;
            }

            // Adjust height so you don't automatically paste in the ground
            heightAdjustment = 0.5f;
            if (args.Length > 1)
            {
                float.TryParse(args[1].ToString(), out heightAdjustment);
            }

            // Get player camera view directly from the player
            if (!TryGetPlayerView(player, out currentRot))
            {
                SendReply(player, "Couldn't find your eyes");
                return;
            }

            // Get what the player is looking at
            if (!TryGetClosestPoint(player.playerClient.rootControllable.GetComponent <Character>().eyesOrigin, currentRot, out closestEnt, out closestHitpoint))
            {
                SendReply(player, "Couldn't find any Entity");
                return;
            }

            closestHitpoint.y = closestHitpoint.y - 4f + heightAdjustment;

            filename = string.Format("copypaste-{0}", args[0].ToString());
            Core.Configuration.DynamicConfigFile PasteData = Interface.GetMod().DataFileSystem.GetDatafile(filename);
            if (PasteData["structure"] == null || PasteData["default"] == null)
            {
                SendReply(player, "This is not a correct copypaste file, or it's empty.");
                return;
            }
            List <object> structureData   = PasteData["structure"] as List <object>;
            List <object> deployablesData = PasteData["deployables"] as List <object>;

            PasteBuilding(structureData, closestHitpoint, currentRot.ToEulerAngles().y, heightAdjustment, player);
            PasteDeployables(deployablesData, closestHitpoint, currentRot.ToEulerAngles().y, heightAdjustment, player);
        }
Exemplo n.º 9
0
        private void SendBasePlayerFind(BasePlayer player, ulong ownerid)
        {
            BasePlayer targetplayer = BasePlayer.FindByID(ownerid);

            if (targetplayer != null)
            {
                SendReply(player, string.Format("{0} - {1} - Online", targetplayer.displayName.ToString(), ownerid.ToString()));
                return;
            }
            targetplayer = BasePlayer.FindSleeping(ownerid);
            if (targetplayer != null)
            {
                SendReply(player, string.Format("{0} - {1} - Sleeping", targetplayer.displayName.ToString(), ownerid.ToString()));
                return;
            }
            if (deadplayers is Oxide.Core.Plugins.Plugin)
            {
                /*object deadplayer = ((Oxide.Core.Plugins.Plugin)deadplayers).CallHook("FindDeadPlayerByID", new object[1] { ownerid.ToString() });
                 *
                 * if (!(deadplayer is bool))
                 * {
                 *  if (deadplayer != null)
                 *  {
                 *      Puts(deadplayer.ToString());
                 *      Dictionary<string, object> data = deadplayer as Dictionary<string, object>;
                 *      foreach (KeyValuePair<string, object> pair in data)
                 *      {
                 *          Puts(pair.Key.ToString());
                 *          //if (pair.Key.ToString() == "displayName")
                 *          //{
                 *            //  SendReply(player, string.Format("{0} - {1} - Dead", pair.Value.ToString(), ownerid.ToString()));
                 *          //}
                 *      }
                 *  }
                 * }*/
                deadPlayersData = Interface.GetMod().DataFileSystem.GetDatafile("deadPlayerList");
                if (deadPlayersData[ownerid.ToString()] != null)
                {
                    Dictionary <string, object> data = deadPlayersData[ownerid.ToString()] as Dictionary <string, object>;
                    SendReply(player, string.Format("{0} - {1} - Dead", data["displayName"].ToString(), ownerid.ToString()));
                    return;
                }
            }
            SendReply(player, string.Format("{0} - {1} - Dead", "Unknown Player", ownerid.ToString()));
        }
Exemplo n.º 10
0
        /////////////////////////
        //  Loaded()
        // Called when the server was initialized (when people can start joining)
        /////////////////////////
        void OnServerInitialized()
        {
            ACData        = Interface.GetMod().DataFileSystem.GetDatafile("AntiCheat");
            getblueprints = typeof(PlayerInventory).GetField("_boundBPs", (BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic));
            getlooters    = typeof(Inventory).GetField("_netListeners", (BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance | BindingFlags.NonPublic));
            wooddata      = DatablockDictionary.GetByName("Wood");
            PlayerHandler phandler;

            foreach (PlayerClient player in PlayerClient.All)
            {
                if (hasPermission(player.netUser))
                {
                    continue;
                }
                phandler          = player.gameObject.AddComponent <PlayerHandler>();
                phandler.timeleft = GetPlayerData(player);
                phandler.StartCheck();
            }
        }
Exemplo n.º 11
0
        void OnNewSave(string name)
        {
            Interface.Oxide.LogWarning("BuildingOwners: Wipe detected. Saving last buildingowners data in BuildingOwners_backup");

            var BuildingOwnersData_backup = Interface.GetMod().DataFileSystem.GetDatafile("BuildingOwners_backup");

            BuildingOwnersData_backup.Clear();
            var e = BuildingOwnersData.GetEnumerator();

            while (e.MoveNext())
            {
                BuildingOwnersData_backup[e.Current.Key] = e.Current.Value;
            }
            Interface.GetMod().DataFileSystem.SaveDatafile("BuildingOwners_backup");

            BuildingOwnersData = Interface.GetMod().DataFileSystem.GetDatafile("BuildingOwners");
            BuildingOwnersData.Clear();
            SaveData();
        }
Exemplo n.º 12
0
        private void SendBasePlayerFind(BasePlayer player, ulong ownerid)
        {
            BasePlayer targetplayer = BasePlayer.FindByID(ownerid);
            if (targetplayer != null)
            {
                SendReply(player, string.Format("{0} - {1} - Online", targetplayer.displayName.ToString(), ownerid.ToString()));
                return;
            }
            targetplayer = BasePlayer.FindSleeping(ownerid);
            if (targetplayer != null)
            {
                SendReply(player, string.Format("{0} - {1} - Sleeping", targetplayer.displayName.ToString(), ownerid.ToString()));
                return;
            }
            if (deadplayers is Oxide.Core.Plugins.Plugin)
            {
                /*object deadplayer = ((Oxide.Core.Plugins.Plugin)deadplayers).CallHook("FindDeadPlayerByID", new object[1] { ownerid.ToString() });

                if (!(deadplayer is bool))
                {
                    if (deadplayer != null)
                    {
                        Puts(deadplayer.ToString());
                        Dictionary<string, object> data = deadplayer as Dictionary<string, object>;
                        foreach (KeyValuePair<string, object> pair in data)
                        {
                            Puts(pair.Key.ToString());
                            //if (pair.Key.ToString() == "displayName")
                            //{
                              //  SendReply(player, string.Format("{0} - {1} - Dead", pair.Value.ToString(), ownerid.ToString()));
                            //}
                        }
                    }
                }*/
                deadPlayersData = Interface.GetMod().DataFileSystem.GetDatafile("deadPlayerList");
                if (deadPlayersData[ownerid.ToString()] != null)
                {
                    Dictionary<string, object> data = deadPlayersData[ownerid.ToString()] as Dictionary<string, object>;
                    SendReply(player, string.Format("{0} - {1} - Dead", data["displayName"].ToString(), ownerid.ToString()));
                    return;
                }
            }
            SendReply(player, string.Format("{0} - {1} - Dead", "Unknown Player", ownerid.ToString()));
        }
Exemplo n.º 13
0
 void LoadData()
 {
     Data = Interface.GetMod().DataFileSystem.GetDatafile("SleeperLog");
 }
Exemplo n.º 14
0
 void LoadData()
 {
     Data = Interface.GetMod().DataFileSystem.GetDatafile("PlayerInfo");
 }
Exemplo n.º 15
0
 void OnServerInitialized()
 {
     ReverseData = Interface.GetMod().DataFileSystem.GetDatafile("BuildingOwners");
     serverInitialized = true;
     ReverseTable();
 }
Exemplo n.º 16
0
        void cmdChatCopy(BasePlayer player, string command, string[] args)
        {
            if (!hasAccess(player))
            {
                return;
            }

            if (args == null || args.Length == 0)
            {
                SendReply(player, "You need to set the name of the copy file: /copy NAME");
                return;
            }

            // Get player camera view directly from the player
            if (!TryGetPlayerView(player, out currentRot))
            {
                SendReply(player, "Couldn\'t find your eyes");
                return;
            }

            // Get what the player is looking at
            if (!TryGetClosestRayPoint(player.transform.position, currentRot, out closestEnt, out closestHitpoint))
            {
                SendReply(player, "Couldn\'t find any Entity");
                return;
            }

            // Check if what the player is looking at is a collider
            var baseentity = closestEnt as Collider;

            if (baseentity == null)
            {
                SendReply(player, "You are not looking at a Structure, or something is blocking the view.");
                return;
            }

            // Check if what the player is looking at is a BuildingBlock (like a wall or something like that)
            var buildingblock = baseentity.GetComponentInParent <BuildingBlock>();

            if (buildingblock == null)
            {
                SendReply(player, "You are not looking at a Structure, or something is blocking the view.");
                return;
            }

            var returncopy = CopyBuilding(player.transform.position, currentRot.ToEulerAngles().y, buildingblock, out rawStructure, out rawDeployables, out rawSpawnables);

            if (returncopy is string)
            {
                SendReply(player, (string)returncopy);
                return;
            }

            if (rawStructure.Count == 0)
            {
                SendReply(player, "Something went wrong, house is empty?");
                return;
            }

            Dictionary <string, object> defaultValues = new Dictionary <string, object>();

            Dictionary <string, object> defaultPos = new Dictionary <string, object>();

            defaultPos.Add("x", buildingblock.transform.position.x);
            defaultPos.Add("y", buildingblock.transform.position.y);
            defaultPos.Add("z", buildingblock.transform.position.z);
            defaultValues.Add("position", defaultPos);
            defaultValues.Add("yrotation", buildingblock.transform.rotation.ToEulerAngles().y);

            filename = string.Format("copypaste-{0}", args[0].ToString());
            Core.Configuration.DynamicConfigFile CopyData = Interface.GetMod().DataFileSystem.GetDatafile(filename);
            CopyData.Clear();
            CopyData["structure"]   = rawStructure;
            CopyData["deployables"] = rawDeployables;
            CopyData["spawnables"]  = rawSpawnables;
            CopyData["default"]     = defaultValues;


            Interface.GetMod().DataFileSystem.SaveDatafile(filename);

            SendReply(player, string.Format("The house {0} was successfully saved", args[0].ToString()));
            SendReply(player, string.Format("{0} building parts detected", rawStructure.Count.ToString()));
            SendReply(player, string.Format("{0} deployables detected", rawDeployables.Count.ToString()));
            SendReply(player, string.Format("{0} spawnables detected", rawSpawnables.Count.ToString()));
        }
Exemplo n.º 17
0
        void fetchConfigs()
        {
            eventData = Interface.GetMod().DataFileSystem.GetDatafile("SkyEvent");

            eventData["timer", "lobby"] = 30f;
            eventData["timer", "lobby-end"] = 2f;

            eventData["timer", "tick-timer"] = 1f;
            eventData["timer", "tick-count"] = 8;

            if (eventData["players", "min"] == null)
            {
                eventData["players", "min"] = 5;
            }
        }
Exemplo n.º 18
0
 void LoadData()
 {
     Data = Interface.GetMod().DataFileSystem.GetDatafile("Bbr(pl)"); Info = Interface.GetMod().DataFileSystem.GetDatafile("Bbr(House.pl)");
 }
Exemplo n.º 19
0
 private void InitializeKits()
 {
     KitsConfig = Interface.GetMod().DataFileSystem.GetDatafile("Kits_List");
     KitsData = Interface.GetMod().DataFileSystem.GetDatafile("Kits_Data");
 }
Exemplo n.º 20
0
 private void InitializeKits()
 {
     KitsConfig = Interface.GetMod().DataFileSystem.GetDatafile("Kits_List");
     KitsData   = Interface.GetMod().DataFileSystem.GetDatafile("Kits_Data");
 }
Exemplo n.º 21
0
 void LoadData()
 {
     Data = Interface.GetMod().DataFileSystem.GetDatafile("Blacklist(ip)"); Info = Interface.GetMod().DataFileSystem.GetDatafile("Blacklist(ip.pl)"); Wl = Interface.GetMod().DataFileSystem.GetDatafile("Blacklist(ip.wl)");
 }
Exemplo n.º 22
0
 void OnServerInitialized()
 {
     ReverseData       = Interface.GetMod().DataFileSystem.GetDatafile("BuildingOwners");
     serverInitialized = true;
     ReverseTable();
 }
Exemplo n.º 23
0
        /////////////////////////////
        // Data Management
        /////////////////////////////

        void LoadData()
        {
            Data = Interface.GetMod().DataFileSystem.GetDatafile("AdminTeleportation");
        }
Exemplo n.º 24
0
 void LoadData()
 {
     Data = Interface.GetMod().DataFileSystem.GetDatafile("ShareDatabase");
 }
Exemplo n.º 25
0
 void LoadData()
 {
     Data = Interface.GetMod().DataFileSystem.GetDatafile("Blacklist(vpn)"); Info = Interface.GetMod().DataFileSystem.GetDatafile("Blacklist(vpn.pl)");    Wl = Interface.GetMod().DataFileSystem.GetDatafile("whitelist(vpn)");
 }