当前位置: 首页>>代码示例>>C#>>正文


C# Player.teleport方法代码示例

本文整理汇总了C#中Player.teleport方法的典型用法代码示例。如果您正苦于以下问题:C# Player.teleport方法的具体用法?C# Player.teleport怎么用?C# Player.teleport使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Player的用法示例。


在下文中一共展示了Player.teleport方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: enterAltar

 public static void enterAltar(Player p, int i)
 {
     if (i == 13) {
         return;
     }
     if (i == 12) {
         p.getPackets().sendMessage("This altar is currently unavailable due to mapdata issues.");
         return;
     }
     p.teleport(new Location(RUIN_TELEPORT[i][0], RUIN_TELEPORT[i][1], 0));
 }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:11,代码来源:RuneCraft.cs

示例2: enterRift

 public static bool enterRift(Player p, int objectId, int x, int y)
 {
     for (int i = 0; i < ABYSS_DOORWAYS.Length; i++) {
         if (objectId == ABYSS_DOORWAYS[i]) {
             if (i == 13) {
                 return true;
             }
             int j = i;
             CoordinateEvent enterRiftCoordinateEvent = new CoordinateEvent(p, new Location(x, y, 0));
             enterRiftCoordinateEvent.setAction(() => {
                 if (j == 12) {
                     p.getPackets().sendMessage("This altar is currently unavailable due to mapdata issues.");
                     return;
                 }
                 p.teleport(new Location(ALTAR_COORDS[j][0], (ALTAR_COORDS[j][1] + 3), 0));
                 faceAltar(p, j);
             });
             Server.registerCoordinateEvent(enterRiftCoordinateEvent);
             return true;
         }
     }
     return false;
 }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:23,代码来源:RuneCraft.cs

示例3: teleportPastObstacle

 private static void teleportPastObstacle(Player p)
 {
     p.teleport(RuneCraft.teleportInner());
 }
开发者ID:slapglif,项目名称:runescape-server-csharp,代码行数:4,代码来源:AbyssObstacles.cs

