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 onBypassFeedback(Player player, String command) { if (!canBypassCheck(player, this)) return; if (command.startsWith("ExitSoloKama")) { Reflection r = getReflection(); if (r.getReturnLoc() != null) player.teleToLocation(r.getReturnLoc(), ReflectionManager.DEFAULT); else player.setReflection(ReflectionManager.DEFAULT); player.unsetVar("backCoords"); r.startCollapseTimer(1000); } else if (command.startsWith("ListPossible")) { if (getNpcId() == 32484 && Config.ALT_KAMALOKA_NIGHTMARES_PREMIUM_ONLY && !player.hasBonus()) { showChatWindow(player, "instance/soloKamaloka/32484-no.htm"); return; } // FIXME [G1ta0] исправить, когда будет реализованы индивидуальные параметры спавна DomainArea domain = MapRegionManager.getInstance().getRegionData(DomainArea.class, this); String htmlpath = "instance/soloKamaloka/" + getNpcId(); if (domain != null) switch (domain.getId()) { case 1: // Town of Gludio htmlpath += "-gludio"; break; case 2: // Town of Dion htmlpath += "-dion"; break; case 4: // Town of Oren htmlpath += "-oren"; break; case 6: // Heine htmlpath += "-heine"; break; case 8: // Rune Township htmlpath += "-rune"; break; case 9: // Town of Schuttgart htmlpath += "-schuttgart"; break; } htmlpath += ".htm"; showChatWindow(player, htmlpath); } else if (command.startsWith("ShowResults")) { String htmlpath = "instance/soloKamaloka/" + getNpcId(); switch (getRewardRank()) { case 0: htmlpath += "-F"; break; case 1: htmlpath += "-D"; break; case 2: htmlpath += "-C"; break; case 3: htmlpath += "-B"; break; case 4: htmlpath += "-A"; break; case 5: htmlpath += "-S"; break; case 6: if (getReflection().getInstancedZoneId() == INSTANCE_75LVL_ID) // G-Grade награда доступна только в соло камалоке 70-80 // уровней. htmlpath += "-G"; else htmlpath += "-S"; break; } htmlpath += ".htm"; showChatWindow(player, htmlpath); } else if (command.startsWith("SoloKamaReward")) { if (!_rewarded) { int[][] rewards = getRewardList(getRewardRank(), getReflection().getInstancedZone()); if (rewards != null) for (int[] item : rewards) if (item != null) { int id = item[0]; int count = item[1]; if (id > 0 && count > 0) Functions.addItem(player, id, count); } _rewarded = true; } showChatWindow(player, 1); } else if (command.startsWith("Chat")) try { int val = Integer.parseInt(command.substring(5)); showChatWindow(player, val); } catch (NumberFormatException nfe) { String filename = command.substring(5).trim(); if (filename.length() == 0) showChatWindow(player, "npcdefault.htm"); else showChatWindow(player, filename); } else if (command.startsWith("solo_kamaloka")) { int val = Integer.parseInt(command.substring(14)); Reflection r = player.getActiveReflection(); if (r != null) { if (player.canReenterInstance(val)) player.teleToLocation(r.getTeleportLoc(), r); } else if (player.canEnterInstance(val)) { ReflectionUtils.enterReflection(player, new KamalokaNightmare(player), val); } } else super.onBypassFeedback(player, command); }