Exemplo n.º 1
0
        public static void ToggleDoor(Client player, params object[] arguments)
        {
            // Setup to find our target door.
            DoorInfo targetDoor = null;

            for (int i = 0; i < doors.Count; i++)
            {
                if (doors[i].DoorLocation.DistanceTo2D(player.position) > 5)
                {
                    continue;
                }

                targetDoor = doors[i];
                break;
            }
            // If our target door does not exist. Stop.
            if (targetDoor == null)
            {
                return;
            }

            if (!player.hasData("Instance"))
            {
                return;
            }

            Player instance = player.getData("Instance");

            if (instance.Id != targetDoor.OwnerId)
            {
                return;
            }

            if (targetDoor.Locked)
            {
                targetDoor.Locked = false;
                API.shared.triggerClientEvent(player, "HeadNotification", "~g~Door unlocked.");
            }
            else
            {
                targetDoor.Locked = true;
                API.shared.triggerClientEvent(player, "HeadNotification", "~r~Door locked.");
            }
        }
Exemplo n.º 2
0
        public static void EnterDoor(Client player, params object[] arguments)
        {
            if (arguments.Length <= 0)
            {
                return;
            }

            // Setup to find our target door.
            DoorInfo targetDoor = null;
            string   doorID     = arguments[0].ToString().Replace("Door-", string.Empty);

            // Find our target door.
            for (int i = 0; i < doors.Count; i++)
            {
                if (doors[i].Id.Replace("Door-", string.Empty) != doorID)
                {
                    continue;
                }

                targetDoor = doors[i];
                break;
            }
            // If our target door does not exist. Stop.
            if (targetDoor == null)
            {
                Console.WriteLine("[Door] Not a valid door. " + arguments[0].ToString());
                return;
            }
            // If our target door is locked, don't let the player in.
            if (targetDoor.Locked)
            {
                API.shared.triggerClientEvent(player, "HeadNotification", "~r~This door is locked.");
                return;
            }
            // Load the IPL if it hasn't been loaded today, then teleport them into the interior.
            loadIPL(targetDoor.IPL);
            AnticheatInfo info = player.getData("Anticheat");

            info.LastPosition = targetDoor.InteriorLocation;
            player.setData("LastPosition", player.position);
            player.position  = targetDoor.InteriorLocation;
            player.dimension = targetDoor.CoreId;
        }
Exemplo n.º 3
0
        public static void LoadAllDoors()
        {
            DataTable table = db.executeQueryWithResult("SELECT * FROM Doors");

            if (table.Rows.Count <= 0)
            {
                return;
            }

            int count = 0;

            foreach (DataRow row in table.Rows)
            {
                DoorInfo door = new DoorInfo(row);
                doors.Add(door);
                EventManager.events.Add(new EventInfo($"{door.Id}", "DoorCalls", "EnterInterior"));
                API.shared.consoleOutput($"Door Loaded: {door.Id}");
                count++;
            }

            Console.WriteLine("[Doors] TOTAL COUNT: " + count.ToString());
        }