Example #1
0
        public static void enterCave(Player p)
        {
            AreaEvent enterCaveAreaEvent = new AreaEvent(p, 2438, 5168, 2439, 5168);
            enterCaveAreaEvent.setAction(() => {
                /*
                 * Fight cave is 20k squares from the original place, then another (200 * playerIndex) squares west.
                 */
                Location instanceLocation = new Location((20000 + 2413) + (200 * p.getIndex()), 20000 + 5116, 0);
                p.teleport(instanceLocation);
                p.setFightCave(new FightCaveSession(p));

                Event caveNpcEvent = new Event(600);
                caveNpcEvent.setAction(() => {
                        caveNpcEvent.stop();
                        p.getPackets().sendNPCHead(2617, 242, 1);
                        p.getPackets().modifyText("TzHaar-Mej-Jal", 242, 3);
                        p.getPackets().modifyText("You're on your own now, JalYt.", 242, 4);
                        p.getPackets().modifyText("Pepare to fight for your life!", 242, 5);
                        p.getPackets().animateInterface(9827, 242, 1);
                        p.getPackets().sendChatboxInterface2(242);
                });
                Server.registerEvent(caveNpcEvent);
            });
            Server.registerCoordinateEvent(enterCaveAreaEvent);
        }
Example #2
0
        public void execute(Player player, string[] arguments)
        {
            if (arguments.Length < 2)
            {
                player.getPackets().sendMessage("[Teleport command]: ::tele x y or even ::tele x y z");
                return;
            }
            int x,y,z = 0;
            if (!int.TryParse(arguments[0], out x) || !int.TryParse(arguments[1], out y))
            {
                player.getPackets().sendMessage("Bad x,y coordinate, teleporting home, You entered:[x=" + arguments[0] + ", y=" + arguments[1] + "]");
                player.teleport(Constants.HOME_SPAWN_LOCATION);
                return;
            }
            if (arguments.Length >= 3)
                int.TryParse(arguments[2], out z);

            player.teleport(new Location(x, y, z));
        }
Example #3
0
 /*
  * The config to remove roofs is 1270
  * The door is 6713
  *
  * Random door configs
  * CONFIG = 452    0
    CONFIG = 452    32
    CONFIG = 452    96
    CONFIG = 452    16480
    CONFIG = 452    278624
    CONFIG = 452    802912
    CONFIG = 452    2900064
    CONFIG = 452    2637920
    CONFIG = 452    2638944
    CONFIG = 452    2640992
    CONFIG = 452    2645088
    CONFIG = 452    2653280
    CONFIG = 452    2649184
  */
 public static bool enterCrypt(Player p)
 {
     for (int i = 0; i < MOUND_COORDS.Length; i++) {
         for (int j = 0; j < MOUND_COORDS[i].Length; j++) {
             if (p.getLocation().inArea(MOUND_COORDS[i][0], MOUND_COORDS[i][1], MOUND_COORDS[i][2], MOUND_COORDS[i][3]) && p.getLocation().getZ() == 0)
             {
                 p.teleport(new Location(STAIR_COORDS[i][0], STAIR_COORDS[i][1], 3));
                 if (p.getBarrowTunnel() == -1) {
                     p.setBarrowTunnel(misc.random(5));
                 }
                 return true;
             }
         }
     }
     return false;
 }
Example #4
0
        public void execute(Player player, string[] arguments)
        {
            if (arguments.Length == 0)
            {
                player.getPackets().sendMessage("[Height command]: ::height 0 [0,1,2,3] are possible");
                return;
            }

            int heightLevel = 0;
            if (!int.TryParse(arguments[0], out heightLevel))
            {
                player.getPackets().sendMessage("[Height command]: ::height 0 [0,1,2,3] are possible");
                return;
            }

            player.teleport(new Location(player.getLocation().getX(), player.getLocation().getY(), heightLevel));
        }
