mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-14 10:30:20 -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.GameWorld;
|
||||||
import org.crandor.game.world.map.Direction;
|
import org.crandor.game.world.map.Direction;
|
||||||
import org.crandor.game.world.map.Location;
|
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.Animation;
|
||||||
import org.crandor.game.world.update.flag.context.Graphics;
|
import org.crandor.game.world.update.flag.context.Graphics;
|
||||||
import org.crandor.net.packet.PacketRepository;
|
import org.crandor.net.packet.PacketRepository;
|
||||||
|
|
@ -22,25 +21,37 @@ import org.crandor.plugin.Plugin;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created for 2009Scape
|
* Nora T Hagg NPC
|
||||||
* User: Ethan Kyle Millard
|
* @author Ethan, cleaned up by ceik
|
||||||
* Date: March 15, 2020
|
* @date y'know
|
||||||
* Time: 1:14 PM
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@InitializablePlugin
|
@InitializablePlugin
|
||||||
public final class NoraTHaggNPC extends AbstractNPC {
|
public class NoraTHaggNPC extends AbstractNPC {
|
||||||
|
boolean walkdir;
|
||||||
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 NoraTHaggNPC() {
|
public NoraTHaggNPC() {
|
||||||
super(896, Location.create(2904, 3463, 0));
|
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) {
|
private NoraTHaggNPC(int id, Location location) {
|
||||||
super(id, 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) {
|
private boolean canTeleport(Entity t) {
|
||||||
int playerX = t.getLocation().getX();
|
int playerX = t.getLocation().getX();
|
||||||
int npcX = getLocation().getX();
|
int npcX = getLocation().getX();
|
||||||
|
|
@ -58,56 +69,17 @@ public final class NoraTHaggNPC extends AbstractNPC {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void configure() {
|
|
||||||
super.configure();
|
|
||||||
// if (isWalks()) {
|
|
||||||
// configureMovementPath(MOVEMENT_PATH);
|
|
||||||
// }
|
|
||||||
// setWalks(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public AbstractNPC construct(int id, Location location, Object... objects) {
|
public AbstractNPC construct(int id, Location location, Object... objects) {
|
||||||
return new NoraTHaggNPC(id, location);
|
return new NoraTHaggNPC(id, location);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int[] getIds() {
|
public void configure() {
|
||||||
return new int[] { 896 };
|
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) {
|
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