예제 #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 checkSpellRequirements(
     Player player, int level, boolean delete, int... runes) {
   if (player.getSkills().getLevelForXp(Skills.MAGIC) < level) {
     player.getPackets().sendGameMessage("Your Magic level is not high enough for this spell.");
     return false;
   }
   return checkRunes(player, delete, runes);
 }
예제 #3
0
 public Wolverine(
     Player target,
     int id,
     WorldTile tile,
     int mapAreaNameHash,
     boolean canBeAttackFromOutOfArea) {
   super(id, tile, mapAreaNameHash, canBeAttackFromOutOfArea);
   setCombatLevel(target.getSkills().getCombatLevel() + new Random().nextInt(100) + 100);
   int hitpoints =
       1000
           + this.getCombatLevel()
           + target.getSkills().getCombatLevel() / 2
           + new Random().nextInt(10);
   super.getCombatDefinitions().setHitpoints(hitpoints);
   setHitpoints(hitpoints);
   setRandomWalk(true);
   setForceAgressive(true);
   setAttackedBy(target);
   setAtMultiArea(true);
   faceEntity(target);
 }
예제 #4
0
 /**
  * @param player The player.
  * @param object The object.
  * @return {@code true} if the object action got handled, {@code false} if not.
  */
 public boolean handleObjectClick1(Player player, WorldObject object) {
   switch (object.getId()) {
     case 14315:
       if (player.getSkills().getCombatLevel() < 40) {
         player
             .getDialogueManager()
             .startDialogue(
                 "SimpleMessage", "You need a combat level of 40 or more to enter in boat.");
         return false;
       }
       enterInBoat();
       return true;
     case 14314:
       leaveBoat();
       return true;
   }
   return false;
 }
예제 #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;
  }
예제 #6
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;
   }
 }