コード例 #1
0
ファイル: Recall.java プロジェクト: namlehong/ertheia
  @Override
  public void useSkill(final Creature activeChar, List<Creature> targets) {
    for (final Creature target : targets)
      if (target != null) {
        final Player pcTarget = target.getPlayer();
        if (pcTarget == null) continue;
        if (!pcTarget.getPlayerAccess().UseTeleport) continue;
        if (pcTarget.getActiveWeaponFlagAttachment() != null) {
          activeChar.sendPacket(SystemMsg.YOU_CANNOT_TELEPORT_WHILE_IN_POSSESSION_OF_A_WARD);
          continue;
        }
        if (pcTarget.isInOlympiadMode()) {
          activeChar.sendPacket(
              SystemMsg
                  .YOU_CANNOT_SUMMON_PLAYERS_WHO_ARE_CURRENTLY_PARTICIPATING_IN_THE_GRAND_OLYMPIAD);
          return;
        }
        if (pcTarget.isInObserverMode()) {
          activeChar.sendPacket(
              new SystemMessagePacket(SystemMsg.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS)
                  .addSkillName(getId(), getLevel()));
          return;
        }

        for (GlobalEvent e : pcTarget.getEvents()) {
          if (!e.canUseTeleport(pcTarget)) {
            activeChar.sendPacket(
                new SystemMessagePacket(SystemMsg.S1_CANNOT_BE_USED_DUE_TO_UNSUITABLE_TERMS)
                    .addSkillName(getId(), getLevel()));
            return;
          }
        }

        if (pcTarget.isInDuel() || pcTarget.getTeam() != TeamType.NONE) {
          activeChar.sendMessage(new CustomMessage("common.RecallInDuel", (Player) activeChar));
          return;
        }
        if (_isItemHandler) {
          // TODO: переделать SOE по TownId на SOE по Loc_id
          if (_itemConsumeId[0] == 7127) // hardin's academy
          {
            pcTarget.teleToLocation(105918, 109759, -3207, 0);
            return;
          }
          if (_itemConsumeId[0] == 7130) // ivory
          {
            pcTarget.teleToLocation(85475, 16087, -3672, 0);
            return;
          }
          if (_itemConsumeId[0] == 7618) {
            pcTarget.teleToLocation(149864, -81062, -5618, 0);
            return;
          }
          if (_itemConsumeId[0] == 7619) {
            pcTarget.teleToLocation(108275, -53785, -2524, 0);
            return;
          }
        }
        if (_loc != null) {
          pcTarget.teleToLocation(_loc, 0);
          return;
        }
        // FIXME [G1ta0] перенести координаты в скиллы
        switch (_townId)
        // To town by Id
        {
          case 1: // Talking Island
            pcTarget.teleToLocation(-114558, 253605, -1536, 0);
            return;
          case 2: // Elven Village
            pcTarget.teleToLocation(45576, 49412, -2950, 0);
            return;
          case 3: // Dark Elven Village
            pcTarget.teleToLocation(12501, 16768, -4500, 0);
            return;
          case 4: // Orc Village
            pcTarget.teleToLocation(-44884, -115063, -80, 0);
            return;
          case 5: // Dwarven Village
            pcTarget.teleToLocation(115790, -179146, -890, 0);
            return;
          case 6: // Town of Gludio
            pcTarget.teleToLocation(-14279, 124446, -3000, 0);
            return;
          case 7: // Gludin Village
            pcTarget.teleToLocation(-82909, 150357, -3000, 0);
            return;
          case 8: // Town of Dion
            pcTarget.teleToLocation(19025, 145245, -3107, 0);
            return;
          case 9: // Town of Giran
            pcTarget.teleToLocation(82272, 147801, -3350, 0);
            return;
          case 10: // Town of Oren
            pcTarget.teleToLocation(82323, 55466, -1480, 0);
            return;
          case 11: // Town of Aden
            pcTarget.teleToLocation(144526, 24661, -2100, 0);
            return;
          case 12: // Hunters Village
            pcTarget.teleToLocation(117189, 78952, -2210, 0);
            return;
          case 13: // Heine
            pcTarget.teleToLocation(110768, 219824, -3624, 0);
            return;
          case 14: // Rune Township
            pcTarget.teleToLocation(43536, -50416, -800, 0);
            return;
          case 15: // Town of Goddard
            pcTarget.teleToLocation(148288, -58304, -2979, 0);
            return;
          case 16: // Town of Schuttgart
            pcTarget.teleToLocation(87776, -140384, -1536, 0);
            return;
          case 17: // Kamael Village
            pcTarget.teleToLocation(-117081, 44171, 507, 0);
            return;
          case 18: // Primeval Isle
            pcTarget.teleToLocation(10568, -24600, -3648, 0);
            return;
          case 19: // Floran Village
            pcTarget.teleToLocation(17144, 170156, -3502, 0);
            return;
          case 20: // Hellbound
            pcTarget.teleToLocation(-16434, 208803, -3664, 0);
            return;
          case 21: // Keucereus Alliance Base
            pcTarget.teleToLocation(-184200, 243080, 1568, 0);
            return;
          case 22: // Steel Citadel
            pcTarget.teleToLocation(8976, 252416, -1928, 0);
            return;
          case 23: // Town of Arcan
            pcTarget.teleToLocation(207559, 86429, -1000, 0);
            return;
          case 24: // Vernon Village
            pcTarget.teleToLocation(-80403, 247853, -3496, 0);
            return;
          case 25: // Gludin Church
            pcTarget.teleToLocation(-79592, 150824, -3066, 0);
            return;
          case 26: // Windy Hill
            pcTarget.teleToLocation(-93649, 89763, -3208, 0);
            return;
          case 27: // Orc Barrack
            pcTarget.teleToLocation(-85672, 106664, -3577, 0);
            return;
          case 28: // Town of Dion - front of Sylvain
            pcTarget.teleToLocation(16376, 142296, -2718, 0);
            return;
          case 29: // Cruma Tower - front of Lorain
            pcTarget.teleToLocation(16520, 113384, -3605, 0);
            return;
          case 30: // Cruma Tower - front of Rombel
            pcTarget.teleToLocation(17776, 114851, -11704, 0);
            return;
          case 31: // Town of Oren - front of Hollint
            pcTarget.teleToLocation(83633, 53064, -1456, 0);
            return;
          case 32: // Sea of Spore - front of Andy
            pcTarget.teleToLocation(64328, 26803, -3768, 0);
            return;
          case 33: // Town of Aden - front of Orven
            pcTarget.teleToLocation(147446, 22761, -1984, 0);
            return;
          case 34: // Forsaken Plains - front of Novain
            pcTarget.teleToLocation(174470, 40112, -4144, 0);
            return;
          case 35: // Scroll of Escape: Fields of Massacre
            pcTarget.teleToLocation(183543, -14974, -2768, 0);
            return;
          case 36: // Scroll of Escape: Town of Rune
            pcTarget.teleToLocation(174470, 40112, -4144, 0);
            return;
          case 37: // Scroll of Escape: Swamp of Screams
            pcTarget.teleToLocation(174470, 40112, -4144, 0);
            return;
          case 38: // Scroll of Escape: Town of Goddard
            pcTarget.teleToLocation(174470, 40112, -4144, 0);
            return;
          case 39: // Scroll of Escape: Wall of Argos
            pcTarget.teleToLocation(174470, 40112, -4144, 0);
            return;
          case 40: // croll of Escape: Town of Giran
            pcTarget.teleToLocation(174470, 40112, -4144, 0);
            return;
          case 41: // Scroll of Escape: Dragon Valley
            pcTarget.teleToLocation(174470, 40112, -4144, 0);
            return;
        }
        if (_castle) // To castle
        {
          pcTarget.teleToCastle();
          return;
        }
        if (_clanhall) // to clanhall
        {
          pcTarget.teleToClanhall();
          return;
        }
        if (_fortress) // To fortress
        {
          pcTarget.teleToFortress();
          return;
        }

        pcTarget.teleToClosestTown();
      }

    if (isSSPossible()) activeChar.unChargeShots(isMagic());

    super.useSkill(activeChar, targets);
  }
