public static void castCharge(Player p) { p.removeTemporaryAttribute("autoCasting"); if (p.getSkills().getCurLevel(Skills.SKILL.MAGIC) < 80) { p.getPackets().sendMessage("You need a Magic level of 80 to cast Charge."); return; } if (!hasRunes(p, CHARGE_RUNES, CHARGE_RUNE_AMOUNT)) { p.getPackets().sendMessage("You do not have enough runes to cast Charge."); return; } if (p.getTemporaryAttribute("godCharged") != null) { p.getPackets().sendMessage("You have already charged your god spells."); return; } if (hasGodCapeAndStaff(p)) { p.getPackets().sendMessage("You must wear a God cape and wield the matching staff to cast Charge."); return; } if (!deleteRunes(p, CHARGE_RUNES, CHARGE_RUNE_AMOUNT)) { return; } p.setTemporaryAttribute("godCharged", true); p.setLastGraphics(new Graphics(308, 800, 90)); p.setLastAnimation(new Animation(811)); p.getPackets().sendMessage("You feel charged with magical power.."); int delay = 60000 + misc.random(120000); //60 seconds + possible 120 seconds so, 1 minute to 2 minutes. Event removeGodChargeEvent = new Event(delay); removeGodChargeEvent.setAction(() => { removeGodChargeEvent.stop(); p.removeTemporaryAttribute("godCharged"); p.getPackets().sendMessage("Your magical charge fades away."); }); Server.registerEvent(removeGodChargeEvent); }
public static void openInterface(Player p) { p.getPackets().displayInterface(771); p.getPackets().sendPlayerHead(771, 79); p.getPackets().animateInterface(9804, 771, 79); p.getPackets().sendConfig(1262, p.getAppearance().getGender() == 2 ? 1 : 8); p.getAppearance().setTemporaryAppearance(new Appearance()); p.getAppearance().getTemporaryAppearance().setColoursArray(p.getAppearance().getColoursArray()); p.getAppearance().getTemporaryAppearance().setLookArray(p.getAppearance().getLookArray()); p.getAppearance().getTemporaryAppearance().setGender(p.getAppearance().getGender()); p.removeTemporaryAttribute("hairToggle"); }
public void clear() { appearanceUpdateRequired = false; teleportUpdateRequired = false; //not a isUpdateRequired because should do a update regardless if you are teleporting or not. mapRegionChangeUpdateRequired = false; //not a isUpdateRequired because mapRegion has to be accurately set when doing a update, or messes up). chatTextUpdateRequired = false; animationUpdateRequired = false; graphicsUpdateRequired = false; hitUpdateRequired = false; hit2UpdateRequired = false; entityFocusUpdateRequired = false; forceTextUpdateRequired = false; faceLocationUpdateRequired = false; forceMovementRequired = false; player.getSprites().setSprites(-1, -1); player.removeTemporaryAttribute("forceText"); }
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); }
public static void teleblockPlayer(Player killer, Player target) { int teleblockDelay = 300000; if (target.getPrayers().getHeadIcon() == PrayerData.MAGIC) { teleblockDelay = 150000; } target.setTemporaryAttribute("teleblocked", true); target.setTeleblockTime(Environment.TickCount + teleblockDelay); Event removeTeleBlockEvent = new Event(teleblockDelay); removeTeleBlockEvent.setAction(() => { removeTeleBlockEvent.stop(); if (target != null) { target.removeTemporaryAttribute("teleblocked"); target.setTeleblockTime(0); } }); Server.registerEvent(removeTeleBlockEvent); }
public static void newMagicAttack(Player p, Entity target, int id, bool ancients) { int index = getSpellIndex(p, id, ancients); bool autoCasting = p.getTemporaryAttribute("autoCasting") != null; bool fakeNPC = target != null && target is Npc && ((Npc)target).getId() == 0; Entity lastAutocastEntity = null; bool frozen = false; if (index == -1) { return; } if (p.getTarget() == null) { if (autoCasting) { if (Location.inMultiCombat(p.getLocation())) { lastAutocastEntity = (Entity) p.getTemporaryAttribute("autocastEntity") == null ? null : (Entity) p.getTemporaryAttribute("autocastEntity"); if (lastAutocastEntity == null || lastAutocastEntity is Player) { p.removeTemporaryAttribute("autoCasting"); Combat.resetCombat(p, 1); return; } if (hitsMulti(p, index)) { Location location = (Location)p.getTemporaryAttribute("autocastLocation"); Entity newTarget = new Npc(0); newTarget.setLocation(location); p.setTarget(newTarget); newMagicAttack(p, newTarget, id, ancients); return; } } else { p.removeTemporaryAttribute("autoCasting"); Combat.resetCombat(p, 1); return; } } else { p.removeTemporaryAttribute("autoCasting"); Combat.resetCombat(p, 1); return; } } else { if (!canCastSpell(p, target, index, fakeNPC)) { p.removeTemporaryAttribute("autoCasting"); Combat.resetCombat(p, 1); return; } } int distance = 8; if (target is Player) { if (((Player)target).getSprites().getPrimarySprite() != -1) { distance = 8; } } if (!fakeNPC) { // we're actually attacking a real npc/player if (!p.getLocation().withinDistance(target.getLocation(), distance)) { p.getFollow().setFollowing(target); Event attemptMagicAttackEvent = new Event(500); int attemptMagicAttackCounter = 0; attemptMagicAttackEvent.setAction(() => { if (p.getLocation().withinDistance(target.getLocation(), distance) && p.getTarget() != null) { attemptMagicAttackEvent.stop(); newMagicAttack(p, target, id, ancients); return; } attemptMagicAttackCounter++; if (attemptMagicAttackCounter >= 12) { attemptMagicAttackEvent.stop(); } }); Server.registerEvent(attemptMagicAttackEvent); return; } } int timeSinceLastCast = autoCasting ? 3500 : 2000; if (Environment.TickCount - p.getLastMagicAttack() < timeSinceLastCast) { p.getWalkingQueue().resetWalkingQueue(); //return; } int time = p.getLastCombatType().Equals(Combat.CombatType.MAGE) ? 1550 : 600; if (Environment.TickCount - p.getLastAttack() < time) { int delay = p.getLastCombatType().Equals(Combat.CombatType.MAGE) ? 1350 : 800; Event attemptMagicAttackEvent = new Event(500); attemptMagicAttackEvent.setAction(() => { if (Environment.TickCount - p.getLastAttack() > delay) { attemptMagicAttackEvent.stop(); newMagicAttack(p, target, id, ancients); } }); Server.registerEvent(attemptMagicAttackEvent); p.getWalkingQueue().resetWalkingQueue(); p.getPackets().clearMapFlag(); p.setLastCombatType(Combat.CombatType.MAGE); return; } if (fakeNPC && !monsterInArea(p, target)) { p.removeTemporaryAttribute("autoCasting"); Combat.resetCombat(p, 1); return; } int endGfx = END_GFX[index]; double damage = misc.random(CombatFormula.getMagicHit(p, target, getSpellMaxHit(p, index))); bool mp = false; bool magicProtect = mp; if (target is Player) { mp = ((Player) target).getPrayers().getHeadIcon() == PrayerData.MAGIC; } if (magicProtect) { damage *= 0.60; } if (p.getEquipment().getItemInSlot(ItemData.EQUIP.WEAPON) == 8841) { damage *= 1.10; // void mace 10% hit increase. } if (damage == 0 && index != 41 && index != 42 && index != 43 && index != 44 && index != 45 && index != 46 && index != 47) { endGfx = 85; } if (!deleteRunes(p, RUNES[index], RUNE_AMOUNTS[index])) { p.setTarget(null); return; } p.getFollow().setFollowing(null); p.getWalkingQueue().resetWalkingQueue(); p.getPackets().clearMapFlag(); p.setFaceLocation(target.getLocation()); if (HANDS_GFX[index] != -1) { p.setLastGraphics(new Graphics(HANDS_GFX[index], 0 , getStartingGraphicHeight(index))); } p.setLastAnimation(new Animation(SPELL_ANIM[index])); p.getPackets().closeInterfaces(); if (target is Player) { ((Player) target).getPackets().closeInterfaces(); } target.setAttacker(p); p.setTarget(target); target.setLastAttacked(Environment.TickCount); p.setLastAttack(Environment.TickCount); p.setLastMagicAttack(Environment.TickCount); p.setCombatTurns(p.getAttackSpeed()); Combat.setSkull(p, target); if (damage > 0) { frozen = freezeTarget(index, target); if (!frozen && index == 31) { endGfx = 1677; } } if (AIR_GFX[index] != -1 || ((index == 31 || index == 27) && target is Player && ((Player)target).getWalkingQueue().isRunning())) { sendProjectile(index, target, p); } if (damage > target.getHp()) { damage = target.getHp(); } if (index == 47 && misc.random(2) == 0) { endGfx = 85; } Combat.checkIfWillDie(target, damage); Event doMagicAttackEvent = new Event(getSpellHitDelay(index)); doMagicAttackEvent.setAction(() => { doMagicAttackEvent.stop(); if (p == null || p.isDead() || !fakeNPC && (target.isDead() || target.isHidden() || target.isDestroyed())) { return; } if (target.isAutoRetaliating() && target.getTarget() == null && damage > 0) { if (target is Npc) { } else { if (((Player) target).getTemporaryAttribute("autoCastSpell") != null) { int autoCastSpell = (int)((Player) target).getTemporaryAttribute("autoCastSpell"); ((Player) target).setTemporaryAttribute("autoCasting", true); target.setTarget(p); MagicCombat.newMagicAttack((Player) target, p, autoCastSpell, ((Player) target).getTemporaryAttribute("autoCastAncients") != null); } } target.getFollow().setFollowing(p); target.setEntityFocus(p.getClientIndex()); if ((target.getCombatTurns() <= (target.getAttackSpeed() / 2) || target.getCombatTurns() >= (target.getAttackSpeed()))) { target.setCombatTurns(target.getAttackSpeed() / 2); } target.setTarget(p); if (target is Player) { ((Player) target).getWalkingQueue().resetWalkingQueue(); ((Player) target).getPackets().clearMapFlag(); } } addMagicXp(p, target, damage, index, true); target.setLastGraphics(new Graphics(endGfx, 0, getGroundHeight(index, endGfx))); if (index == 47 && endGfx != 85) { // teleblock if (target is Player) { teleblockPlayer(p, (Player)target); } } if (damage != 0) { Combat.checkRecoil(p, target, damage); Combat.checkSmite(p, target, damage); Combat.checkVengeance(p, target, damage); hitInMulti(p, target, index); applyMiasmicEffects(p, target, index); if ((target.getCombatTurns() > 2 || target.getCombatTurns() < 0) && !target.isDead()) { target.setLastAnimation(new Animation(target.getDefenceAnimation())); } if (index != 27) { target.hit((int)damage); if (index == 18 || index == 22 || index == 26 || index == 30) { p.heal(Convert.ToInt32(damage / 4)); } } else if (index == 27){ Event doHitEvent = new Event(1000); doHitEvent.setAction(() => { doHitEvent.stop(); target.hit((int)damage); }); Server.registerEvent(doHitEvent); } } }); Server.registerEvent(doMagicAttackEvent); if (p.getTemporaryAttribute("autoCasting") != null) { if (p.getTemporaryAttribute("autoCastSpell") != null) { if (id != (int)p.getTemporaryAttribute("autoCastSpell")) { p.setTarget(null); return; } } if (!fakeNPC) { p.setTemporaryAttribute("autocastLocation", target.getLocation()); p.setTemporaryAttribute("autocastEntity", target); } Event autoCastSpellEvent = new Event(3500); autoCastSpellEvent.setAction(() => { autoCastSpellEvent.stop(); if (p.getTemporaryAttribute("autoCasting") != null && p.getTemporaryAttribute("autoCastSpell") != null) { int autoCastSpell = (int)p.getTemporaryAttribute("autoCastSpell"); MagicCombat.newMagicAttack(p, p.getTarget(), autoCastSpell, p.getTemporaryAttribute("autoCastAncients") != null); } }); Server.registerEvent(autoCastSpellEvent); } else { p.setTarget(null); } }
public static void verifyEnterTunnel(Player p) { p.getPackets().closeInterfaces(); if (p.getTemporaryAttribute("barrowTunnel") != null) { if ((int) p.getTemporaryAttribute("barrowTunnel") == 2) { p.teleport(new Location(3568, 9712, 0)); p.removeTemporaryAttribute("barrowTunnel"); return; } } p.getPackets().sendChatboxInterface(228); p.getPackets().modifyText("Yeah, I'm fearless!", 228, 2); p.getPackets().modifyText("No way, that looks scary!", 228, 3); p.setTemporaryAttribute("barrowTunnel", 2); }
public static bool openTunnelDoor(Player player, int doorId, int x, int y) { if (doorId < 6716 || (doorId > 6731 && doorId < 6735) || doorId > 6750) { return false; } int index = getDoorIndex(doorId, x, y); int index2 = getOtherDoor(x, y); // index of the door next to the one you clicked. if (index == -1 || index2 == -1) { return false; } bool betweenDoors = player.getTemporaryAttribute("betweenDoors") != null; Location clickedDoor = new Location(DOOR_LOCATION[index][0], DOOR_LOCATION[index][1], 0); Location otherDoor = new Location(DOOR_LOCATION[index2][0], DOOR_LOCATION[index2][1], 0); int openDoorId = DOOR_OPEN_DIRECTION[index][0]; int openDoorId2 = DOOR_OPEN_DIRECTION[index2][0]; int openDirection = DOOR_OPEN_DIRECTION[index][2]; int newX = openDirection == 1 ? x+1 : openDirection == 2 ? x : openDirection == 3 ? x-1 : openDirection == 4 ? x : x; int newY = openDirection == 1 ? y : openDirection == 2 ? y+1 : openDirection == 3 ? y : openDirection == 4 ? y-1 : y; int newX2 = openDirection == 1 ? DOOR_LOCATION[index2][0] + 1 : openDirection == 2 ? DOOR_LOCATION[index2][0] : openDirection == 3 ? DOOR_LOCATION[index2][0] - 1 : openDirection == 4 ? DOOR_LOCATION[index2][0] : DOOR_LOCATION[index2][0]; int newY2 = openDirection == 1 ? DOOR_LOCATION[index2][1] : openDirection == 2 ? DOOR_LOCATION[index2][1] + 1 : openDirection == 3 ? DOOR_LOCATION[index2][1] : openDirection == 4 ? DOOR_LOCATION[index2][1] - 1 : DOOR_LOCATION[index2][1]; int[] doorStandCoordinates = getDoorCoordinates(player, index, index2, betweenDoors); int[] walkDirections = getWalkDirections(player, index, index2, betweenDoors); player.setFaceLocation(clickedDoor); AreaEvent doorsWalkAreaEvent = new AreaEvent(player, doorStandCoordinates[0], doorStandCoordinates[1], doorStandCoordinates[2] + 1, doorStandCoordinates[3] + 1); doorsWalkAreaEvent.setAction(() => { player.setTemporaryAttribute("unmovable", true); Event forceWalkDoorEvent = new Event(800); forceWalkDoorEvent.setAction(() => { player.getWalkingQueue().resetWalkingQueue(); foreach(Player p in Server.getPlayerList()) { //change door for all logged in players? uhh what? p.getPackets().removeObject(clickedDoor, openDoorId == 6713 ? 4 : 3, 0); p.getPackets().removeObject(otherDoor, openDoorId2 == 6732 ? 3 : 4, 0); p.getPackets().createObject(openDoorId, new Location(newX, newY, 0), DOOR_OPEN_DIRECTION[index][1], 0); p.getPackets().createObject(openDoorId2, new Location(newX2, newY2, 0), DOOR_OPEN_DIRECTION[index2][1], 0); } player.getWalkingQueue().forceWalk(walkDirections[0], walkDirections[1]); forceWalkDoorEvent.stop(); }); Server.registerEvent(forceWalkDoorEvent); Event betweenDoorsEvent = new Event(betweenDoors ? 2200 : 1900); betweenDoorsEvent.setAction(() => { int face = openDirection == 3 ? 0 : openDirection == 4 ? 3 : openDirection == 2 ? 1 : 2; foreach(Player p in Server.getPlayerList()) { p.getPackets().removeObject(new Location(newX, newY, 0), openDoorId == 6713 ? 4 : 3, 0); p.getPackets().removeObject(new Location(newX2, newY2, 0), openDoorId2 == 6732 ? 3 : 4, 0); p.getPackets().createObject(DOORS[index], clickedDoor, face, 0); p.getPackets().createObject(DOORS[index2], otherDoor, face, 0); } player.removeTemporaryAttribute("unmovable"); if (!betweenDoors) { player.getPackets().sendConfig(1270, 1); player.setTemporaryAttribute("betweenDoors", true); } else { player.getPackets().sendConfig(1270, 0); player.removeTemporaryAttribute("betweenDoors"); } betweenDoorsEvent.stop(); }); Server.registerEvent(betweenDoorsEvent); }); Server.registerCoordinateEvent(doorsWalkAreaEvent); return true; }
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); } }
public static void setAutoCastSpell(Player p, int spell, int spellIndex, bool ancients) { p.getPackets().modifyText(AUTOCAST_NAME[spell], 90, 11); p.getPackets().showChildInterface(90, 83, false); p.getPackets().showChildInterface(90, AUTOCAST_CONFIG[spell], true); p.getPackets().sendConfig(43, 3); p.getPackets().sendTab(83, 90); p.getPackets().modifyText(p.getEquipment().getSlot(ItemData.EQUIP.WEAPON).getDefinition().getName(), 90, 0); p.setTemporaryAttribute("autoCastSpell", spellIndex); p.setTemporaryAttribute("autoCastSpell2", spell); if (ancients) { p.setTemporaryAttribute("autoCastAncients", ancients); } else { p.removeTemporaryAttribute("autoCastAncients"); } }
public static void configureSelectSpellInterface(Player p) { p.removeTemporaryAttribute("autoCasting"); if (p.getMagicType() == 1) { if (p.getEquipment().getItemInSlot(ItemData.EQUIP.WEAPON) == 4170) { // Slayer staff. p.getPackets().sendTab(83, 310); return; } else if (p.getEquipment().getItemInSlot(ItemData.EQUIP.WEAPON) == 8841) { // Void knight mace. p.getPackets().sendTab(83, 406); return; } else { p.getPackets().sendTab(83, 319); } } else if (p.getMagicType() == 2) { if (p.getEquipment().getItemInSlot(ItemData.EQUIP.WEAPON) == 4675) { // Ancient staff. p.getPackets().sendTab(83, 388); } else { p.getPackets().sendMessage("You cannot autocast Ancient Magic with this staff."); } } }
public static void cancelAutoCast(Player p, bool cancelCast) { if (cancelCast) { p.getEquipment().setWeapon(); //p.getPackets().sendConfig(43, 0); resetSpellIcon(p); p.removeTemporaryAttribute("autoCastSpell"); p.removeTemporaryAttribute("autoCastAncients"); p.getPackets().showChildInterface(90, 83, true); p.getPackets().modifyText("Spell", 90, 11); return; } if (p.getTemporaryAttribute("autoCastSpell") != null) { setAutoCastSpell(p, (int)p.getTemporaryAttribute("autoCastSpell2"), (int)p.getTemporaryAttribute("autoCastSpell"), (bool)(p.getTemporaryAttribute("autoCastAncients") != null ? true : false)); } else { //p.getPackets().sendConfig(43, 0); resetSpellIcon(p); p.getEquipment().setWeapon(); p.getPackets().showChildInterface(90, 83, true); p.getPackets().modifyText("Spell", 90, 11); p.removeTemporaryAttribute("autoCastSpell"); p.removeTemporaryAttribute("autoCastAncients"); p.removeTemporaryAttribute("autoCastSpell2"); } }
/* * NOTE: Anything that goes in here and varies between HD and LD, * reset the variable in ActionSender.configureGameScreen */ public void updateVariables(Player p) { int currentLevel = p.getLocation().wildernessLevel(); if (currentLevel != -1) { //Is in wilderness. int lastWildLevel = (p.getTemporaryAttribute("wildLvl") == null) ? -1 : (int)p.getTemporaryAttribute("wildLvl"); if (currentLevel != lastWildLevel) { if (currentLevel > 0) { p.setTemporaryAttribute("wildLvl", currentLevel); if (p.getTemporaryAttribute("inWild") == null) { p.getPackets().sendPlayerOption("Attack", 1, 1); p.getPackets().sendOverlay(381); p.setTemporaryAttribute("inWild", true); } } else { if (p.getTemporaryAttribute("inWild") != null) { p.getPackets().sendPlayerOption("null", 1, 1); p.getPackets().sendRemoveOverlay(); p.removeTemporaryAttribute("wildLvl"); p.removeTemporaryAttribute("inWild"); } } } } if (Location.inMultiCombat(p.getLocation())) { if (p.getTemporaryAttribute("inMulti") == null) { p.getPackets().displayMultiIcon(); p.setTemporaryAttribute("inMulti", true); } } else { if (p.getTemporaryAttribute("inMulti") != null) { p.getPackets().removeMultiIcon(); p.removeTemporaryAttribute("inMulti"); } } if (Location.atDuelArena(p.getLocation())) { if (p.getDuel() != null) { if (p.getDuel().getStatus() == 5 || p.getDuel().getStatus() == 6) { p.getPackets().sendPlayerOption("Fight", 1, 1); } } if (p.getTemporaryAttribute("challengeUpdate") != null) { p.getPackets().sendPlayerOption("Challenge", 1, 0); p.removeTemporaryAttribute("challengeUpdate"); } if (p.getTemporaryAttribute("atDuelArea") == null) { p.getPackets().sendPlayerOption("Challenge", 1, 0); p.getPackets().sendOverlay(638); p.setTemporaryAttribute("atDuelArea", true); } } else { if (p.getTemporaryAttribute("atDuelArea") != null) { p.getPackets().sendPlayerOption("null", 1, 0); p.getPackets().sendRemoveOverlay(); p.removeTemporaryAttribute("atDuelArea"); } } if (Location.atBarrows(p.getLocation())) { if (p.getTemporaryAttribute("atBarrows") == null) { p.getPackets().sendOverlay(24); p.getPackets().setMinimapStatus(2); p.getPackets().sendConfig(452, 2652256); // doors if (p.getTemporaryAttribute("betweenDoors") == null) { if (Barrows.betweenDoors(p)) { p.setTemporaryAttribute("betweenDoors", true); p.getPackets().sendConfig(1270, 1); } } p.getPackets().modifyText("Kill Count: " + p.getBarrowKillCount(), 24, 0); p.setTemporaryAttribute("atBarrows", true); Barrows.prayerDrainEvent(p); bool allBrothersKilled = true; for (int i = 0; i < 6; i++) { if (!p.getBarrowBrothersKilled(i)) { allBrothersKilled = false; } } if (allBrothersKilled) { Barrows.startEarthQuake(p); } } } else { if (p.getTemporaryAttribute("atBarrows") != null) { bool allBrothersKilled = true; for (int i = 0; i < 6; i++) { if (!p.getBarrowBrothersKilled(i)) { allBrothersKilled = false; } } if (allBrothersKilled) { for (int i = 0; i < 6; i++) { p.setBarrowBrothersKilled(i, false); p.setBarrowTunnel(-1); p.setBarrowKillCount(0); p.getPackets().resetCamera(); p.removeTemporaryAttribute("lootedBarrowChest"); } p.getPackets().resetCamera(); p.getPackets().sendRemoveOverlay(); p.removeTemporaryAttribute("atBarrows"); p.removeTemporaryAttribute("barrowTunnel"); p.getPackets().setMinimapStatus(0); Barrows.removeBrotherFromGame(p); } } if (Location.atGodwars(p.getLocation())) { if (p.getTemporaryAttribute("atGodwars") == null) { p.getPackets().sendOverlay(601); p.setTemporaryAttribute("atGodwars", true); } } else { if (p.getTemporaryAttribute("atGodwars") != null) { p.getPackets().sendRemoveOverlay(); p.removeTemporaryAttribute("atGodwars"); } } if (Location.atAgilityArena(p.getLocation())) { if (p.getTemporaryAttribute("atAgilityArena") == null) { p.getPackets().sendOverlay(5); AgilityArena.updatePillarForPlayer(p); p.setTemporaryAttribute("atAgilityArena", true); } if (p.getLocation().getZ() == 0) { p.removeTemporaryAttribute("atAgilityArena"); p.getPackets().sendRemoveOverlay(); p.setAgilityArenaStatus(0); p.setTaggedLastAgilityPillar(false); } } else { if (p.getTemporaryAttribute("atAgilityArena") != null) { p.getPackets().sendRemoveOverlay(); p.setAgilityArenaStatus(0); p.setTaggedLastAgilityPillar(false); p.removeTemporaryAttribute("atAgilityArena"); } } /* * We check the cantDoAnything variable to determine whether they're using the orb. */ if (Location.inFightPitsWaitingArea(p.getLocation())) { if (p.getTemporaryAttribute("waitingForFightPits") == null) { Server.getMinigames().getFightPits().addWaitingPlayer(p); p.setTemporaryAttribute("waitingForFightPits", true); } } else { if (p.getTemporaryAttribute("waitingForFightPits") != null && p.getTemporaryAttribute("cantDoAnything") == null) { Server.getMinigames().getFightPits().removeWaitingPlayer(p); p.removeTemporaryAttribute("waitingForFightPits"); } } if (Location.inFightPits(p.getLocation())) { if (p.getTemporaryAttribute("cantDoAnything") == null) { if (p.getTemporaryAttribute("inFightPits") == null) { p.getPackets().sendPlayerOption("Attack", 1, 1); Server.getMinigames().getFightPits().displayFightPitsInterface(p); p.setTemporaryAttribute("inFightPits", true); } } } else { if (p.getTemporaryAttribute("inFightPits") != null) { p.getPackets().sendPlayerOption("null", 1, 1); p.getPackets().sendRemoveOverlay(); p.removeTemporaryAttribute("inFightPits"); } } if (Location.onWaterbirthIsle(p.getLocation())) { if (p.getTemporaryAttribute("snowInterface") == null) { p.getPackets().sendOverlay(370); p.setTemporaryAttribute("snowInterface", true); } } else { if (p.getTemporaryAttribute("snowInterface") != null) { p.getPackets().sendRemoveOverlay(); p.removeTemporaryAttribute("snowInterface"); } } } }
public static void teleport(Player p, LoadedLaddersAndStairs.HeightObject obj) { p.getWalkingQueue().resetWalkingQueue(); p.setTemporaryAttribute("unmovable", true); p.setFaceLocation(obj.getLocation()); if (obj.getAnimation() != -1) { p.setLastAnimation(new Animation(obj.getAnimation())); } Event teleportEvent = new Event(obj.getAnimation() != -1 ? obj.getTeleDelay() : 500); teleportEvent.setAction(() => { teleportEvent.stop(); p.teleport(obj.getTeleLocation()); p.removeTemporaryAttribute("unmovable"); }); Server.registerEvent(teleportEvent); }