Example #5
0
 private static void travel(Player p, int index, bool returning)
 {
     p.setTemporaryAttribute("unmovable", true);
     p.getPackets().displayInterface(120);
     if (returning) {
         p.getPackets().sendMessage("You sail off back to Oo'glog..");
     } else {
         p.getPackets().sendMessage("You climb aboard Captain Bentley's boat and set sail to " + DESTINATION_NAMES[index] + ".");
     }
     Event travelEvent = new Event(2000);
     int travelCounter = 0;
     travelEvent.setAction(() => {
         if (travelCounter == 0)
         {
             travelCounter++;
             travelEvent.setTick(600);
             if (returning) {
                 p.teleport(new Location(2622, 2857, 0));
             } else {
                 p.teleport(new Location(LOCATIONS[index][0], LOCATIONS[index][1], LOCATIONS[index][2]));
             }
         } else {
             travelEvent.stop();
             p.getPackets().sendOverlay(170);
             p.removeTemporaryAttribute("unmovable");
             p.getPackets().sendMessage(returning ? "The boat arrives back in Oo'glog." : DESTINATION_MESSAGES[index]);
             p.getPackets().closeInterfaces();
             Event removeOverlayEvent = new Event(2000);
             removeOverlayEvent.setAction(() => {
                 removeOverlayEvent.stop();
                 p.getPackets().sendRemoveOverlay();
                 if (index == 1) {
                     p.removeTemporaryAttribute("snowInterface");
                 }
             });
             Server.registerEvent(removeOverlayEvent);
         }
     });
     Server.registerEvent(travelEvent);
 }
Example #6
0
 public static void verifyEnterTunnel(Player p)
 {
     p.getPackets().closeInterfaces();
     if (p.getTemporaryAttribute("barrowTunnel") != null) {
         if ((int) p.getTemporaryAttribute("barrowTunnel") == 2) {
             p.teleport(new Location(3568, 9712, 0));
             p.removeTemporaryAttribute("barrowTunnel");
             return;
         }
     }
     p.getPackets().sendChatboxInterface(228);
     p.getPackets().modifyText("Yeah, I'm fearless!", 228, 2);
     p.getPackets().modifyText("No way, that looks scary!", 228, 3);
     p.setTemporaryAttribute("barrowTunnel", 2);
 }
Example #7
0
 public void execute(Player player, string[] arguments)
 {
     player.teleport(new Location(player.getLocation().getX(), player.getLocation().getY() + 6400, 0));
 }
Example #8
0
 public static void teleportDuelArenaHome(Player player)
 {
     player.teleport(new Location(3360 + misc.random(19), 3274 + misc.random(3), 0));
 }
Example #9
0
        public static void showAliDialogue(Player p, int status)
        {
            int newStatus = -1;
            p.getPackets().softCloseInterfaces();
            if (p.getTemporaryAttribute("unmovable") != null) {
                return;
            }
            switch(status) {
                case 205:
                    p.getPackets().sendNPCHead(1862, 241, 2);
                    p.getPackets().modifyText("Ali Morissane", 241, 3);
                    p.getPackets().modifyText("Would you like to go back to Lletya?", 241, 4);
                    p.getPackets().animateInterface(9827, 241, 2);
                    p.getPackets().sendChatboxInterface2(241);
                    newStatus = 206;
                    break;

                case 206:
                    p.getPackets().sendChatboxInterface2(228);
                    p.getPackets().modifyText("Yes please, let's go", 228, 2);
                    p.getPackets().modifyText("Not yet", 228, 3);
                    newStatus = 207;
                    break;

                case 207:
                    p.getPackets().sendPlayerHead(64, 2);
                    p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3);
                    p.getPackets().modifyText("Yes please, let's go.", 64, 4);
                    p.getPackets().animateInterface(9827, 64, 2);
                    p.getPackets().sendChatboxInterface2(64);
                    newStatus = 208;
                    break;

                case 208:
                    p.getPackets().sendNPCHead(1862, 241, 2);
                    p.getPackets().modifyText("Ali Morissane", 241, 3);
                    p.getPackets().modifyText("Very well.", 241, 4);
                    p.getPackets().animateInterface(9827, 241, 2);
                    p.getPackets().sendChatboxInterface2(241);
                    newStatus = 209;
                    break;

                case 209:
                    p.setTemporaryAttribute("unmovable", true);
                    p.getPackets().displayInterface(120);
                    p.getPackets().sendMessage("Your camel trots off slowly out of the desert..");
                    Event moveBackToLletyaEvent = new Event(2000);
                    int moveBackToLletyaCounter = 0;
                    moveBackToLletyaEvent.setAction(() => {
                        if (moveBackToLletyaCounter == 0)
                        {
                            moveBackToLletyaCounter++;
                            moveBackToLletyaEvent.setTick(600);
                            p.teleport(new Location(2340, 3799, 0));
                        } else {
                            moveBackToLletyaEvent.stop();
                            p.removeTemporaryAttribute("unmovable");
                            p.getPackets().sendMessage("..You and Ali are back in Lletya.");
                            p.getPackets().closeInterfaces();
                        }
                    });
                    Server.registerEvent(moveBackToLletyaEvent);
                    break;

                case 210:
                    p.getPackets().sendPlayerHead(64, 2);
                    p.getPackets().modifyText(p.getLoginDetails().getUsername(), 64, 3);
                    p.getPackets().modifyText("Not yet.", 64, 4);
                    p.getPackets().animateInterface(9827, 64, 2);
                    p.getPackets().sendChatboxInterface2(64);
                    newStatus = 211;
                    break;

                case 211:
                    p.getPackets().sendNPCHead(1862, 241, 2);
                    p.getPackets().modifyText("Ali Morissane", 241, 3);
                    p.getPackets().modifyText("No problem, I will be here when you decide to leave.", 241, 4);
                    p.getPackets().animateInterface(9827, 241, 2);
                    p.getPackets().sendChatboxInterface2(241);
                    break;

            }
            if (newStatus != -1) {
                p.setTemporaryAttribute("dialogue", newStatus);
            }
        }
