Ejemplo n.º 1
0
 public ExUserInfoCubic(Player character) {
   _objectId = character.getObjectId();
   _cubics = character.getCubics().toArray(new EffectCubic[character.getCubics().size()]);
   _agationId = character.getAgathionId();
 }
  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);
  }