public static void interactWithAubury(Player p, Npc n, int option) { p.setEntityFocus(n.getClientIndex()); AreaEvent interactWithAuburyAreaEvent = new AreaEvent(p, n.getLocation().getX() - 1, n.getLocation().getY() - 1, n.getLocation().getX() + 1, n.getLocation().getY() + 1); interactWithAuburyAreaEvent.setAction(() => { n.setFaceLocation(p.getLocation()); p.setFaceLocation(n.getLocation()); p.setEntityFocus(65535); switch (option) { case 1: // talk to break; case 2: // trade p.setShopSession(new ShopSession(p, 3)); break; case 3: // teleport RuneCraft.teleportToEssMine(p, n); break; } }); Server.registerCoordinateEvent(interactWithAuburyAreaEvent); }
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); }
public static bool dialogue(Player p, Npc npc, bool rightClickPay) { if ((npc.getId() != 1055 && npc.getId() != 437) || (rightClickPay && npc.getId() != 437)) { return false; } p.setEntityFocus(npc.getClientIndex()); AreaEvent dialogueAreaEvent = new AreaEvent(p, npc.getLocation().getX() - 1, npc.getLocation().getY() - 1, npc.getLocation().getX() + 1, npc.getLocation().getY() + 1); dialogueAreaEvent.setAction(() => { npc.setFaceLocation(p.getLocation()); int status = npc.getId() == 1055 ? 43 : 1; if (rightClickPay) { if (!p.getInventory().hasItemAmount(995, AGILITY_ARENA_PRICE)) { p.getPackets().sendMessage("You don't have enough money to pay the entrance fee."); return; } status = 29; } doDialogue(p, status); }); Server.registerCoordinateEvent(dialogueAreaEvent); return true; }
public bool useDoor(Player p, int doorId, int doorX, int doorY, int doorHeight) { Location doorLocation = new Location(doorX, doorY, doorHeight); foreach (Door door in doors) { int id = door.isDoorOpen() ? door.getOpenDoorId() : door.getClosedDoorId(); if (id == doorId) { if (door.getDoorLocation().Equals(doorLocation)) { if (door.isDoorOpen() && (Environment.TickCount - door.getLastChangeTime() <= PLAYER_CHANGE_DELAY)) { // door was opened in the last PLAYER_CHANGE_DELAY ms..cant be instantly closed return true; } else if (!door.isClosable() && door.isDoorOpen()) { // door cannot be closed by a player return true; } Door d = door; AreaEvent useDoorAreaEvent = new AreaEvent(p, doorLocation.getX() - 1, doorLocation.getY() - 1, doorLocation.getX() + 1, doorLocation.getY() + 1); useDoorAreaEvent.setAction(() => { changeDoor(p, d); }); Server.registerCoordinateEvent(useDoorAreaEvent); return true; } } } return false; }
public static void displayEmptyRockMessage(Player player, Location rockLocation) { AreaEvent displayEmptyRockMessageAreaEvent = new AreaEvent(player, rockLocation.getX() - 1, rockLocation.getY() - 1, rockLocation.getX() + 1, rockLocation.getY() + 1); displayEmptyRockMessageAreaEvent.setAction(() => { player.getPackets().sendMessage("There is currently no ore available from this rock."); }); }
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); }
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); }
public static void interactWithAliMorissaae(Player p, Npc n) { p.setEntityFocus(n.getClientIndex()); AreaEvent interactWithAliMorissaaeAreaEvent = new AreaEvent(p, n.getLocation().getX() - 1, n.getLocation().getY() - 1, n.getLocation().getX() + 1, n.getLocation().getY() + 1); interactWithAliMorissaaeAreaEvent.setAction(() => { n.setFaceLocation(p.getLocation()); p.setFaceLocation(n.getLocation()); p.setEntityFocus(65535); showAliDialogue(p, 205); }); Server.registerCoordinateEvent(interactWithAliMorissaaeAreaEvent); }
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); }
public static void exitCave(Player p, int objectX, int objectY) { AreaEvent exitCaveAreaEvent = new AreaEvent(p, objectX, objectY - 1, objectX + 2, objectY - 1); exitCaveAreaEvent.setAction(() => { p.setTemporaryAttribute("unmovable", true); Event teleFromCaveEvent = new Event(600); teleFromCaveEvent.setAction(() => { teleFromCaveEvent.stop(); p.getFightCave().teleFromCave(true); }); Server.registerEvent(teleFromCaveEvent); }); Server.registerCoordinateEvent(exitCaveAreaEvent); }
public static bool interactWithBoatNPC(Player p, Npc n) { int id = n.getId(); if (id != 4540 && id != 1304 && id != 2436 && id != 3781 && id != 1361 && id != 4962) { return false; } p.setEntityFocus(n.getClientIndex()); AreaEvent interactWithBoatNPCAreaEvent = new AreaEvent(p, n.getLocation().getX() - 1, n.getLocation().getY() - 1, n.getLocation().getX() + 1, n.getLocation().getY() + 1); interactWithBoatNPCAreaEvent.setAction(() => { n.setFaceLocation(p.getLocation()); p.setFaceLocation(n.getLocation()); p.setEntityFocus(65535); switch (n.getId()) { case 4540: // Home boat showBentleyDialogue(p, 240); break; case 1304: // Canifis sailor showCanifisSailorDialogue(p, 280); break; case 2436: // Waterbirth isle showJarvaldDialogue(p, 300); break; case 3781: // Pest control squire showSquireDialogue(p, 340); break; case 1361: // Warrior guild showArnorDialogue(p, 370); break; case 4962: // fremmenik shore showCaptainBarnabyDialogue(p, 410); break; } }); Server.registerCoordinateEvent(interactWithBoatNPCAreaEvent); return true; }
public static void burnBoil(Player p, int x, int y) { AreaEvent burnBoilAreaEvent = new AreaEvent(p, x - 1, y - 1, x + 3, y + 2); burnBoilAreaEvent.setAction(() => { if (!p.getInventory().hasItem(590)) { p.getPackets().sendMessage("You need a tinderbox to get past this obstacle."); return; } p.setFaceLocation(new Location(x + 1, y, 0)); p.setLastAnimation(new Animation(733)); p.setTemporaryAttribute("unmovable", true); Event burnBoilEvent = new Event(1900); burnBoilEvent.setAction(() => { int status = 0; int[] BOIL = { 7165, 7166, 7167 }; if (status < 3) { p.getPackets().createObject(BOIL[status], new Location(x, y, 0), x == 3060 ? 3 : 1, 10); } status++; if (status == 1) { burnBoilEvent.setTick(1300); } if (status == 3) { p.setLastAnimation(new Animation(65535)); burnBoilEvent.setTick(1000); } if (status == 4) { burnBoilEvent.stop(); teleportPastObstacle(p); p.removeTemporaryAttribute("unmovable"); } }); Server.registerEvent(burnBoilEvent); return; }); Server.registerCoordinateEvent(burnBoilAreaEvent); }
public static bool interactTzhaarNPC(Player p, Npc n, int option) { if (n.getId() != 2622 && n.getId() != 2620 && n.getId() != 2623 && n.getId() != 2619 && n.getId() != 2617 && n.getId() != 2618) { return false; } p.setEntityFocus(n.getClientIndex()); int npcX = n.getLocation().getX(); int npcY = n.getLocation().getY(); AreaEvent interactTzhaarNpcAreaEvent = new AreaEvent(p, npcX - 1, npcY - 1, npcX + 1, npcY + 1); interactTzhaarNpcAreaEvent.setAction(() => { p.setFaceLocation(n.getLocation()); p.setEntityFocus(65535); switch (n.getId()) { case 2619: // Bankers if (option == 1) { // Talk } else if (option == 2) { // Bank p.getBank().openBank(); } else if (option == 3) { // Collect } break; //TODO tzhaar stores case 2622: // Ore shop if (option == 1) { // Speak } else if (option == 2) { // Trade p.setShopSession(new ShopSession(p, 3)); } break; } }); Server.registerCoordinateEvent(interactTzhaarNpcAreaEvent); return true; }
public static bool wantToFish(Player p, Npc npc, bool secondOption) { for (int i = 0; i < SPOT_IDS.Length; i++) { if (npc.getId() == SPOT_IDS[i]) { p.setFaceLocation(npc.getLocation()); AreaEvent startFishingAreaEvent = new AreaEvent(p, npc.getLocation().getX() - 1, npc.getLocation().getY() - 1, npc.getLocation().getX() + 1, npc.getLocation().getY() + 1); startFishingAreaEvent.setAction(() => { startFishing(p, i, npc, true, secondOption); }); Server.registerCoordinateEvent(startFishingAreaEvent); return true; } } return false; }
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); }
public static bool useWildernessObelisk(Player p, int id, Location loc) { for (int i = 0; i < OBELISK_ID.Length; i++) { if (id == OBELISK_ID[i]) { if (loc.inArea(OBELISK_LOCATIONS[i][0] - 2, OBELISK_LOCATIONS[i][1] - 2, OBELISK_LOCATIONS[i][0] + 2, OBELISK_LOCATIONS[i][1] + 2)) { AreaEvent useWildernessObeliskAreaEvent = new AreaEvent(p, loc.getX() - 1, loc.getY() - 1, loc.getX() + 1, loc.getY() + 1); useWildernessObeliskAreaEvent.setAction(() => { activateObelisk(i); }); Server.registerCoordinateEvent(useWildernessObeliskAreaEvent); } return true; } } return false; }
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); }
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); p.getUpdateFlags().setAppearanceUpdateRequired(true); p.getWalkingQueue().forceWalk(+6, 0); Event ropeBalanceEvent = new Event(3700); ropeBalanceEvent.setAction(() => { ropeBalanceEvent.stop(); 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(ropeBalanceEvent); }); Server.registerCoordinateEvent(ropeBalanceCoordinateEvent); break; case 2314: // Tree climb #2 AreaEvent treeclimbTwoAreaEvent = new AreaEvent(p, 2485, 3418, 2486, 3420); treeclimbTwoAreaEvent.setAction(() => { p.getPackets().sendMessage("You climb down the tree..."); p.setLastAnimation(new Animation(828)); p.getWalkingQueue().resetWalkingQueue(); p.getPackets().clearMapFlag(); p.setFaceLocation(new Location(2486, 3419, 2)); p.setTemporaryAttribute("unmovable", true); Event treeClimbTwoEvent = new Event(1000); treeClimbTwoEvent.setAction(() => { treeClimbTwoEvent.stop(); p.getPackets().sendMessage("You land on the ground."); p.removeTemporaryAttribute("unmovable"); p.teleport(new Location(2486, 3420, 0)); p.getSkills().addXp(Skills.SKILL.AGILITY, (double)objectArray[7]); }); Server.registerEvent(treeClimbTwoEvent); }); Server.registerCoordinateEvent(treeclimbTwoAreaEvent); break; case 2286: // Net #2 AreaEvent doNetTwoAreaEvent = new AreaEvent(p, 2483, 3425, 2488, 3425); doNetTwoAreaEvent.setAction(() => { shoutNPCs[4].setForceText(SHOUT_MESSAGES[4]); 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 doNetTwoEvent = new Event(1000); doNetTwoEvent.setAction(() => { doNetTwoEvent.stop(); p.removeTemporaryAttribute("unmovable"); p.teleport(new Location(p.getLocation().getX(), p.getLocation().getY() + 2, 0)); p.getSkills().addXp(Skills.SKILL.AGILITY, (double)objectArray[7]); }); Server.registerEvent(doNetTwoEvent); }); Server.registerCoordinateEvent(doNetTwoAreaEvent); break; case 4058: // Right obstacle pipe AreaEvent passRightObstraclePipeAreaEvent = new AreaEvent(p, 2486, 3430, 2488, 3431); passRightObstraclePipeAreaEvent.setAction(() => { 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; if (newMove > 0) { int path = newMove; int doCourseCounter = 0; Event doCourseEvent = new Event(500); doCourseEvent.setAction(() => { if (doCourseCounter == 0) { p.getWalkingQueue().forceWalk(0, -1); } else if (doCourseCounter == 1) { p.getWalkingQueue().forceWalk(path == 1 ? -1 : +1, 0); } else { doCourse(p, objectX, objectY, objectArray); doCourseEvent.stop(); } doCourseCounter++; }); Server.registerEvent(doCourseEvent); return; } Event squeezeIntoRightPipeEvent = new Event(0); squeezeIntoRightPipeEvent.setAction(() => { squeezeIntoRightPipeEvent.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 + 4, 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); int squeezeOutOfRightPipeCounter = 0; Event squeezeOutOfRightPipeEvent = new Event(1150); squeezeOutOfRightPipeEvent.setAction(() => { if (squeezeOutOfRightPipeCounter == 0) { p.teleport(new Location(p.getLocation().getX(), p.getLocation().getY() + 3, 0)); squeezeOutOfRightPipeEvent.setTick(450); squeezeOutOfRightPipeCounter++; return; } else if (squeezeOutOfRightPipeCounter == 1) { p.setForceMovement(new ForceMovement(lX, lY + 3, lX, lY + 6, 10, 60, 0)); squeezeOutOfRightPipeEvent.setTick(900); squeezeOutOfRightPipeCounter++; } else if (squeezeOutOfRightPipeCounter == 2) { squeezeOutOfRightPipeEvent.setTick(500); p.setLastAnimation(new Animation(10579)); p.setForceMovement(new ForceMovement(lX, lY + 6, lX, lY + 7, 10, 40, 0)); squeezeOutOfRightPipeCounter++; } else { p.getPackets().sendMessage("...You squeeze out of the pipe."); squeezeOutOfRightPipeEvent.stop(); p.removeTemporaryAttribute("unmovable"); p.getSkills().addXp(Skills.SKILL.AGILITY, (double)objectArray[7]); p.getWalkingQueue().setRunToggled(running); p.teleport(new Location(p.getLocation().getX(), p.getLocation().getY() + 5, 0)); } }); Server.registerEvent(squeezeOutOfRightPipeEvent); }); Server.registerEvent(squeezeIntoRightPipeEvent); }); Server.registerCoordinateEvent(passRightObstraclePipeAreaEvent); break; case 154: // Left obstacle pipe AreaEvent passLeftObstraclePipeAreaEvent = new AreaEvent(p, 2483, 3430, 2485, 3431); passLeftObstraclePipeAreaEvent.setAction(() => { 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 == 2483) newMove = 3; else if (pX == 2485) newMove = 4; if (newMove > 0) { int path = newMove; int doCourseCounter = 0; Event doCourseEvent = new Event(500); doCourseEvent.setAction(() => { if (path == 3 || path == 4) { p.getWalkingQueue().forceWalk(path == 3 ? +1 : -1, 0); doCourseCounter = 2; } if (doCourseCounter == 0) { p.getWalkingQueue().forceWalk(0, -1); } else if (doCourseCounter == 1) { p.getWalkingQueue().forceWalk(path == 1 ? -1 : +1, 0); } else { doCourse(p, objectX, objectY, objectArray); doCourseEvent.stop(); } doCourseCounter++; }); Server.registerEvent(doCourseEvent); return; } Event squeezeIntoLeftPipeEvent = new Event(0); squeezeIntoLeftPipeEvent.setAction(() => { squeezeIntoLeftPipeEvent.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); int squeezeOutOfLeftPipeCounter = 0; Event squeezeOutOfLeftPipeEvent = new Event(1150); squeezeOutOfLeftPipeEvent.setAction(() => { if (squeezeOutOfLeftPipeCounter == 0) { p.teleport(new Location(p.getLocation().getX(), p.getLocation().getY() + 3, 0)); squeezeOutOfLeftPipeEvent.setTick(450); squeezeOutOfLeftPipeCounter++; return; } else if (squeezeOutOfLeftPipeCounter == 1) { p.setForceMovement(new ForceMovement(lX, lY + 3, lX, lY + 6, 10, 60, 0)); squeezeOutOfLeftPipeEvent.setTick(900); squeezeOutOfLeftPipeCounter++; } else if (squeezeOutOfLeftPipeCounter == 2) { squeezeOutOfLeftPipeEvent.setTick(500); p.setLastAnimation(new Animation(10579)); p.setForceMovement(new ForceMovement(lX, lY + 6, lX, lY + 7, 10, 40, 0)); squeezeOutOfLeftPipeCounter++; } else { p.getPackets().sendMessage("...You squeeze out of the pipe."); squeezeOutOfLeftPipeEvent.stop(); p.removeTemporaryAttribute("unmovable"); p.getSkills().addXp(Skills.SKILL.AGILITY, (double)objectArray[7]); p.getWalkingQueue().setRunToggled(running); p.teleport(new Location(p.getLocation().getX(), p.getLocation().getY() + 5, 0)); } }); Server.registerEvent(squeezeOutOfLeftPipeEvent); }); Server.registerEvent(squeezeIntoLeftPipeEvent); }); Server.registerCoordinateEvent(passLeftObstraclePipeAreaEvent); break; } }
public static void slashWeb(Player p, ushort webId, Location webLocation) { AreaEvent slashWebAreaEvent = new AreaEvent(p, webLocation.getX() - 1, webLocation.getY() - 1, webLocation.getX() + 1, webLocation.getY() + 1); slashWebAreaEvent.setAction(() => { long lastSlash = 0; p.setFaceLocation(webLocation); if (p.getTemporaryAttribute("lastWebSlash") != null) { lastSlash = (int)p.getTemporaryAttribute("lastWebSlash"); } if (Environment.TickCount - lastSlash <= 800) { return; } if (Server.getGlobalObjects().originalObjectExists(webId, webLocation)) { p.setLastAnimation(new Animation(p.getAttackAnimation())); p.setTemporaryAttribute("lastWebSlash", Environment.TickCount); Event attemptCutWebEvent = new Event(500); attemptCutWebEvent.setAction(() => { attemptCutWebEvent.stop(); bool webExists = Server.getGlobalObjects().originalObjectExists(webId, webLocation); Server.getGlobalObjects().lowerHealth(webId, webLocation); if (Server.getGlobalObjects().originalObjectExists(webId, webLocation)) { p.getPackets().sendMessage("You fail to cut through the web."); } else { if (webExists) { // This means we slashed it, if !webExists, someone else slashed it in the last 500ms p.getPackets().sendMessage("You slash through the web!"); } } }); Server.registerEvent(attemptCutWebEvent); } }); Server.registerCoordinateEvent(slashWebAreaEvent); }
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); }
public static void tryMineRock(Player p, ushort rockId, Location rockLocation, int i, bool newMine) { if (rockId != 2491) { AreaEvent mineRockAreaEvent = new AreaEvent(p, rockLocation.getX() - 1, rockLocation.getY() - 1, rockLocation.getX() + 1, rockLocation.getY() + 1); mineRockAreaEvent.setAction(() => { mineRock(p, rockId, rockLocation, i, newMine); }); Server.registerCoordinateEvent(mineRockAreaEvent); } else { AreaEvent mineRuneEssenceAreaEvent = new AreaEvent(p, rockLocation.getX() - 1, rockLocation.getY() - 1, rockLocation.getX() + 5, rockLocation.getY() + 5); mineRuneEssenceAreaEvent.setAction(() => { mineRock(p, rockId, rockLocation, i, newMine); }); Server.registerCoordinateEvent(mineRuneEssenceAreaEvent); } }
public static void registerCoordinateEvent(AreaEvent areaEvent) { Event newCoordinateEvent = new Event(0); newCoordinateEvent.setAction(() => { bool standingStill = areaEvent.getPlayer().getSprites().getPrimarySprite() == -1 && areaEvent.getPlayer().getSprites().getSecondarySprite() == -1; if (areaEvent.getPlayer().getDistanceEvent() == null || !areaEvent.getPlayer().getDistanceEvent().Equals(areaEvent)) { newCoordinateEvent.stop(); return; } if (standingStill) { if (areaEvent.inArea()) { areaEvent.run(); newCoordinateEvent.stop(); areaEvent.setDistanceEventNull(); return; } } newCoordinateEvent.setTick(500); }); registerEvent(newCoordinateEvent); }
//20 * 1024^0 + 3 * 1024^1 + 4 * 1024^2 public void openBank(bool dialogue, int x, int y) { openStatus = 0; changingPin = false; AreaEvent openBankAreaEvent = new AreaEvent(player, x - 1, y - 1, x + 1, y + 1); openBankAreaEvent.setAction(() => { if (dialogue) { //Dialogue.doDialogue(player, 1); //TODO: Make bank Dialogue for clicking on booths. return; } openBank(); }); Server.registerCoordinateEvent(openBankAreaEvent); }
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; else if (pX == objectX + 1 && pY == objectY + 4) // front right newMove = 2; else if (pX == objectX - 1 && pY == objectY + 5) // back left newMove = 3; else if (pX == objectX + 1 && pY == objectY + 5) // back right newMove = 4; else if (pX == objectX && pY == objectY + 5) // back middle newMove = 5; if (newMove > 0) { int path = newMove; int doCourseCounter = 0; Event doCourseEvent = new Event(500); doCourseEvent.setAction(() => { p.setFaceLocation(new Location(2551, 3549, 0)); if (path == 1 || path == 2) { if (doCourseCounter == 0) { p.getWalkingQueue().forceWalk(path == 1 ? +1 : -1, 0); } else if (doCourseCounter >= 1) { doCourseEvent.stop(); doCourse(p, objectX, objectY, objectArray); } } else if (path == 3 || path == 4) { if (doCourseCounter == 0) { p.getWalkingQueue().forceWalk(path == 3 ? +1 : -1, -1); } else if (doCourseCounter >= 1) { doCourseEvent.stop(); doCourse(p, objectX, objectY, objectArray); } } else if (path == 5) { if (doCourseCounter == 0) { p.getWalkingQueue().forceWalk(0, -1); } else if (doCourseCounter >= 1) { doCourseEvent.stop(); doCourse(p, objectX, objectY, objectArray); } } doCourseCounter++; }); Server.registerEvent(doCourseEvent); return; } Event doSwingEvent = new Event(0); doSwingEvent.setAction(() => { doSwingEvent.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 newY = p.getLocation().getY() - 5; int dir = 4; p.setLastAnimation(new Animation(751)); p.setForceMovement(new ForceMovement(lX, lY, lX, lY - 5, 25, 57, dir)); p.getWalkingQueue().resetWalkingQueue(); p.getPackets().clearMapFlag(); p.setTemporaryAttribute("unmovable", true); Location objectLocation = new Location(2551, 3550, 0); Event showObjectAnimationEvent = new Event(30); showObjectAnimationEvent.setAction(() => { showObjectAnimationEvent.stop(); foreach (Player nearbyPlayers in Server.getPlayerList()) { if (nearbyPlayers != null) { nearbyPlayers.getPackets().newObjectAnimation(objectLocation, 497); } } }); Server.registerEvent(showObjectAnimationEvent); Event finishSwingEvent = new Event(1300); finishSwingEvent.setAction(() => { finishSwingEvent.stop(); p.getAppearance().setWalkAnimation(-1); p.getUpdateFlags().setAppearanceUpdateRequired(true); 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(finishSwingEvent); }); Server.registerEvent(doSwingEvent); }); Server.registerCoordinateEvent(swingAreaEvent); break; case 2294: // Log AreaEvent logAreaEvent = new AreaEvent(p, 2550, 3545, 2551, 3547); logAreaEvent.setAction(() => { int distanceToWalk = p.getLocation().getX() == 2550 ? -9 : -10; int newMove = 0; int pX = p.getLocation().getX(); int pY = p.getLocation().getY(); if (pX == objectX && pY == objectY - 1) newMove = 1; else if (pX == objectX && pY == objectY + 1) newMove = 2; if (newMove > 0) { int path = newMove; int doLogCounter = 0; Event doLogEvent = new Event(500); doLogEvent.setAction(() => { if (doLogCounter++ == 0) { p.getWalkingQueue().forceWalk(0, path == 1 ? +1 : -1); } else { doCourse(p, objectX, objectY, objectArray); doLogEvent.stop(); } }); Server.registerEvent(doLogEvent); return; } Event startLogEvent = new Event(0); startLogEvent.setAction(() => { startLogEvent.stop(); 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(distanceToWalk, 0); int delay = distanceToWalk == -9 ? 5400 : 5900; Event endLogEvent = new Event(delay); endLogEvent.setAction(() => { endLogEvent.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); }); Server.registerEvent(endLogEvent); }); Server.registerEvent(startLogEvent); }); Server.registerCoordinateEvent(logAreaEvent); break; case 20211: // Net AreaEvent netAreaEvent = new AreaEvent(p, 2539, 3545, 2539, 3546); netAreaEvent.setAction(() => { p.setLastAnimation(new Animation(828)); p.getWalkingQueue().resetWalkingQueue(); p.getPackets().clearMapFlag(); p.setFaceLocation(new Location(p.getLocation().getX() - 1, p.getLocation().getY(), 0)); p.setTemporaryAttribute("unmovable", true); Event netEvent = new Event(1000); netEvent.setAction(() => { netEvent.stop(); p.removeTemporaryAttribute("unmovable"); p.teleport(new Location(p.getLocation().getX() - 2, p.getLocation().getY(), 1)); p.getSkills().addXp(Skills.SKILL.AGILITY, (double)objectArray[7]); }); Server.registerEvent(netEvent); }); Server.registerCoordinateEvent(netAreaEvent); break; case 2302: // Balance beam CoordinateEvent balanceBeamCoordinateEvent = new CoordinateEvent(p, new Location((int)objectArray[3], (int)objectArray[4], 1)); balanceBeamCoordinateEvent.setAction(() => { bool running = p.getWalkingQueue().isRunToggled(); p.getWalkingQueue().setRunToggled(false); p.getWalkingQueue().resetWalkingQueue(); p.getPackets().clearMapFlag(); p.setTemporaryAttribute("unmovable", true); p.getAppearance().setWalkAnimation(157); p.getUpdateFlags().setAppearanceUpdateRequired(true); p.getWalkingQueue().forceWalk(-4, 0); Event balanceBeamEvent = new Event(2450); balanceBeamEvent.setAction(() => { balanceBeamEvent.stop(); 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(balanceBeamEvent); }); Server.registerCoordinateEvent(balanceBeamCoordinateEvent); break; case 1948: // Crumbling wall AreaEvent crumblingWallAreaEvent = new AreaEvent(p, objectX - 1, objectY - 1, objectX, objectY + 1); crumblingWallAreaEvent.setAction(() => { int newMove = 0; int pX = p.getLocation().getX(); int pY = p.getLocation().getY(); if (pX == objectX && pY == objectY - 1) newMove = 1; else if (pX == objectX && pY == objectY + 1) newMove = 2; if (newMove > 0) { int path = newMove; Event startCrumblingWallEvent = new Event(500); int startCrumblingWallCounter = 0; startCrumblingWallEvent.setAction(() => { if (startCrumblingWallCounter == 0) { p.getWalkingQueue().forceWalk(-1, 0); } else if (startCrumblingWallCounter == 1) { p.getWalkingQueue().forceWalk(0, path == 1 ? +1 : -1); } else { doCourse(p, objectX, objectY, objectArray); startCrumblingWallEvent.stop(); } startCrumblingWallCounter++; }); Server.registerEvent(startCrumblingWallEvent); return; } 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 + 2, lY, 10, 60, 1)); p.setLastAnimation(new Animation(4853)); p.getWalkingQueue().resetWalkingQueue(); p.getPackets().clearMapFlag(); p.setTemporaryAttribute("unmovable", true); Event finishCrumblingWallEvent = new Event(1250); finishCrumblingWallEvent.setAction(() => { finishCrumblingWallEvent.stop(); p.setFaceLocation(new Location(p.getLocation().getX() + 1, p.getLocation().getY(), 0)); p.removeTemporaryAttribute("unmovable"); p.teleport(new Location(p.getLocation().getX() + 2, p.getLocation().getY(), 0)); p.getSkills().addXp(Skills.SKILL.AGILITY, (double)objectArray[7]); }); Server.registerEvent(finishCrumblingWallEvent); }); Server.registerCoordinateEvent(crumblingWallAreaEvent); break; } }
public void forfeitDuel(int x, int y) { // if (status == 5 || status == 4) { AreaEvent forfeitDuelAreaEvent = new AreaEvent(player, x - 1, y - 1, x + 1, y + 1); forfeitDuelAreaEvent.setAction(() => { if (ruleEnabled(RULE.NO_FORFEIT)) { player.getPackets().sendMessage("You cannot forfeit this duel!"); return; } player.getPackets().modifyText("Forfeit duel?", 228, 1); player.getPackets().modifyText("Yes", 228, 2); player.getPackets().modifyText("No", 228, 3); player.getPackets().sendChatboxInterface2(228); }); Server.registerCoordinateEvent(forfeitDuelAreaEvent); //} }
public static bool useObject(Player p, int id, Location location, int option) { foreach (LoadedLaddersAndStairs.HeightObject heightObject in LoadedLaddersAndStairs.objects) { if (heightObject.getId() == id) { if (heightObject.getLocation().Equals(location) && heightObject.getOption() == option) { LoadedLaddersAndStairs.HeightObject obj = heightObject; if (heightObject.getType() == LoadedLaddersAndStairs.Event_Type.COORDINATE_POSITION) { CoordinateEvent useObjectCoordinateEvent = new CoordinateEvent(p, heightObject.getStandLocation()); useObjectCoordinateEvent.setAction(() => { LaddersAndStairs.teleport(p, obj); }); Server.registerCoordinateEvent(useObjectCoordinateEvent); } else if (heightObject.getType() == LoadedLaddersAndStairs.Event_Type.AREA_POSITION) { AreaEvent useObjectAreaEvent = new AreaEvent(p, heightObject.getMinCoords().getX(), heightObject.getMinCoords().getY(), heightObject.getMaxCoords().getX(), heightObject.getMaxCoords().getY()); useObjectAreaEvent.setAction(() => { LaddersAndStairs.teleport(p, obj); }); Server.registerCoordinateEvent(useObjectAreaEvent); } return true; } } } return false; }
public static bool talkToWarriorGuildNPC(Player p, Npc n, int slot) { if (n.getId() != 4289) { return false; } p.setEntityFocus(n.getClientIndex()); int npcX = n.getLocation().getX(); int npcY = n.getLocation().getY(); AreaEvent talkToWarriorGuildNPCAreaEvent = new AreaEvent(p, npcX - 1, npcY - 1, npcX + 1, npcY + 1); talkToWarriorGuildNPCAreaEvent.setAction(() => { p.setFaceLocation(n.getLocation()); p.setEntityFocus(65535); switch (n.getId()) { case 4289: // Kamfreena Dialogue.doDialogue(p, 77); break; } }); Server.registerCoordinateEvent(talkToWarriorGuildNPCAreaEvent); return true; }
public static bool wantToSmithOnAnvil(Player p, int item, Location anvilLoc) { for (int i = 0; i < BARS.Length; i++) { if (item == BARS[i]) { AreaEvent displaySmithOptionsAreaEvent = new AreaEvent(p, anvilLoc.getX() - 1, anvilLoc.getY() - 1, anvilLoc.getX() + 1, anvilLoc.getY() + 1); displaySmithOptionsAreaEvent.setAction(() => { displaySmithOptions(p, i); }); Server.registerCoordinateEvent(displaySmithOptionsAreaEvent); return true; } } return false; }
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); }
public static void prospectRock(Player p, int x, int y, string s) { if (p.getTemporaryAttribute("unmovable") != null) { return; } AreaEvent prospectRockAreaEvent = new AreaEvent(p, x - 1, y - 1, x + 1, y + 1); prospectRockAreaEvent.setAction(() => { p.getPackets().sendMessage("You examine the rock for ores..."); p.setTemporaryAttribute("unmovable", true); Event prospectResultEvent = new Event(2000); prospectResultEvent.setAction(() => { p.getPackets().sendMessage("This rock contains " + s + "."); p.removeTemporaryAttribute("unmovable"); prospectResultEvent.stop(); }); Server.registerEvent(prospectResultEvent); }); Server.registerCoordinateEvent(prospectRockAreaEvent); }