@Override public boolean useItem(Playable playable, ItemInstance item, boolean ctrl) { if (playable == null || !playable.isPlayer()) return false; Player player = playable.getPlayer(); if (player.getTarget() == null || !player.getTarget().isMonster()) { player.sendPacket(SystemMsg.INVALID_TARGET, ActionFail.STATIC); return false; } if (player.isImmobilized() || player.isCastingNow()) { player.sendActionFailed(); return false; } MonsterInstance target = (MonsterInstance) player.getTarget(); // u can use soul crystal only when target hp goes to <50% if (target.getCurrentHpPercents() >= 50) { player.sendPacket( SystemMsg.THE_SOUL_CRYSTAL_WAS_NOT_ABLE_TO_ABSORB_THE_SOUL, ActionFail.STATIC); return false; } // Soul Crystal Casting section int skillHitTime = SkillTable.getInstance().getInfo(SOUL_CRYSTAL_SKILL_ID, 1).getHitTime(); player.broadcastPacket(new MagicSkillUse(player, SOUL_CRYSTAL_SKILL_ID, 1, skillHitTime, 0)); player.sendPacket(new SetupGauge(player, SetupGauge.Colors.BLUE, skillHitTime)); // End Soul Crystal Casting section // Continue execution later player._skillTask = ThreadPoolManager.getInstance() .schedule(new CrystalFinalizer(player, target), skillHitTime); return true; }
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); }