示例4: doCourse

        public static void doCourse(Player p, int objectX, int objectY, object[] objectArray)
        {
            if (p.getTemporaryAttribute("unmovable") != null)
            {
                return;
            }
            int agilityStage = (int)(p.getTemporaryAttribute("agilityStage") == null ? 0 : p.getTemporaryAttribute("agilityStage"));
            switch ((int)objectArray[0])
            {
                case 2295: // Log
                    CoordinateEvent doLogCoordinateEvent = new CoordinateEvent(p, new Location((int)objectArray[3], (int)objectArray[4], 0));
                    doLogCoordinateEvent.setAction(() =>
                    {
                        shoutNPCs[0].setForceText(SHOUT_MESSAGES[0]);
                        p.getPackets().sendMessage("You walk carefully across the slippery log...");
                        bool running = p.getWalkingQueue().isRunToggled();
                        p.getWalkingQueue().setRunToggled(false);
                        p.getWalkingQueue().resetWalkingQueue();
                        p.getPackets().clearMapFlag();
                        p.setTemporaryAttribute("unmovable", true);
                        p.getAppearance().setWalkAnimation(155);
                        p.getUpdateFlags().setAppearanceUpdateRequired(true);
                        p.getWalkingQueue().forceWalk(0, -7);
                        Event doLogEvent = new Event(4300);
                        doLogEvent.setAction(() =>
                        {
                            doLogEvent.stop();
                            p.getPackets().sendMessage("...and make it safely to the other side.");
                            p.removeTemporaryAttribute("unmovable");
                            p.getAppearance().setWalkAnimation(-1);
                            p.getUpdateFlags().setAppearanceUpdateRequired(true);
                            p.getSkills().addXp(Skills.SKILL.AGILITY, (double)objectArray[7]);
                            p.getWalkingQueue().setRunToggled(running);
                        });
                        Server.registerEvent(doLogEvent);
                    });
                    Server.registerCoordinateEvent(doLogCoordinateEvent);
                    break;

                case 2285: // Net #1
                    AreaEvent doNetOneAreaEvent = new AreaEvent(p, 2471, 3426, 2476, 3426);
                    doNetOneAreaEvent.setAction(() =>
                    {
                        shoutNPCs[1].setForceText(SHOUT_MESSAGES[1]);
                        p.getPackets().sendMessage("You climb the netting...");
                        p.setLastAnimation(new Animation(828));
                        p.getWalkingQueue().resetWalkingQueue();
                        p.getPackets().clearMapFlag();
                        p.setFaceLocation(new Location(p.getLocation().getX(), p.getLocation().getY() - 1, 0));
                        p.setTemporaryAttribute("unmovable", true);
                        Event doNetOneEvent = new Event(1000);
                        doNetOneEvent.setAction(() =>
                        {
                            doNetOneEvent.stop();
                            p.removeTemporaryAttribute("unmovable");
                            p.teleport(new Location(2473, p.getLocation().getY() - 2, 1));
                            p.getSkills().addXp(Skills.SKILL.AGILITY, (double)objectArray[7]);
                        });
                        Server.registerEvent(doNetOneEvent);
                    });
                    Server.registerCoordinateEvent(doNetOneAreaEvent);
                    break;

                case 35970: // Tree climb
                    AreaEvent treeClimbAreaEvent = new AreaEvent(p, 2472, 3422, 2474, 3423);
                    treeClimbAreaEvent.setAction(() =>
                    {
                        shoutNPCs[2].setForceText(SHOUT_MESSAGES[2]);
                        p.getPackets().sendMessage("You climb the tree...");
                        p.setLastAnimation(new Animation(828));
                        p.getWalkingQueue().resetWalkingQueue();
                        p.getPackets().clearMapFlag();
                        p.setFaceLocation(new Location(2473, 3422, 1));
                        p.setTemporaryAttribute("unmovable", true);
                        Event treeClimbEvent = new Event(1000);
                        treeClimbEvent.setAction(() =>
                        {
                            treeClimbEvent.stop();
                            p.getPackets().sendMessage("...to the platform above.");
                            p.removeTemporaryAttribute("unmovable");
                            p.teleport(new Location(2473, 3420, 2));
                            p.getSkills().addXp(Skills.SKILL.AGILITY, (double)objectArray[7]);
                        });
                        Server.registerEvent(treeClimbEvent);
                    });
                    Server.registerCoordinateEvent(treeClimbAreaEvent);
                    break;

                case 2312: // Rope balance
                    CoordinateEvent ropeBalanceCoordinateEvent = new CoordinateEvent(p, new Location((int)objectArray[3], (int)objectArray[4], 2));
                    ropeBalanceCoordinateEvent.setAction(() =>
                    {
                        shoutNPCs[3].setForceText(SHOUT_MESSAGES[3]);
                        p.getPackets().sendMessage("You carefully cross the tightrope.");
                        bool running = p.getWalkingQueue().isRunToggled();
                        p.getWalkingQueue().setRunToggled(false);
                        p.getWalkingQueue().resetWalkingQueue();
                        p.getPackets().clearMapFlag();
                        p.setTemporaryAttribute("unmovable", true);
                        p.getAppearance().setWalkAnimation(155);
//.........这里部分代码省略.........
开发者ID:ramatronics,项目名称:rsps,代码行数:101,代码来源:GnomeCourse.cs

示例5: teleportToPatch

        public static void teleportToPatch(Player p, int option)
        {
            p.setTemporaryAttribute("unmovable", true);
            p.getWalkingQueue().resetWalkingQueue();
            p.getPackets().softCloseInterfaces();
            p.getPackets().displayInterface(120);

            Event teleportToPatchEvent = new Event(2000);
            int teleportToPatchCounter = 0;
            teleportToPatchEvent.setAction(() =>
            {
                if (teleportToPatchCounter == 0)
                {
                    teleportToPatchCounter++;
                    teleportToPatchEvent.setTick(600);
                    p.teleport(new Location((int)PATCHES[option][0] + Misc.random((int)PATCHES[option][2]), (int)PATCHES[option][1] + Misc.random((int)PATCHES[option][3]), 0));
                }
                else
                {
                    teleportToPatchEvent.stop();
                    p.removeTemporaryAttribute("unmovable");
                    p.getPackets().sendMessage("You are teleported to the " + PATCHES[option][4] + ".");
                    p.getPackets().closeInterfaces();
                }
            });
        }
开发者ID:ramatronics,项目名称:rsps,代码行数:26,代码来源:FarmingAmulet.cs

示例6: doCourse

        public static void doCourse(Player p, int objectX, int objectY, object[] objectArray)
        {
            if (p.getTemporaryAttribute("unmovable") != null) {
                return;
            }
            switch((int)objectArray[0]) {
                case 2309: //Entrance log
                    CoordinateEvent startEntranceLogCoordinateEvent = new CoordinateEvent(p, new Location((int)objectArray[1], (int)objectArray[2], 0));
                    startEntranceLogCoordinateEvent.setAction(() => {
                        bool running = p.getWalkingQueue().isRunToggled();
                        Event comeToLogEvent = new Event(500);
                        comeToLogEvent.setAction(() => {
                            p.getWalkingQueue().setRunToggled(false);
                            p.getWalkingQueue().resetWalkingQueue();
                            p.getPackets().clearMapFlag();
                            p.setTemporaryAttribute("unmovable", true);
                            p.getWalkingQueue().forceWalk(0, 1); //go past gate, no animation yet.
                            comeToLogEvent.stop();
                        });
                        Server.registerEvent(comeToLogEvent);
                        int doLogWalkCounter = 0;
                        Event doLogWalkEvent = new Event(800);
                        doLogWalkEvent.setAction(() => {
                            if (doLogWalkCounter == 0) { //start the animation
                                p.getAppearance().setWalkAnimation(155);
                                p.getUpdateFlags().setAppearanceUpdateRequired(true);
                                doLogWalkEvent.setTick(500); //500 milliseconds required to make animations realistic.
                            } else if(doLogWalkCounter < 16) { //15 steps foward, 1 step is just quickfix TODO: Add gate opener.
                                p.getWalkingQueue().forceWalk(0, 1);
                            } else if(doLogWalkCounter == 17) { //stop the animation add the xp.
                                doLogWalkEvent.stop();
                                p.getAppearance().setWalkAnimation(-1);
                                p.getUpdateFlags().setAppearanceUpdateRequired(true);
                                p.removeTemporaryAttribute("unmovable");
                                p.getSkills().addXp(Skills.SKILL.AGILITY, (double)objectArray[7]);
                                p.getWalkingQueue().setRunToggled(running);
                            }
                            doLogWalkCounter++;
                        });
                        Server.registerEvent(doLogWalkEvent);
                    });
                    Server.registerCoordinateEvent(startEntranceLogCoordinateEvent);
                    break;
                case 2288: // Tunnel
                    AreaEvent startTunnelAreaEvent = new AreaEvent(p, 3003, 3937, 3005, 3938);
                    startTunnelAreaEvent.setAction(() => {
                        int newMove = 0;
                        int pX = p.getLocation().getX();
                        int pY = p.getLocation().getY();
                        if (pX == objectX + 1 && pY == objectY) // right side
                            newMove = 1;
                        else if (pX == objectX - 1 && pY == objectY) // left side
                            newMove = 2;
                        if (newMove > 0) {
                            int walkTunnelCounter = 0;
                            Event walkTunnelEvent = new Event(500);
                            walkTunnelEvent.setAction(() => {
                                if (walkTunnelCounter == 0) {
                                    p.getWalkingQueue().forceWalk(0, -1);
                                } else if (walkTunnelCounter == 1) {
                                    p.getWalkingQueue().forceWalk(newMove == 1 ? -1 : +1, 0);
                                } else {
                                    doCourse(p, objectX, objectY, objectArray);
                                    walkTunnelEvent.stop();
                                }
                                walkTunnelCounter++;
                            });
                            Server.registerEvent(walkTunnelEvent);
                            return;
                        }
                        Event squeezeIntoPipeEvent = new Event(0);
                        squeezeIntoPipeEvent.setAction(() => {
                            squeezeIntoPipeEvent.stop();
                            p.getPackets().sendMessage("You squeeze into the pipe...");
                            int regionX = p.getUpdateFlags().getLastRegion().getRegionX();
                            int regionY = p.getUpdateFlags().getLastRegion().getRegionY();
                            int lX = (p.getLocation().getX() - ((regionX - 6) * 8));
                            int lY = (p.getLocation().getY() - ((regionY - 6) * 8));
                            p.setForceMovement(new ForceMovement(lX, lY, lX, lY + 3, 10, 60, 0));
                            p.setFaceLocation(new Location(p.getLocation().getX(), p.getLocation().getY() + 1, 0));
                            p.setLastAnimation(new Animation(10578));
                            bool running = p.getWalkingQueue().isRunToggled();
                            p.getWalkingQueue().setRunToggled(false);
                            p.getWalkingQueue().resetWalkingQueue();
                            p.getPackets().clearMapFlag();
                            p.setTemporaryAttribute("unmovable", true);
                            Event squeezeOutOfPipeEvent = new Event(1000);
                            int squeezeOutOfPipeCounter = 0;
                            squeezeOutOfPipeEvent.setAction(() => {
                                if (squeezeOutOfPipeCounter == 0) {
                                    p.teleport(new Location(p.getLocation().getX(), p.getLocation().getY() + 9, 0));
                                    squeezeOutOfPipeEvent.setTick(850);
                                } else if (squeezeOutOfPipeCounter == 1) {
                                    ForceMovement movement = new ForceMovement(lX, lY + 9, lX, lY + 12, 10, 90, 0);
                                    p.setForceMovement(movement);
                                    squeezeOutOfPipeEvent.setTick(1100);
                                } else if (squeezeOutOfPipeCounter == 2) {
                                    squeezeOutOfPipeEvent.setTick(500);
                                    p.setLastAnimation(new Animation(10579));
                                    p.setForceMovement(new ForceMovement(lX, lY + 12, lX, lY + 13, 10, 40, 0));
//.........这里部分代码省略.........
开发者ID:Krill156,项目名称:SharpEMU,代码行数:101,代码来源:WildernessCourse.cs

示例7: homeTeleport

        public static void homeTeleport(Player p)
        {
            if (p.getTemporaryAttribute("teleporting") != null || p.getTemporaryAttribute("homeTeleporting") != null || p.getTemporaryAttribute("unmovable") != null || p.getTemporaryAttribute("cantDoAnything") != null)
            {
                return;
            }
            if (Location.inFightPits(p.getLocation()))
            {
                p.getPackets().sendMessage("You are unable to teleport from the fight pits.");
                return;
            }
            if (Location.inFightCave(p.getLocation()))
            {
                FightCave.antiTeleportMessage(p);
                return;
            }
            if (p.getTemporaryAttribute("teleblocked") != null)
            {
                p.getPackets().sendMessage("A magical force prevents you from teleporting!");
                return;
            }
            if (Location.inWilderness(p.getLocation()) && p.getLocation().wildernessLevel() >= 20)
            {
                p.getPackets().sendMessage("You cannot teleport above level 20 wilderness!");
                return;
            }
            if (p.getDuel() != null)
            {
                if (p.getDuel().getStatus() < 4)
                {
                    p.getDuel().declineDuel();
                }
                else if (p.getDuel().getStatus() == 5)
                {
                    p.getPackets().sendMessage("You cannot teleport whilst in a duel.");
                    return;
                }
                else if (p.getDuel().getStatus() == 8)
                {
                    if (p.getDuel().getWinner().Equals(p))
                    {
                        p.getDuel().recieveWinnings(p);
                    }
                }
            }
            p.getPackets().closeInterfaces();
            p.setTemporaryAttribute("teleporting", true);
            p.setTemporaryAttribute("homeTeleporting", true);
            p.getWalkingQueue().resetWalkingQueue();
            p.getPackets().clearMapFlag();
            SkillHandler.resetAllSkills(p);

            Event teleportHomeAnimationEvent = new Event(500);
            int currentStage = 0;
            teleportHomeAnimationEvent.setAction(() =>
            {
                if (p.getTemporaryAttribute("homeTeleporting") == null)
                {
                    p.setLastAnimation(new Animation(65535, 0));
                    p.setLastGraphics(new Graphics(65535, 0));
                    resetTeleport(p);
                    teleportHomeAnimationEvent.stop();
                    return;
                }
                if (currentStage++ >= 16)
                {
                    resetTeleport(p);
                    p.teleport(new Location(HOME_TELE[0] + Misc.random(HOME_TELE[2]), HOME_TELE[1] + Misc.random(HOME_TELE[3]), 0));
                    teleportHomeAnimationEvent.stop();
                    return;
                }
                p.setLastAnimation(new Animation(HOME_ANIMATIONS[currentStage], 0));
                p.setLastGraphics(new Graphics(HOME_GRAPHICS[currentStage], 0));
            });
            Server.registerEvent(teleportHomeAnimationEvent);
        }
开发者ID:ramatronics,项目名称:rsps,代码行数:76,代码来源:Teleport.cs

示例8: useTeletab

 public static bool useTeletab(Player p, int item, int slot)
 {
     int index = -1;
     for (int i = 0; i < TELETABS.Length; i++)
     {
         if (item == TELETABS[i])
         {
             index = i;
         }
     }
     if (index == -1)
     {
         return false;
     }
     if (p.getTemporaryAttribute("teleporting") != null || p.getTemporaryAttribute("homeTeleporting") != null || p.getTemporaryAttribute("unmovable") != null || p.getTemporaryAttribute("cantDoAnything") != null)
     {
         return false;
     }
     if (p.getTemporaryAttribute("teleblocked") != null)
     {
         p.getPackets().sendMessage("A magical force prevents you from teleporting!");
         return false;
     }
     if (Location.inFightPits(p.getLocation()))
     {
         p.getPackets().sendMessage("You are unable to teleport from the fight pits.");
         return false;
     }
     if (Location.inFightCave(p.getLocation()))
     {
         FightCave.antiTeleportMessage(p);
         return false;
     }
     if (Location.inWilderness(p.getLocation()) && p.getLocation().wildernessLevel() >= 20)
     {
         p.getPackets().sendMessage("You cannot teleport above level 20 wilderness!");
         return false;
     }
     if (p.getDuel() != null)
     {
         if (p.getDuel().getStatus() < 4)
         {
             p.getDuel().declineDuel();
         }
         else if (p.getDuel().getStatus() == 8)
         {
             if (p.getDuel().getWinner().Equals(p))
             {
                 p.getDuel().recieveWinnings(p);
             }
         }
     }
     int x = TELE_X[index] + Misc.random(TELE_EXTRA_X[index]);
     int y = TELE_Y[index] + Misc.random(TELE_EXTRA_Y[index]);
     p.getPackets().closeInterfaces();
     p.getPackets().sendBlankClientScript(1297);
     p.getWalkingQueue().resetWalkingQueue();
     p.getPackets().clearMapFlag();
     SkillHandler.resetAllSkills(p);
     if (p.getInventory().deleteItem(item, slot, 1))
     {
         p.setTemporaryAttribute("unmovable", true);
         p.setTemporaryAttribute("teleporting", true);
         p.setLastAnimation(new Animation(9597));
         p.setLastGraphics(new Graphics(1680, 0, 0));
         //p.setLastGraphics(new Graphics(678, 0, 0)); // blue gfx
         Event teleportEvent = new Event(900);
         int teleportCounter = 0;
         teleportEvent.setAction(() =>
         {
             if (teleportCounter == 0)
             {
                 p.setLastAnimation(new Animation(4071));
                 teleportCounter++;
             }
             else
             {
                 p.setLastAnimation(new Animation(65535));
                 p.removeTemporaryAttribute("unmovable");
                 p.teleport(new Location(x, y, 0));
                 resetTeleport(p);
                 teleportEvent.stop();
             }
         });
         Server.registerEvent(teleportEvent);
         return true;
     }
     return true;
 }
开发者ID:ramatronics,项目名称:rsps,代码行数:89,代码来源:Teleport.cs

示例9: teleport

 public static void teleport(Player p, int teleport)
 {
     if (!canTeleport(p, teleport))
     {
         //return;
     }
     if (!deleteRunes(p, TELEPORT_RUNES[teleport], TELEPORT_RUNES_AMOUNT[teleport]))
     {
         //	return;
     }
     p.removeTemporaryAttribute("lootedBarrowChest"); // so it resets instantly.
     p.removeTemporaryAttribute("autoCasting");
     p.setTarget(null);
     bool ancients = teleport > 6 ? true : false;
     int playerMagicSet = p.getMagicType();
     bool correctMagicSet = (!ancients && playerMagicSet == 1) || (ancients && playerMagicSet == 2);
     if (!correctMagicSet)
     {
         return;
     }
     int x = TELE_X[teleport] + Misc.random(TELE_EXTRA_X[teleport]);
     int y = TELE_Y[teleport] + Misc.random(TELE_EXTRA_Y[teleport]);
     p.getPackets().closeInterfaces();
     p.setLastAnimation(new Animation(ancients ? 9599 : 8939, 0));
     p.setLastGraphics(new Graphics(ancients ? 1681 : 1576, 0));
     p.getPackets().sendBlankClientScript(1297);
     p.getWalkingQueue().resetWalkingQueue();
     p.getPackets().clearMapFlag();
     SkillHandler.resetAllSkills(p);
     p.setTemporaryAttribute("teleporting", true);
     Event startTeleportEvent = new Event(ancients ? 2750 : 1800);
     startTeleportEvent.setAction(() =>
     {
         p.teleport(new Location(x, y, 0));
         if (!ancients)
         {
             p.setLastAnimation(new Animation(8941, 0));
             p.setLastGraphics(new Graphics(1577, 0));
         }
         Event endTeleportEvent = new Event(ancients ? 500 : 2000);
         endTeleportEvent.setAction(() =>
         {
             p.getSkills().addXp(Skills.SKILL.MAGIC, TELEPORT_XP[teleport]);
             resetTeleport(p);
             endTeleportEvent.stop();
         });
         Server.registerEvent(endTeleportEvent);
         startTeleportEvent.stop();
     });
     Server.registerEvent(startTeleportEvent);
 }
开发者ID:ramatronics,项目名称:rsps,代码行数:51,代码来源:Teleport.cs

示例10: useLadder

 public static void useLadder(Player p)
 {
     CoordinateEvent useLadderCoordinateEvent = new CoordinateEvent(p, new Location(2532, 3546, 1));
     useLadderCoordinateEvent.setAction(() =>
     {
         p.setLastAnimation(new Animation(828));
         p.setTemporaryAttribute("unmovable", true);
         Event useLadderEvent = new Event(1000);
         useLadderEvent.setAction(() =>
         {
             useLadderEvent.stop();
             p.teleport(new Location(p.getLocation().getX(), p.getLocation().getY(), 0));
             p.removeTemporaryAttribute("unmovable");
         });
         Server.registerEvent(useLadderEvent);
     });
     Server.registerCoordinateEvent(useLadderCoordinateEvent);
 }
开发者ID:ramatronics,项目名称:rsps,代码行数:18,代码来源:BarbarianCourse.cs

示例11: doCourse

        public static void doCourse(Player p, int objectX, int objectY, object[] objectArray)
        {
            if (p.getTemporaryAttribute("unmovable") != null)
                return;

            switch ((int)objectArray[0])
            {
                case 20210: // Entrance tunnel
                    AreaEvent entranceTunnelAreaEvent = new AreaEvent(p, 2551, 3558, 2553, 3561);
                    entranceTunnelAreaEvent.setAction(() =>
                    {
                        entranceTunnelAreaEvent.stop();
                        int newMove = 0;
                        int pX = p.getLocation().getX();
                        int pY = p.getLocation().getY();
                        if (pX == objectX + 1 && pY == objectY)
                            newMove = 1;
                        else if (pX == objectX - 1 && pY == objectY)
                            newMove = 2;
                        else if (pX == objectX - 1 && pY == objectY + 1)
                            newMove = 3;
                        else if (pX == objectX + 1 && pY == objectY + 1)
                            newMove = 4;
                        if (newMove > 0)
                        {
                            int path = newMove;
                            int doCourseCounter = 0;
                            Event doCourseEvent = new Event(500);
                            doCourseEvent.setAction(() =>
                            {
                                if (doCourseCounter == 0)
                                {
                                    p.getWalkingQueue().forceWalk(0, (path == 1 || path == 2) ? -1 : (path == 3 || path == 4) ? +1 : 0);
                                }
                                else if (doCourseCounter == 1)
                                {
                                    p.getWalkingQueue().forceWalk((path == 1 || path == 4) ? -1 : (path == 2 || path == 3) ? +1 : 0, 0);
                                }
                                else
                                {
                                    doCourse(p, objectX, objectY, objectArray);
                                    doCourseEvent.stop();
                                }
                                doCourseCounter++;
                            });
                            Server.registerEvent(doCourseEvent);
                            return;
                        }
                        int startEnterTunnelCounter = 0;
                        Event startEnterTunnelEvent = new Event(0);
                        startEnterTunnelEvent.setAction(() =>
                        {
                            if (startEnterTunnelCounter == 0)
                            {
                                p.setFaceLocation(new Location(p.getLocation().getX(), p.getLocation().getY() <= 3558 ? 3561 : 3558, 0));
                                startEnterTunnelEvent.setTick(500);
                                startEnterTunnelCounter++;
                            }
                            else
                            {
                                startEnterTunnelEvent.stop();
                                bool running = p.getWalkingQueue().isRunToggled();
                                int regionX = p.getUpdateFlags().getLastRegion().getRegionX();
                                int regionY = p.getUpdateFlags().getLastRegion().getRegionY();
                                int lX = (p.getLocation().getX() - ((regionX - 6) * 8));
                                int lY = (p.getLocation().getY() - ((regionY - 6) * 8));
                                int newLocalY = p.getLocation().getY() == 3558 ? lY + 3 : lY - 3;
                                int newY = newLocalY > lY ? p.getLocation().getY() + 3 : p.getLocation().getY() - 3;
                                int dir = newLocalY > lY ? 0 : 4;
                                p.setForceMovement(new ForceMovement(lX, lY, lX, newLocalY, 10, 60, dir));
                                p.setLastAnimation(new Animation(10580));
                                p.getWalkingQueue().resetWalkingQueue();
                                p.getPackets().clearMapFlag();
                                p.setTemporaryAttribute("unmovable", true);
                                Event enterTunnelEvent = new Event(1500);
                                enterTunnelEvent.setAction(() =>
                                {
                                    enterTunnelEvent.stop();
                                    p.removeTemporaryAttribute("unmovable");
                                    p.teleport(new Location(p.getLocation().getX(), newY, 0));
                                    p.getSkills().addXp(Skills.SKILL.AGILITY, (double)objectArray[7]);
                                    p.getWalkingQueue().setRunToggled(running);
                                });
                                Server.registerEvent(enterTunnelEvent);
                            }
                        });
                        Server.registerEvent(startEnterTunnelEvent);
                    });
                    Server.registerCoordinateEvent(entranceTunnelAreaEvent);
                    break;

                case 2282: // Swing
                    AreaEvent swingAreaEvent = new AreaEvent(p, 2550, 3554, 2552, 3555);
                    swingAreaEvent.setAction(() =>
                    {
                        int newMove = 0;
                        int pX = p.getLocation().getX();
                        int pY = p.getLocation().getY();
                        if (pX == objectX - 1 && pY == objectY + 4) // front left
                            newMove = 1;
//.........这里部分代码省略.........
开发者ID:ramatronics,项目名称:rsps,代码行数:101,代码来源:BarbarianCourse.cs

示例12: teleportOutOfAltar

 private static void teleportOutOfAltar(Player p, int i)
 {
     int x = RUIN_COORDS[i][0] + 1;
     int y = RUIN_COORDS[i][1] - 1;
     p.teleport(new Location(x, y, 0));
 }
开发者ID:ramatronics,项目名称:rsps,代码行数:6,代码来源:RuneCraft.cs

示例13: teleportToEssMine

 public static void teleportToEssMine(Player p, Npc n)
 {
     if (p.getTemporaryAttribute("unmovable") != null)
     {
         return;
     }
     p.setTemporaryAttribute("unmovable", true);
     n.setLastGraphics(new Graphics(108));
     Event teleportToEssMineEvent = new Event(600);
     teleportToEssMineEvent.setAction(() =>
     {
         int i = 0;
         i++;
         if (i == 1)
         {
             p.setLastGraphics(new Graphics(110));
             n.setForceText("Senventior disthine molenko!");
         }
         else if (i == 2)
         {
             teleportToEssMineEvent.stop();
             Event doTeleportToEssMineEvent = new Event(300);
             doTeleportToEssMineEvent.setAction(() =>
             {
                 p.teleport(getRandomMineLocation());
                 p.removeTemporaryAttribute("unmovable");
                 doTeleportToEssMineEvent.stop();
             });
         }
     });
     Server.registerEvent(teleportToEssMineEvent);
 }
开发者ID:ramatronics,项目名称:rsps,代码行数:32,代码来源:RuneCraft.cs

示例14: leaveEssMine

 public static void leaveEssMine(Player p, Location loc)
 {
     AreaEvent leaveEssMineAreaEvent = new AreaEvent(p, loc.getX() - 1, loc.getY() - 1, loc.getX() + 1, loc.getY() + 1);
     leaveEssMineAreaEvent.setAction(() =>
     {
         p.teleport(new Location(2340 + Misc.random(1), 3155 + Misc.random(1), 0));
     });
     Server.registerCoordinateEvent(leaveEssMineAreaEvent);
 }
开发者ID:ramatronics,项目名称:rsps,代码行数:9,代码来源:RuneCraft.cs


注:本文中的Player.teleport方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。