Пример #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;
   }
 }
Пример #2
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;
  }
Пример #3
0
 private static void useHomeTele(Player player) {
   player.stopAll();
   player.getInterfaceManager().sendInterface(1092);
 }
Пример #4
0
 public static final void processNormalSpell(Player player, int spellId, int packetId) {
   player.stopAll(false);
   switch (spellId) {
     case 25: // air strike
     case 28: // water strike
     case 30: // earth strike
     case 32: // fire strike
     case 34: // air bolt
     case 39: // water bolt
     case 42: // earth bolt
     case 45: // fire bolt
     case 49: // air blast
     case 52: // water blast
     case 58: // earth blast
     case 63: // fire blast
     case 70: // air wave
     case 73: // water wave
     case 77: // earth wave
     case 80: // fire wave
     case 99:
     case 84:
     case 87:
     case 89:
     case 91:
     case 36:
     case 55:
     case 81:
     case 66:
     case 67:
     case 68:
       setCombatSpell(player, spellId);
       break;
     case 27: // crossbow bolt enchant
       if (player.getSkills().getLevel(Skills.MAGIC) < 4) {
         player
             .getPackets()
             .sendGameMessage("Your Magic level is not high enough for this spell.");
         return;
       }
       player.stopAll();
       player.getInterfaceManager().sendInterface(432);
       break;
     case 24:
       useHomeTele(player);
       break;
     case 37: // mobi
       sendNormalTeleportSpell(
           player, 10, 19, new WorldTile(2413, 2848, 0), LAW_RUNE, 1, WATER_RUNE, 1, AIR_RUNE, 1);
       break;
     case 40: // varrock
       sendNormalTeleportSpell(
           player, 25, 19, new WorldTile(3212, 3424, 0), FIRE_RUNE, 1, AIR_RUNE, 3, LAW_RUNE, 1);
       break;
     case 43: // lumby
       sendNormalTeleportSpell(
           player, 31, 41, new WorldTile(3222, 3218, 0), EARTH_RUNE, 1, AIR_RUNE, 3, LAW_RUNE, 1);
       break;
     case 46: // fally
       sendNormalTeleportSpell(
           player, 37, 48, new WorldTile(2964, 3379, 0), WATER_RUNE, 1, AIR_RUNE, 3, LAW_RUNE, 1);
       break;
     case 51: // camelot
       sendNormalTeleportSpell(
           player, 45, 55.5, new WorldTile(2757, 3478, 0), AIR_RUNE, 5, LAW_RUNE, 1);
       break;
     case 57: // ardy
       sendNormalTeleportSpell(
           player, 51, 61, new WorldTile(2664, 3305, 0), WATER_RUNE, 2, LAW_RUNE, 2);
       break;
     case 62: // watch
       sendNormalTeleportSpell(
           player, 58, 68, new WorldTile(2547, 3113, 2), EARTH_RUNE, 2, LAW_RUNE, 2);
       break;
     case 69: // troll
       sendNormalTeleportSpell(
           player, 61, 68, new WorldTile(2888, 3674, 0), FIRE_RUNE, 2, LAW_RUNE, 2);
       break;
     case 72: // ape
       sendNormalTeleportSpell(
           player,
           64,
           76,
           new WorldTile(2776, 9103, 0),
           FIRE_RUNE,
           2,
           WATER_RUNE,
           2,
           LAW_RUNE,
           2,
           1963,
           1);
       break;
   }
 }
Пример #5
0
  public static final void processAncientSpell(Player player, int spellId, int packetId) {
    player.stopAll(false);
    switch (spellId) {
      case 28:
      case 32:
      case 24:
      case 20:
      case 30:
      case 34:
      case 26:
      case 22:
      case 29:
      case 33:
      case 25:
      case 21:
      case 31:
      case 35:
      case 27:
      case 23:
      case 36:
      case 37:
      case 38:
      case 39:
        setCombatSpell(player, spellId);
        break;
      case 40:
        sendAncientTeleportSpell(
            player, 54, 64, new WorldTile(3099, 9882, 0), LAW_RUNE, 2, FIRE_RUNE, 1, AIR_RUNE, 1);
        break;
      case 41:
        sendAncientTeleportSpell(
            player, 60, 70, new WorldTile(3222, 3336, 0), LAW_RUNE, 2, SOUL_RUNE, 1);
        break;
      case 42:
        sendAncientTeleportSpell(
            player, 66, 76, new WorldTile(3492, 3471, 0), LAW_RUNE, 2, BLOOD_RUNE, 1);

        break;
      case 43:
        sendAncientTeleportSpell(
            player, 72, 82, new WorldTile(3006, 3471, 0), LAW_RUNE, 2, WATER_RUNE, 4);
        break;
      case 44:
        sendAncientTeleportSpell(
            player, 78, 88, new WorldTile(2990, 3696, 0), LAW_RUNE, 2, FIRE_RUNE, 3, AIR_RUNE, 2);
        break;
      case 45:
        sendAncientTeleportSpell(
            player, 84, 94, new WorldTile(3217, 3677, 0), LAW_RUNE, 2, SOUL_RUNE, 2);
        break;
      case 46:
        sendAncientTeleportSpell(
            player, 90, 100, new WorldTile(3288, 3886, 0), LAW_RUNE, 2, BLOOD_RUNE, 2);
        break;
      case 47:
        sendAncientTeleportSpell(
            player, 96, 106, new WorldTile(2977, 3873, 0), LAW_RUNE, 2, WATER_RUNE, 8);
        break;
      case 48:
        useHomeTele(player);
        break;
    }
  }