Example #10
0
 public static void useLever(Player p, int id, Location leverLocation)
 {
     if (p.getTemporaryAttribute("teleporting") != null)
     {
         return;
     }
     foreach (LoadedLaddersAndStairs.Lever lever in LoadedLaddersAndStairs.levers)
     {
         if (lever.getId() == id)
         {
             if (lever.getLeverLocation().Equals(leverLocation))
             {
                 LoadedLaddersAndStairs.Lever l = lever;
                 //TODO when in use it cant be used (in use = lever is facing down)
                 CoordinateEvent useLeverCoordinateEvent = new CoordinateEvent(p, l.getLeverLocation());
                 useLeverCoordinateEvent.setAction(() =>
                 {
                     p.setFaceLocation(l.getFaceLocation());
                     if (p.getTemporaryAttribute("teleblocked") != null)
                     {
                         p.getPackets().sendMessage("A magical force prevents you from teleporting!");
                         return;
                     }
                     else if ((p.getTemporaryAttribute("teleporting") != null))
                     {
                         return;
                     }
                     p.setLastAnimation(new Animation(2140));
                     p.getPackets().closeInterfaces();
                     p.setTemporaryAttribute("teleporting", true);
                     p.getWalkingQueue().resetWalkingQueue();
                     p.getPackets().clearMapFlag();
                     SkillHandler.resetAllSkills(p);
                     l.setInUse(true);
                     Event useLeverEvent = new Event(700);
                     useLeverEvent.setAction(() =>
                     {
                         useLeverEvent.stop();
                         p.setLastAnimation(new Animation(8939, 0));
                         p.setLastGraphics(new Graphics(1576, 0));
                         l.setInUse(false);
                         Event setLeverTeleportEvent = new Event(1800);
                         setLeverTeleportEvent.setAction(() =>
                         {
                             setLeverTeleportEvent.stop();
                             p.teleport(l.getTeleLocation());
                             p.setLastAnimation(new Animation(8941, 0));
                             p.setLastGraphics(new Graphics(1577, 0));
                             Teleport.resetTeleport(p);
                         });
                         Server.registerEvent(setLeverTeleportEvent);
                     });
                     Server.registerEvent(useLeverEvent);
                 });
                 Server.registerCoordinateEvent(useLeverCoordinateEvent);
                 break;
             }
         }
     }
 }
Example #11
0
 public static void teleport(Player p, LoadedLaddersAndStairs.HeightObject obj)
 {
     p.getWalkingQueue().resetWalkingQueue();
     p.setTemporaryAttribute("unmovable", true);
     p.setFaceLocation(obj.getLocation());
     if (obj.getAnimation() != -1)
     {
         p.setLastAnimation(new Animation(obj.getAnimation()));
     }
     Event teleportEvent = new Event(obj.getAnimation() != -1 ? obj.getTeleDelay() : 500);
     teleportEvent.setAction(() =>
     {
         teleportEvent.stop();
         p.teleport(obj.getTeleLocation());
         p.removeTemporaryAttribute("unmovable");
     });
     Server.registerEvent(teleportEvent);
 }