mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-12 09:30:19 -07:00
Fixed nora
This commit is contained in:
parent
daa4e1afba
commit
58204b61b6
1 changed files with 51 additions and 54 deletions
|
|
@ -10,7 +10,6 @@ import org.crandor.game.system.task.Pulse;
|
|||
import org.crandor.game.world.GameWorld;
|
||||
import org.crandor.game.world.map.Direction;
|
||||
import org.crandor.game.world.map.Location;
|
||||
import org.crandor.game.world.map.path.Pathfinder;
|
||||
import org.crandor.game.world.update.flag.context.Animation;
|
||||
import org.crandor.game.world.update.flag.context.Graphics;
|
||||
import org.crandor.net.packet.PacketRepository;
|
||||
|
|
@ -22,25 +21,37 @@ import org.crandor.plugin.Plugin;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created for 2009Scape
|
||||
* User: Ethan Kyle Millard
|
||||
* Date: March 15, 2020
|
||||
* Time: 1:14 PM
|
||||
* Nora T Hagg NPC
|
||||
* @author Ethan, cleaned up by ceik
|
||||
* @date y'know
|
||||
*/
|
||||
|
||||
@InitializablePlugin
|
||||
public final class NoraTHaggNPC extends AbstractNPC {
|
||||
|
||||
private static final Location[] MOVEMENT_PATH = {Location.create(2904, 3463, 0), Location.create(2908, 3463, 0), Location.create(2912, 3463, 0), Location.create(2916, 3463, 0), Location.create(2920, 3463, 0), Location.create(2924, 3463, 0), Location.create(2930, 3463, 0)};
|
||||
private int tilesIndex = 0;
|
||||
|
||||
public class NoraTHaggNPC extends AbstractNPC {
|
||||
boolean walkdir;
|
||||
public NoraTHaggNPC() {
|
||||
super(896, Location.create(2904, 3463, 0));
|
||||
}
|
||||
private Location getRespawnLocation() {
|
||||
return Location.create(2901, 3466, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getIds() {
|
||||
return new int[] { 896 };
|
||||
}
|
||||
|
||||
private NoraTHaggNPC(int id, Location location) {
|
||||
super(id, location);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
this.configure();
|
||||
init();
|
||||
return super.newInstance(arg);
|
||||
}
|
||||
|
||||
private boolean canTeleport(Entity t) {
|
||||
int playerX = t.getLocation().getX();
|
||||
int npcX = getLocation().getX();
|
||||
|
|
@ -58,56 +69,17 @@ public final class NoraTHaggNPC extends AbstractNPC {
|
|||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure() {
|
||||
super.configure();
|
||||
// if (isWalks()) {
|
||||
// configureMovementPath(MOVEMENT_PATH);
|
||||
// }
|
||||
// setWalks(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractNPC construct(int id, Location location, Object... objects) {
|
||||
return new NoraTHaggNPC(id, location);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getIds() {
|
||||
return new int[] { 896 };
|
||||
}
|
||||
public void configure() {
|
||||
super.configure();
|
||||
setWalks(false);
|
||||
setPathBoundMovement(true);
|
||||
|
||||
private Location getRespawnLocation() {
|
||||
return Location.create(2901, 3466, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getWalkRadius() {
|
||||
return 50;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
List<Player> players = getViewport().getCurrentPlane().getPlayers();
|
||||
for (Player player : players) {
|
||||
if (player == null || !player.isActive() || player.getLocks().isInteractionLocked() || DeathTask.isDead(player) || !canTeleport(player) || !CombatSwingHandler.isProjectileClipped(this, player, false)) {
|
||||
continue;
|
||||
}
|
||||
animate(new Animation(5803));
|
||||
sendTeleport(player);
|
||||
}
|
||||
if (getLocation().equals(Location.create(2904, 3463, 0))) {
|
||||
Pathfinder.find(this, Location.create(2930, 3463, 0)).walk(this);
|
||||
} else if (getLocation().equals(Location.create(2930, 3463, 0))) {
|
||||
Pathfinder.find(this, Location.create(2904, 3463, 0)).walk(this);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Plugin<Object> newInstance(Object arg) throws Throwable {
|
||||
return super.newInstance(arg);
|
||||
}
|
||||
|
||||
private void sendTeleport(final Player player) {
|
||||
|
|
@ -138,5 +110,30 @@ public final class NoraTHaggNPC extends AbstractNPC {
|
|||
});
|
||||
}
|
||||
|
||||
}
|
||||
@Override
|
||||
public void tick() {
|
||||
super.tick();
|
||||
List<Player> players = getViewport().getCurrentPlane().getPlayers();
|
||||
if(getLocation().getX() == 2930){
|
||||
walkdir = false;
|
||||
} else if(getLocation().getX() == 2904){
|
||||
walkdir = true;
|
||||
}
|
||||
for (Player player : players) {
|
||||
if (player == null || !player.isActive() || player.getLocks().isInteractionLocked() || DeathTask.isDead(player) || !canTeleport(player) || !CombatSwingHandler.isProjectileClipped(this, player, false)) {
|
||||
continue;
|
||||
}
|
||||
animate(new Animation(5803));
|
||||
sendTeleport(player);
|
||||
player.getPacketDispatch().sendMessage("" + getLocation() + " matches? " + (getLocation().getX() == 2904));
|
||||
}
|
||||
if (location.getX() != 2930 && walkdir) {
|
||||
this.getWalkingQueue().reset();
|
||||
this.getWalkingQueue().addPath(location.getX() + 1,3463,true);
|
||||
} else if (location.getX() != 2904 && !walkdir) {
|
||||
this.getWalkingQueue().reset();
|
||||
this.getWalkingQueue().addPath(location.getX() - 1,3463,true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue