本文整理匯總了C#中RS2.Server.player.Player.teleport方法的典型用法代碼示例。如果您正苦於以下問題:C# Player.teleport方法的具體用法?C# Player.teleport怎麽用?C# Player.teleport使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類RS2.Server.player.Player
的用法示例。
在下文中一共展示了Player.teleport方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: enterCave
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);
}
示例2: enterTzhaar
public static void enterTzhaar(Player p)
{
AreaEvent enterTzhaarAreaEvent = new AreaEvent(p, 2866, 9570, 2866, 9572);
enterTzhaarAreaEvent.setAction(() =>
{
p.teleport(new Location(2480, 5175, 0));
});
Server.registerCoordinateEvent(enterTzhaarAreaEvent);
}
示例3: exitTzhaar
public static void exitTzhaar(Player p)
{
AreaEvent exitTzhaarAreaEvent = new AreaEvent(p, 2479, 5175, 2481, 5175);
exitTzhaarAreaEvent.setAction(() =>
{
p.teleport(new Location(2866, 9571, 0));
});
Server.registerCoordinateEvent(exitTzhaarAreaEvent);
}
示例4: execute
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));
}
示例5: execute
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));
}
示例6: enterCrypt
/*
* 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;
}
示例7: crossDitch
public static void crossDitch(Player p, int x, int y)
{
if (p.getTemporaryAttribute("unmovable") != null)
{
return;
}
AreaEvent crossDitchAreaEvent = new AreaEvent(p, x, y - 1, x, y + 2);
crossDitchAreaEvent.setAction(() =>
{
p.getPackets().closeInterfaces();
p.getWalkingQueue().resetWalkingQueue();
p.setTemporaryAttribute("unmovable", true);
int newY = p.getLocation().getY() >= 3523 ? p.getLocation().getY() - 3 : p.getLocation().getY() + 3;
int dir = newY == 3 ? 0 : 4;
Location faceLocation = new Location(p.getLocation().getX(), dir == 3 ? 3523 : 3520, 0);
p.setFaceLocation(faceLocation);
Event crossDitchMoveEvent = new Event(500);
crossDitchMoveEvent.setAction(() =>
{
crossDitchMoveEvent.stop();
p.setLastAnimation(new Animation(6132));
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));
ForceMovement movement = new ForceMovement(lX, lY, lX, newY, 33, 60, dir);
p.setForceMovement(movement);
p.setFaceLocation(new Location(x, y, 0));
Event crossDitchTeleportEvent = new Event(1250);
crossDitchTeleportEvent.setAction(() =>
{
crossDitchTeleportEvent.stop();
int playerY = p.getLocation().getY();
int nY = playerY >= 3523 ? 3520 : 3523;
p.teleport(new Location(p.getLocation().getX(), nY, 0));
p.removeTemporaryAttribute("unmovable");
});
Server.registerEvent(crossDitchTeleportEvent);
});
Server.registerEvent(crossDitchMoveEvent);
});
Server.registerCoordinateEvent(crossDitchAreaEvent);
}
示例8: leverTeleport
public static void leverTeleport(Player p, int option)
{
p.getPackets().closeInterfaces();
Location teleLocation = new Location(LEVER_COORDINATES[option][0], LEVER_COORDINATES[option][1], LEVER_COORDINATES[option][2]);
Event leverTeleportEvent = new Event(200);
leverTeleportEvent.setAction(() =>
{
leverTeleportEvent.stop();
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);
Event levelTeleportStartEvent = new Event(700);
levelTeleportStartEvent.setAction(() =>
{
levelTeleportStartEvent.stop();
p.setLastAnimation(new Animation(8939, 0));
p.setLastGraphics(new Graphics(1576, 0));
Event levelTeleportFinishEvent = new Event(1800);
levelTeleportFinishEvent.setAction(() =>
{
levelTeleportFinishEvent.stop();
p.teleport(teleLocation);
p.setLastAnimation(new Animation(8941, 0));
p.setLastGraphics(new Graphics(1577, 0));
Teleport.resetTeleport(p);
});
Server.registerEvent(levelTeleportFinishEvent);
});
Server.registerEvent(levelTeleportStartEvent);
});
Server.registerEvent(leverTeleportEvent);
}
示例9: execute
public void execute(Player player, string[] arguments)
{
player.teleport(new Location(player.getLocation().getX(), player.getLocation().getY() - 6400, 0));
}
示例10: teleport
public static bool teleport(Player p, int opt, JewellerySlot js)
{
if (js == null)
{
return false;
}
if (js.index == -1 || js.index > 3 || opt > 6)
{
return false;
}
if (!canTeleport(p, js))
{
p.getPackets().closeInterfaces();
return true;
}
if ((js.index == 2 && opt == 4) || (js.index != 2 && opt == 6))
{
p.getPackets().sendMessage("You stay where you are.");
p.getPackets().closeInterfaces();
return true;
}
opt -= 2; // Used to get the 'index' from the button id.
p.setLastGraphics(new Graphics(1684));
p.setLastAnimation(new Animation(9603));
p.getWalkingQueue().resetWalkingQueue();
p.getPackets().clearMapFlag();
p.setTemporaryAttribute("teleporting", true);
p.setTemporaryAttribute("unmovable", true);
p.removeTemporaryAttribute("autoCasting");
p.removeTemporaryAttribute("lootedBarrowChest");
p.setTarget(null);
changeJewellery(p, js);
int option = opt;
p.getPackets().closeInterfaces();
Event teleportEvent = new Event(2000);
teleportEvent.setAction(() =>
{
teleportEvent.stop();
p.teleport(new Location(TELEPORT_COORDINATES[js.index][option][0], TELEPORT_COORDINATES[js.index][option][1], 0));
p.setLastAnimation(new Animation(65535));
Teleport.resetTeleport(p);
p.removeTemporaryAttribute("unmovable");
});
Server.registerEvent(teleportEvent);
return true;
}
示例11: teleportDuelArenaHome
public static void teleportDuelArenaHome(Player player)
{
player.teleport(new Location(3360 + Misc.random(19), 3274 + Misc.random(3), 0));
}
示例12: useLever
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;
}
}
}
}
示例13: exitArena
public static void exitArena(Player p, int objectX, int objectY)
{
CoordinateEvent exitArenaCoordinateEvent = new CoordinateEvent(p, new Location(2805, 9589, 3));
exitArenaCoordinateEvent.setAction(() =>
{
p.setLastAnimation(new Animation(828));
Event exitArenaEvent = new Event(1000);
exitArenaEvent.setAction(() =>
{
p.teleport(new Location(2809, 3193, 0));
exitArenaEvent.stop();
});
Server.registerEvent(exitArenaEvent);
});
Server.registerCoordinateEvent(exitArenaCoordinateEvent);
}
示例14: showAliDialogue
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);
}
}
示例15: travel
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);
}