Ejemplo n.º 1
0
        void cmdRemoveKit(NetUser netuser, string[] args)
        {
            if (args.Length < 2)
            {
                SendReply(netuser, "Kit must specify the name of the kit that you want to remove");
                return;
            }
            int    kitlvl  = 0;
            string kitname = args[1].ToString();

            if (KitsConfig[kitname] == null)
            {
                SendReply(netuser, string.Format("The kit {0} doesn't exist", kitname));
                return;
            }
            var kitdata  = (KitsConfig[kitname]) as Dictionary <string, object>;
            var newKits  = new Dictionary <string, object>();
            var enumkits = KitsConfig.GetEnumerator();

            while (enumkits.MoveNext())
            {
                if (enumkits.Current.Key.ToString() != kitname && enumkits.Current.Value != null)
                {
                    newKits.Add(enumkits.Current.Key.ToString(), enumkits.Current.Value);
                }
            }
            KitsConfig.Clear();
            foreach (KeyValuePair <string, object> pair in newKits)
            {
                KitsConfig[pair.Key] = pair.Value;
            }
            SaveKits();
            SendReply(netuser, string.Format("The kit {0} was successfully removed", kitname));
        }
Ejemplo n.º 2
0
        void cmdChatTeleportSave(NetUser netuser, string command, string[] args)
        {
            if (!hasAccess(netuser, "canteleport"))
            {
                SendReply(netuser, notAllowed); return;
            }
            if (args.Length == 0)
            {
                SendReply(netuser, "Saved Teleportation Points:");
                foreach (KeyValuePair <string, object> pair in Data)
                {
                    if (pair.Value != null)
                    {
                        SendReply(netuser, string.Format("{0}", pair.Key));
                    }
                }
                return;
            }
            switch (args[0])
            {
            case "remove":
            case "delete":
            case "rem":
            case "del":
                if (Data[args[1]] == null)
                {
                    SendReply(netuser, "This teleportation location name doesn't exists");
                    return;
                }

                Data[args[1]] = null;
                SendReply(netuser, string.Format("Teleport location {0} was deleted", args[0]));
                SaveData();
                break;

            case "reset":
                Data.Clear();
                SaveData();
                SendReply(netuser, "Teleport locations were reseted");
                break;

            default:
                if (Data[args[0]] != null)
                {
                    SendReply(netuser, "This teleportation location name already exists");
                    return;
                }
                var newsave = new Dictionary <string, object>();
                newsave.Add("x", netuser.playerClient.lastKnownPosition.x.ToString());
                newsave.Add("y", netuser.playerClient.lastKnownPosition.y.ToString());
                newsave.Add("z", netuser.playerClient.lastKnownPosition.z.ToString());
                Data[args[0]] = newsave;
                SendReply(netuser, string.Format("Teleport location \"{0}\" was created on your position", args[0]));
                SaveData();
                break;
            }
        }
Ejemplo n.º 3
0
        void cmdRemoveKit(BasePlayer player, string[] args)
        {
            if (args.Length < 2)
            {
                SendTheReply(player, "Kit must specify the name of the kit that you want to remove");
                return;
            }
            int    authlevel = GetSourceLevel(player);
            int    kitlvl    = 0;
            string kitname   = args[1].ToString();

            if (KitsConfig[kitname] == null)
            {
                SendTheReply(player, string.Format("The kit {0} doesn't exist", kitname));
                return;
            }

            var kitdata = (KitsConfig[kitname]) as Dictionary <string, object>;

            if (kitdata.ContainsKey("level"))
            {
                kitlvl = (int)kitdata["level"];
            }
            if (kitlvl > 2)
            {
                kitlvl = 2;
            }
            if (kitlvl > authlevel)
            {
                SendTheReply(player, "You don't have the level to remove this kit");
                return;
            }
            var newKits  = new Dictionary <string, object>();
            var enumkits = KitsConfig.GetEnumerator();

            while (enumkits.MoveNext())
            {
                if (enumkits.Current.Key.ToString() != kitname && enumkits.Current.Value != null)
                {
                    newKits.Add(enumkits.Current.Key.ToString(), enumkits.Current.Value);
                }
            }
            KitsConfig.Clear();
            foreach (KeyValuePair <string, object> pair in newKits)
            {
                KitsConfig[pair.Key] = pair.Value;
            }
            SaveKits();
            SendTheReply(player, string.Format("The kit {0} was successfully removed", kitname));
        }
Ejemplo n.º 4
0
 void cmdConsoleReset(ConsoleSystem.Arg arg)
 {
     if (arg.argUser != null && !hasPermission(arg.argUser))
     {
         SendReply(arg, noAccess); return;
     }
     ACData.Clear();
     SaveData();
     foreach (PlayerClient player in PlayerClient.All)
     {
         CheckPlayer(player, false);
     }
     SendReply(arg, DataReset);
 }
Ejemplo n.º 5
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();
        }
Ejemplo n.º 6
0
 void cmdResetKits(NetUser netuser, string[] args)
 {
     KitsData.Clear();
     SendReply(netuser, "All kits data from players were deleted");
     SaveKitsData();
 }
Ejemplo n.º 7
0
 void cmdResetKits(BasePlayer player, string[] args)
 {
     KitsData.Clear();
     SendTheReply(player, "All kits data from players were deleted");
     SaveKitsData();
 }
Ejemplo n.º 8
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()));
        }
Ejemplo n.º 9
0
 void ResetData()
 {
     KitsData.Clear();
     SaveKitsData();
 }