Beispiel #1
0
 public static final void processLunarSpell(Player player, int spellId, int packetId) {
   player.stopAll(false);
   switch (spellId) {
     case 37:
       if (player.getSkills().getLevel(Skills.MAGIC) < 94) {
         player
             .getPackets()
             .sendGameMessage("Your Magic level is not high enough for this spell.");
         return;
       } else if (player.getSkills().getLevel(Skills.DEFENCE) < 40) {
         player.getPackets().sendGameMessage("You need a Defence level of 40 for this spell");
         return;
       }
       Long lastVeng = (Long) player.getTemporaryAttributtes().get("LAST_VENG");
       if (lastVeng != null && lastVeng + 30000 > Utils.currentTimeMillis()) {
         player
             .getPackets()
             .sendGameMessage("Players may only cast vengeance once every 30 seconds.");
         return;
       }
       if (!checkRunes(player, true, ASTRAL_RUNE, 4, DEATH_RUNE, 2, EARTH_RUNE, 10)) return;
       player.setNextGraphics(new Graphics(726, 0, 100));
       player.setNextAnimation(new Animation(4410));
       player.setCastVeng(true);
       player.getTemporaryAttributtes().put("LAST_VENG", Utils.currentTimeMillis());
       player.getPackets().sendGameMessage("You cast a vengeance.");
       break;
     case 39:
       useHomeTele(player);
       break;
   }
 }
 @Override
 public boolean submitSpecial(Object object) {
   Player player = (Player) object;
   player.setNextGraphics(new Graphics(1316));
   player.setNextAnimation(new Animation(7660));
   // Magic.sendTeleportSpell(player, upEmoteId, downEmoteId, upGraphicId,
   // downGraphicId, 0, 0, tile, 3, true, Magic.OBJECT_TELEPORT);
   return true;
 }
Beispiel #3
0
 public static void pushLeverTeleport(final Player player, final WorldTile tile) {
   if (!player.getControlerManager().processObjectTeleport(tile)) return;
   player.setNextAnimation(new Animation(2140));
   player.lock();
   WorldTasksManager.schedule(
       new WorldTask() {
         @Override
         public void run() {
           player.unlock();
           Magic.sendObjectTeleportSpell(player, false, tile);
         }
       },
       1);
 }
Beispiel #4
0
  public static boolean useTeleTab(final Player player, final WorldTile tile) {
    if (!player.getControlerManager().processItemTeleport(tile)) return false;
    player.lock();
    player.setNextAnimation(new Animation(9597));
    player.setNextGraphics(new Graphics(1680));
    WorldTasksManager.schedule(
        new WorldTask() {
          int stage;

          @Override
          public void run() {
            if (stage == 0) {
              player.setNextAnimation(new Animation(4731));
              stage = 1;
            } else if (stage == 1) {
              WorldTile teleTile = tile;
              // attemps to randomize tile by 4x4 area
              for (int trycount = 0; trycount < 10; trycount++) {
                teleTile = new WorldTile(tile, 2);
                if (World.canMoveNPC(
                    tile.getPlane(), teleTile.getX(), teleTile.getY(), player.getSize())) break;
                teleTile = tile;
              }
              player.setNextWorldTile(teleTile);
              player.getControlerManager().magicTeleported(ITEM_TELEPORT);
              if (player.getControlerManager().getControler() == null)
                teleControlersCheck(player, teleTile);
              player.setNextFaceWorldTile(
                  new WorldTile(teleTile.getX(), teleTile.getY() - 1, teleTile.getPlane()));
              player.setDirection(6);
              player.setNextAnimation(new Animation(-1));
              stage = 2;
            } else if (stage == 2) {
              player.resetReceivedDamage();
              player.unlock();
              stop();
            }
          }
        },
        2,
        1);
    return true;
  }
Beispiel #5
0
  public static final boolean sendTeleportSpell(
      final Player player,
      int upEmoteId,
      final int downEmoteId,
      int upGraphicId,
      final int downGraphicId,
      int level,
      final double xp,
      final WorldTile tile,
      int delay,
      final boolean randomize,
      final int teleType,
      int... runes) {
    long currentTime = Utils.currentTimeMillis();
    if (player.getLockDelay() > currentTime) return false;
    if (player.getSkills().getLevel(Skills.MAGIC) < level) {
      player.getPackets().sendGameMessage("Your Magic level is not high enough for this spell.");
      return false;
    }
    if (!checkRunes(player, false, runes)) return false;
    if (teleType == MAGIC_TELEPORT) {
      if (!player.getControlerManager().processMagicTeleport(tile)) return false;
    } else if (teleType == ITEM_TELEPORT) {
      if (!player.getControlerManager().processItemTeleport(tile)) return false;
    } else if (teleType == OBJECT_TELEPORT) {
      if (!player.getControlerManager().processObjectTeleport(tile)) return false;
    }
    checkRunes(player, true, runes);
    player.stopAll();
    if (upEmoteId != -1) player.setNextAnimation(new Animation(upEmoteId));
    if (upGraphicId != -1) player.setNextGraphics(new Graphics(upGraphicId));
    if (teleType == MAGIC_TELEPORT) player.getPackets().sendSound(5527, 0, 2);
    player.lock(3 + delay);
    WorldTasksManager.schedule(
        new WorldTask() {

          boolean removeDamage;

          @Override
          public void run() {
            if (!removeDamage) {
              WorldTile teleTile = tile;
              if (randomize) {
                // attemps to randomize tile by 4x4 area
                for (int trycount = 0; trycount < 10; trycount++) {
                  teleTile = new WorldTile(tile, 2);
                  if (World.canMoveNPC(
                      tile.getPlane(), teleTile.getX(), teleTile.getY(), player.getSize())) break;
                  teleTile = tile;
                }
              }
              player.setNextWorldTile(teleTile);
              player.getControlerManager().magicTeleported(teleType);
              if (player.getControlerManager().getControler() == null)
                teleControlersCheck(player, teleTile);
              if (xp != 0) player.getSkills().addXp(Skills.MAGIC, xp);
              if (downEmoteId != -1)
                player.setNextAnimation(new Animation(downEmoteId == -2 ? -1 : downEmoteId));
              if (downGraphicId != -1) player.setNextGraphics(new Graphics(downGraphicId));
              if (teleType == MAGIC_TELEPORT) {
                player.getPackets().sendSound(5524, 0, 2);
                player.setNextFaceWorldTile(
                    new WorldTile(teleTile.getX(), teleTile.getY() - 1, teleTile.getPlane()));
                player.setDirection(6);
              }
              removeDamage = true;
            } else {
              player.resetReceivedDamage();
              stop();
            }
          }
        },
        delay,
        0);
    return true;
  }