本文整理汇总了C#中Player.getWalkingQueue方法的典型用法代码示例。如果您正苦于以下问题:C# Player.getWalkingQueue方法的具体用法?C# Player.getWalkingQueue怎么用?C# Player.getWalkingQueue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Player
的用法示例。
在下文中一共展示了Player.getWalkingQueue方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: chopTendrils
public static void chopTendrils(Player p, int x, int y)
{
int var = x == 3057 ? x + 2 : x - 1;
AreaEvent chopTendrilsAreaEvent = new AreaEvent(p, var, y, var, y + 2);
chopTendrilsAreaEvent.setAction(() =>
{
if (!Woodcutting.hasAxe(p))
{
p.getPackets().sendMessage("You need an axe to get past this obstacle.");
return;
}
p.getWalkingQueue().resetWalkingQueue();
p.setFaceLocation(new Location(x + 1, y, 0));
p.setLastAnimation(new Animation(Woodcutting.getAxeAnimation(p)));
p.setTemporaryAttribute("unmovable", true);
Event chopTendrilsEvent = new Event(1900);
chopTendrilsEvent.setAction(() =>
{
int status = 0;
int[] TENDRILS = { 7161, 7162, 7163 };
if (status < 3)
{
p.getPackets().createObject(TENDRILS[status], new Location(x, y, 0), x == 3057 ? 3 : 1, 10);
}
status++;
if (status == 1)
{
p.setLastAnimation(new Animation(Woodcutting.getAxeAnimation(p)));
chopTendrilsEvent.setTick(1300);
}
if (status == 3)
{
p.getPackets().sendMessage("You clear your way through the tendrils.");
p.setLastAnimation(new Animation(65535));
chopTendrilsEvent.setTick(800);
}
if (status == 4)
{
chopTendrilsEvent.stop();
teleportPastObstacle(p);
p.removeTemporaryAttribute("unmovable");
}
});
Server.registerEvent(chopTendrilsEvent);
return;
});
Server.registerCoordinateEvent(chopTendrilsAreaEvent);
}
示例2: lightFire
private static void lightFire(Player p, int logIndex, bool colouredFire, int slot)
{
//if (!World.getInstance().getObjectLocations().tileAvailable(new Location(p.getLocation().getX() - 1, p.getLocation().getY(), p.getLocation().getZ()))) {
//return;
//}
// TODO clip this
p.getPackets().closeInterfaces();
int log = colouredFire ? COLOURED_LOGS[logIndex] : LOGS[logIndex];
if (!canMakeFire(p, logIndex, colouredFire))
return;
if (slot != -1) {
//item in inventory wasn't a log (you may have swapped it/banked it quickly).
if(!p.getInventory().deleteItem(log, slot, 1))
return;
Server.getGroundItems().newEntityDrop(new GroundItem(log, 1, (Location)p.getLocation().Clone(), p));
} else { //light fire using logs already placed on ground.
//check if there is a log on the ground in our current location, if not we can't make fire.
GroundItem gi = Server.getGroundItems().itemExists(p.getLocation(), log);
if (gi == null)
return; //so we quit here.
}
int delay = getDelay(p, logIndex);
p.getWalkingQueue().resetWalkingQueue();
p.getPackets().clearMapFlag();
if (delay == START_DELAY)
p.setLastAnimation(new Animation(733));
p.getPackets().sendMessage("You attempt to light the logs.");
ushort fireObject = colouredFire ? COLOURED_FIRES[logIndex] : FIRE_OBJECT;
p.setTemporaryAttribute("unmovable", true);
Event lightFireEvent = new Event(delay);
lightFireEvent.setAction(() => {
lightFireEvent.stop();
p.setTemporaryAttribute("lastFiremake", Environment.TickCount);
p.setLastAnimation(new Animation(65535));
p.getWalkingQueue().forceWalk(-1, 0);
Event finishFireEvent = new Event(1000);
finishFireEvent.setAction(() => {
finishFireEvent.stop();
Location fireLocation = new Location((p.getLocation().getX() + 1), p.getLocation().getY(), p.getLocation().getZ());
if (Server.getGroundItems().deleteItem(log, fireLocation)) {
p.getPackets().sendMessage("The fire catches and the logs begin to burn.");
p.setFaceLocation(fireLocation);
p.getSkills().addXp(Skills.SKILL.FIREMAKING, FIRE_XP[logIndex]);
Server.getGlobalObjects().newFire(p, fireObject, fireLocation);
}
p.removeTemporaryAttribute("unmovable");
});
Server.registerEvent(finishFireEvent);
});
Server.registerEvent(lightFireEvent);
}
示例3: thieveNpc
private static void thieveNpc(Player p, Npc npc, int index)
{
AreaEvent thieveNpcAreaEvent = new AreaEvent(p, npc.getLocation().getX()-1, npc.getLocation().getY()-1, npc.getLocation().getX()+1, npc.getLocation().getY()+1);
thieveNpcAreaEvent.setAction(() => {
if (!canThieveNpc(p, npc, index)) {
return;
}
p.setFaceLocation(npc.getLocation());
p.setLastAnimation(new Animation(881));
p.getPackets().sendMessage("You attempt to pick the " + NPC_NAMES[index] + " pocket...");
p.setTemporaryAttribute("lastPickPocket", Environment.TickCount);
Event thieveNpcEvent = new Event(1000);
thieveNpcEvent.setAction(() => {
thieveNpcEvent.stop();
if (!p.getLocation().withinDistance(npc.getLocation(), 2)) {
return;
}
if (successfulThieve(p, index, false)) {
int rewardIndex = misc.random(NPC_REWARD[index].Length - 1);
int reward = NPC_REWARD[index][rewardIndex];
int rewardAmount = NPC_REWARD_AMOUNT[index][rewardIndex];
if (index == 7) { // Master farmer.
if (misc.random(15) == 0) {
reward = HERB_SEEDS[misc.random(HERB_SEEDS.Length - 1)];
}
}
p.getSkills().addXp(Skills.SKILL.THIEVING, NPC_XP[index]);
p.getInventory().addItem(reward, rewardAmount);
p.getPackets().sendMessage("You pick the " + NPC_NAMES[index] + " pocket.");
} else {
p.getWalkingQueue().resetWalkingQueue();
p.getPackets().sendMessage("You fail to pick the " + NPC_NAMES[index] + " pocket.");
p.getPackets().sendMessage("You've been stunned!");
npc.setForceText("What do you think you're doing?");
p.setTemporaryAttribute("unmovable", true);
p.setTemporaryAttribute("stunned", true);
p.setLastGraphics(new Graphics(80, 0, 100));
p.setLastAnimation(new Animation(p.getDefenceAnimation()));
p.hit(1);
npc.setFaceLocation(p.getLocation());
Event removeStunEvent = new Event(5000);
removeStunEvent.setAction(() => {
removeStunEvent.stop();
p.removeTemporaryAttribute("unmovable");
p.removeTemporaryAttribute("stunned");
p.setLastGraphics(new Graphics(65535));
});
Server.registerEvent(removeStunEvent);
}
});
Server.registerEvent(thieveNpcEvent);
});
Server.registerCoordinateEvent(thieveNpcAreaEvent);
}
示例4: useAgilityTunnel
public static void useAgilityTunnel(Player p, int x, int y)
{
AreaEvent useAgilityTunnelAreaEvent = new AreaEvent(p, x-2, y-2, y+2, y+2);
useAgilityTunnelAreaEvent.setAction(() => {
p.getWalkingQueue().resetWalkingQueue();
p.setLastAnimation(new Animation(844));
p.setTemporaryAttribute("unmovable", true);
p.setFaceLocation(new Location(x, y, 0));
Event useAgilityTunnelEvent = new Event(1000);
useAgilityTunnelEvent.setAction(() => {
p.getPackets().sendMessage("You squeeze through the gap.");
teleportPastObstacle(p);
p.removeTemporaryAttribute("unmovable");
useAgilityTunnelEvent.stop();
});
Server.registerEvent(useAgilityTunnelEvent);
return;
});
Server.registerCoordinateEvent(useAgilityTunnelAreaEvent);
}
示例5: passEyes
public static void passEyes(Player p, int x, int y)
{
int var = x == 3058 ? x+2 : x-1;
AreaEvent passEyesAreaEvent = new AreaEvent(p, var, y, var, y+2);
passEyesAreaEvent.setAction(() => {
p.getWalkingQueue().resetWalkingQueue();
p.setFaceLocation(new Location(x, y, 0));
p.setTemporaryAttribute("unmovable", true);
p.getPackets().sendMessage("You attempt to distract the eyes...");
Event passEyesEvent = new Event(1900);
passEyesEvent.setAction(() => {
int status = 0;
int[] EYES = {7168, 7169, 7170};
if (status == 0) {
p.getPackets().createObject(EYES[1], new Location(x, y, 0), x == 3058 ? 3 : 1, 10);
}
status++;
if (status == 1) {
passEyesEvent.setTick(1300);
}
if (status == 2) {
p.setLastAnimation(new Animation(65535));
passEyesEvent.setTick(800);
}
if (status == 3) {
passEyesEvent.stop();
p.getPackets().sendMessage("You distract the eyes and pass them.");
teleportPastObstacle(p);
p.removeTemporaryAttribute("unmovable");
}
});
Server.registerEvent(passEyesEvent);
return;
});
Server.registerCoordinateEvent(passEyesAreaEvent);
}
示例6: mineRock
public static void mineRock(Player p, int x, int y)
{
AreaEvent mineRockAreaEvent = new AreaEvent(p, x-1, y-1, x +3, y+1);
mineRockAreaEvent.setAction(() => {
if (!Mining.hasPickaxe(p)) {
p.getPackets().sendMessage("You need a pickaxe to get past this obstacle.");
return;
}
p.getWalkingQueue().resetWalkingQueue();
p.setFaceLocation(new Location(x + 1, y, 0));
p.setLastAnimation(new Animation(Mining.getPickaxeAnimation(p)));
p.setTemporaryAttribute("unmovable", true);
Event mineRockEvent = new Event(1900);
mineRockEvent.setAction(() => {
int status = 0;
int[] ROCKS = {7158, 7159, 7160};
if (status < 3) {
p.getPackets().createObject(ROCKS[status], new Location(x, y, 0), 0, 10);
}
status++;
if (status == 1) {
mineRockEvent.setTick(1300);
}
if (status == 3) {
p.setLastAnimation(new Animation(65535));
mineRockEvent.setTick(800);
}
if (status == 4) {
mineRockEvent.stop();
teleportPastObstacle(p);
p.removeTemporaryAttribute("unmovable");
}
});
Server.registerEvent(mineRockEvent);
return;
});
Server.registerCoordinateEvent(mineRockAreaEvent);
}
示例7: 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);
//.........这里部分代码省略.........
示例8: 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();
}
});
}
示例9: 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));
//.........这里部分代码省略.........
示例10: 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);
}
示例11: 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;
}
示例12: 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);
}
示例13: 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;
//.........这里部分代码省略.........
示例14: buryBone
private static void buryBone(Player p, int i, int slot)
{
long lastBury = 0;
if (p.getTemporaryAttribute("lastBury") != null) {
lastBury = (int) p.getTemporaryAttribute("lastBury");
}
if (Environment.TickCount - lastBury < 400) {
return;
}
p.getWalkingQueue().resetWalkingQueue();
p.getPackets().clearMapFlag();
p.getPackets().sendMessage("You dig a hole in the ground...");
p.setLastAnimation(new Animation(BURY_ANIMATION));
Event buryBoneEvent = new Event(300);
buryBoneEvent.setAction(() => {
buryBoneEvent.stop();
if (p.getInventory().deleteItem(BONES[i], slot, 1)) {
p.getSkills().addXp(Skills.SKILL.PRAYER, BURY_XP[i]);
p.setTemporaryAttribute("lastBury", Environment.TickCount);
p.getPackets().sendMessage("You bury the bones.");
}
});
Server.registerEvent(buryBoneEvent);
}