コード例 #2
0
  public void teleportPlayer(FightBattleArenaObject arena) {
    Player player = _player;
    if (player == null) return;

    if (player.isTeleporting()) {
      _player = null;
      return;
    }

    if (player.isInObserverMode()) {
      if (player.getOlympiadObserveGame() != null) player.leaveOlympiadObserverMode(true);
      else player.leaveObserverMode();
    }

    // Un activate clan skills
    if (player.getClan() != null) player.getClan().disableSkills(player);

    // Remove Hero Skills
    player.activateHeroSkills(false);

    // Abort casting if player casting
    if (player.isCastingNow()) player.abortCast(true, true);

    // Abort attack if player attacking
    if (player.isAttackingNow()) player.abortAttack(true, true);

    // Удаляем баффы и чужие кубики
    for (Effect e : player.getEffectList().getEffects()) {
      if (!player.isSpecialEffect(e.getSkill())
          && (e.getEffectType() != EffectType.Cubic
              || player.getSkillLevel(e.getSkill().getId()) <= 0)) e.exit();
    }

    // Remove Servitor's Buffs
    Servitor[] servitors = player.getServitors();
    if (servitors.length > 0) {
      for (Servitor servitor : servitors) {
        if (servitor.isPet()) servitor.unSummon(false);
        else {
          servitor.getEffectList().stopAllEffects();
          servitor.transferOwnerBuffs();
        }
      }
    }

    // unsummon agathion
    if (player.getAgathionId() > 0) player.setAgathion(0);

    // Сброс кулдауна всех скилов, время отката которых меньше 15 минут
    for (TimeStamp sts : player.getSkillReuses()) {
      if (sts == null) continue;

      Skill skill = SkillTable.getInstance().getInfo(sts.getId(), sts.getLevel());
      if (skill == null) continue;

      if (sts.getReuseBasic() <= 15 * 60001L) player.enableSkill(skill);
    }

    // Обновляем скилл лист, после удаления скилов
    player.sendPacket(new SkillList(player));

    // Обновляем куллдаун, после сброса
    player.sendPacket(new SkillCoolTime(player));

    // Проверяем одетые вещи на возможность ношения.
    player.getInventory().validateItems();

    // remove bsps/sps/ss automation
    Set<Integer> activeSoulShots = player.getAutoSoulShot();
    for (int itemId : activeSoulShots) {
      player.removeAutoSoulShot(itemId);
      player.sendPacket(new ExAutoSoulShot(itemId, false));
    }

    // Разряжаем заряженные соул и спирит шоты
    ItemInstance weapon = player.getActiveWeaponInstance();
    if (weapon != null) {
      weapon.setChargedSpiritshot(ItemInstance.CHARGED_NONE);
      weapon.setChargedSoulshot(ItemInstance.CHARGED_NONE);
    }

    player.setCurrentCp(player.getMaxCp());
    player.setCurrentMp(player.getMaxMp());

    if (player.isDead()) {
      player.setCurrentHp(player.getMaxHp(), true);
      player.broadcastPacket(new Revive(player));
      // player.broadcastStatusUpdate();
    } else player.setCurrentHp(player.getMaxHp(), false);

    player.broadcastUserInfo(true);

    DuelEvent duel = player.getEvent(DuelEvent.class);
    if (duel != null) duel.abortDuel(player);

    _returnLoc = player.getStablePoint() == null ? player.getLoc() : player.getStablePoint();

    if (player.isSitting()) player.standUp();

    player.setTarget(null);

    player.leaveParty();

    player.setStablePoint(_returnLoc);

    Location loc =
        arena.getMember1() == this
            ? arena.getInfo().getTeleportLoc1()
            : arena.getInfo().getTeleportLoc2();
    player.teleToLocation(
        Location.findPointToStay(loc, 0, arena.getReflection().getGeoIndex()),
        arena.getReflection());

    setDamage(0.);
    setKilled(false);
  }