public static void teleToLocation(Player player, Location loc, Reflection ref) { if (player.isTeleporting() || player.isDeleted()) return; player.setIsTeleporting(true); player.setTarget(null); player.stopMove(); if (player.isInBoat()) player.setBoat(null); player.breakFakeDeath(); player.sendPacket(new TeleportToLocation(player, loc)); player.decayMe(); player.setLoc(loc); if (ref == null) player.setReflection(ReflectionManager.DEFAULT); // Нужно при телепорте с более высокой точки на более низкую, иначе наносится вред от "падения" player.setLastClientPosition(null); player.setLastServerPosition(null); player.sendPacket(new ExTeleportToLocationActivate(player, loc)); }
@Override public void onAction(final Player player, boolean shift) { if (!isTargetable(player)) { player.sendActionFailed(); return; } if (player.getTarget() != this) player.setTarget(this); else if (isAutoAttackable(player)) player.getAI().Attack(this, false, shift); else if (player.getAI().getIntention() != CtrlIntention.AI_INTENTION_FOLLOW) { if (!shift) player.getAI().setIntention(CtrlIntention.AI_INTENTION_FOLLOW, this, Config.FOLLOW_RANGE); else player.sendActionFailed(); } else player.sendActionFailed(); }
@Override public void onAction(Player player, boolean shift) { if (Events.onAction(player, this, shift)) { player.sendActionFailed(); return; } if (this != player.getTarget()) { player.setTarget(this); player.sendPacket(new ValidateLocation(this)); } else { player.sendPacket(new MyTargetSelected(player, this)); if (!isInRange(player, INTERACTION_DISTANCE)) player.getAI().setIntention(CtrlIntention.AI_INTENTION_INTERACT, this); else if (buffs.size() > 4) showChatWindow(player, 1); else showChatWindow(player, 0); player.sendActionFailed(); } }
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); }