@Override protected boolean thinkActive() { NpcInstance actor = getActor(); int[][] coords; coords = SMP_COORDS; actor.setRunning(); if (actor.getTarget() == null || currentState >= coords.length || currentState == 0) { if (currentState < coords.length) { actor.moveToLocation( coords[currentState][0], coords[currentState][1], coords[currentState][2], Rnd.get(0, 50), true); if (actor.getDestination() == null) { ++currentState; } } else { actor.doDie(actor); } } if (lastSayTimer + SAY_RAFF < System.currentTimeMillis()) { lastSayTimer = System.currentTimeMillis(); Functions.npcSay(actor, NpcString.ITS_HERE, ChatType.NPC_ALL, 800); } return true; }
@Override protected boolean thinkActive() { NpcInstance actor = getActor(); if (actor.isDead()) return true; if (_def_think) { doTask(); return true; } if (System.currentTimeMillis() > wait_timeout && (current_point > -1 || Rnd.chance(5))) { if (!wait) switch (current_point) { case 5: wait_timeout = System.currentTimeMillis() + 15000; Functions.npcSay(actor, "The Mother Tree is always so gorgeous!"); wait = true; return true; case 9: wait_timeout = System.currentTimeMillis() + 60000; Functions.npcSay(actor, "Lady Mirabel, may the peace of the lake be with you!"); wait = true; return true; } wait_timeout = 0; wait = false; current_point++; if (current_point >= points.length) current_point = 0; addTaskMove(points[current_point], true); doTask(); return true; } if (randomAnimation()) return true; return false; }
@Override protected boolean thinkActive() { NpcInstance actor = getActor(); Creature target = actor.getFollowTarget(); if (target == null || !(target instanceof Player)) { if (actor != null) actor.deleteMe(); return false; } int npcId = actor.getNpcId(); int[][] coords; NpcString string; NpcString end_String; // Select coords switch (npcId) { case SEARCHING_MYST_POWER_SOLDIER: coords = SMP_COORDS; string = SEARCHING_MYST_POWER_STRING; end_String = NpcString.S1_THAT_MAN_IN_FRONT_IS_IBANE; break; case BACKUP_SEEKERS_ASSASSIN: coords = BS_COORDS; string = BACKUP_SEEKERS_STRING; end_String = NpcString.TALK_TO_THAT_APPRENTICE_AND_GET_ON_KOOKARU; break; case GOING_INTO_REAL_WAR_SOLDIER: double distLeft = target.getDistance(GRW_COORDS_LEFT[0][0], GRW_COORDS_LEFT[0][1], GRW_COORDS_LEFT[0][2]); double distRight = target.getDistance( GRW_COORDS_RIGHT[0][0], GRW_COORDS_RIGHT[0][1], GRW_COORDS_RIGHT[0][2]); if (distLeft <= distRight) coords = GRW_COORDS_LEFT; else coords = GRW_COORDS_RIGHT; string = GOING_INTO_REAL_WAR_STRING; end_String = NpcString.S1_THAT_MAN_IN_FRONT_IS_HOLDEN; break; default: return false; } // Нужно всё это переписать. // This NPC is running actor.setRunning(); if (actor.getDistance(target) < 100 || currentState == 0 || currentState >= coords.length) { if (currentState < coords.length) { actor.moveToLocation( coords[currentState][0], coords[currentState][1], coords[currentState][2], Rnd.get(0, 50), true); if (actor.getDestination() == null) { ++currentState; } } else { Functions.npcSay(actor, end_String, target.getName()); actor.deleteMe(); } } else if (lastSayTime + SAY_INTERVAL < System.currentTimeMillis() && actor.getDestination() == null) { int heading = actor.calcHeading(target.getX(), target.getY()); actor.setHeading(heading); actor.broadcastPacket(new ExRotation(actor.getObjectId(), heading)); lastSayTime = System.currentTimeMillis(); Functions.npcSay(actor, string, target.getName()); } return true; }
@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); }
public void Say(String test) { for (NpcInstance _npc : _spawn.getAllSpawned()) Functions.npcSay(_npc, test); }