/** * Shows a movie to the players in the lair. * * @param target - L2NpcInstance target is the center of this movie * @param dist - int distance from target * @param yaw - angle of movie (north = 90, south = 270, east = 0 , west = 180) * @param pitch - pitch > 0 looks up / pitch < 0 looks down * @param time - fast ++ or slow -- depends on the value * @param duration - How long to watch the movie * @param socialAction - 1,2,3,4 social actions / other values do nothing */ private void showSocialActionMovie( NpcInstance target, int dist, int yaw, int pitch, int time, int duration, int socialAction) { if (target == null) return; for (Player pc : getPlayers()) if (pc.getDistance(target) <= 2550) { pc.enterMovieMode(); pc.specialCamera(target, dist, yaw, pitch, time, duration); } else pc.leaveMovieMode(); if (socialAction > 0 && socialAction < 5) target.broadcastPacket(new SocialActionPacket(target.getObjectId(), socialAction)); }
@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; }