Fixed pest control spinner NPCs returning to spawn and becoming unattackable (pest control now playable again)

This commit is contained in:
MatthewGould123 2022-08-28 08:33:36 +00:00 committed by Ryan
parent dff8bf5c14
commit c8f6f9cb59
4 changed files with 89 additions and 83 deletions

View file

@ -24,7 +24,8 @@ public final class PCPortalNPC extends AbstractNPC {
/** /**
* The splatter NPCs. * The splatter NPCs.
*/ */
private static final int[][] SPLATTERS = { { 3727, 3728, 3729 }, // Novice private static final int[][] SPLATTERS = {
{ 3727, 3728, 3729 }, // Novice
{ 3728, 3729, 3730 }, // Intermediate { 3728, 3729, 3730 }, // Intermediate
{ 3729, 3730, 3731 }, // Veteran { 3729, 3730, 3731 }, // Veteran
}; };
@ -32,7 +33,8 @@ public final class PCPortalNPC extends AbstractNPC {
/** /**
* The shifter NPCs. * The shifter NPCs.
*/ */
private static final int[][] SHIFTERS = { { 3732, 3733, 3734, 3735, 3736, 3737 }, // Novice private static final int[][] SHIFTERS = {
{ 3732, 3733, 3734, 3735, 3736, 3737 }, // Novice
{ 3734, 3735, 3736, 3737, 3738, 3739 }, // Intermediate { 3734, 3735, 3736, 3737, 3738, 3739 }, // Intermediate
{ 3736, 3737, 3738, 3739, 3740, 3741 }, // Veteran { 3736, 3737, 3738, 3739, 3740, 3741 }, // Veteran
}; };
@ -40,7 +42,8 @@ public final class PCPortalNPC extends AbstractNPC {
/** /**
* The ravager NPCs. * The ravager NPCs.
*/ */
private static final int[][] RAVAGERS = { { 3742, 3743, 3744 }, // Novice private static final int[][] RAVAGERS = {
{ 3742, 3743, 3744 }, // Novice
{ 3743, 3744, 3745 }, // Intermediate { 3743, 3744, 3745 }, // Intermediate
{ 3744, 3745, 3746 }, // Veteran { 3744, 3745, 3746 }, // Veteran
}; };
@ -48,7 +51,8 @@ public final class PCPortalNPC extends AbstractNPC {
/** /**
* The spinner NPCs. * The spinner NPCs.
*/ */
private static final int[][] SPINNERS = { { 3747, 3748, 3749 }, // Novice private static final int[][] SPINNERS = {
{ 3747, 3748, 3749 }, // Novice
{ 3748, 3749, 3750 }, // Intermediate { 3748, 3749, 3750 }, // Intermediate
{ 3749, 3750, 3751 }, // Veteran { 3749, 3750, 3751 }, // Veteran
}; };
@ -56,7 +60,8 @@ public final class PCPortalNPC extends AbstractNPC {
/** /**
* The torcher NPCs. * The torcher NPCs.
*/ */
private static final int[][] TORCHERS = { { 3752, 3753, 3754, 3755, 3756, 3757 }, // Novice private static final int[][] TORCHERS = {
{ 3752, 3753, 3754, 3755, 3756, 3757 }, // Novice
{ 3754, 3755, 3756, 3757, 3758, 3759 }, // Intermediate { 3754, 3755, 3756, 3757, 3758, 3759 }, // Intermediate
{ 3756, 3757, 3758, 3759, 3760, 3761 }, // Veteran { 3756, 3757, 3758, 3759, 3760, 3761 }, // Veteran
}; };
@ -64,7 +69,8 @@ public final class PCPortalNPC extends AbstractNPC {
/** /**
* The defiler NPCs. * The defiler NPCs.
*/ */
private static final int[][] DEFILERS = { { 3762, 3763, 3764, 3765, 3766, 3767 }, // Novice private static final int[][] DEFILERS = {
{ 3762, 3763, 3764, 3765, 3766, 3767 }, // Novice
{ 3764, 3765, 3766, 3767, 3768, 3769 }, // Intermediate { 3764, 3765, 3766, 3767, 3768, 3769 }, // Intermediate
{ 3766, 3767, 3768, 3769, 3770, 3771 }, // Veteran { 3766, 3767, 3768, 3769, 3770, 3771 }, // Veteran
}; };
@ -72,7 +78,8 @@ public final class PCPortalNPC extends AbstractNPC {
/** /**
* The brawler NPCs. * The brawler NPCs.
*/ */
private static final int[][] BRAWLERS = { { 3772, 3773, 3774 }, // Novice private static final int[][] BRAWLERS = {
{ 3772, 3773, 3774 }, // Novice
{ 3773, 3774, 3775 }, // Intermediate { 3773, 3774, 3775 }, // Intermediate
{ 3774, 3775, 3776 }, // Veteran { 3774, 3775, 3776 }, // Veteran
}; };
@ -97,15 +104,14 @@ public final class PCPortalNPC extends AbstractNPC {
*/ */
private NPC[] brawlers = new NPC[2]; private NPC[] brawlers = new NPC[2];
/** /**
* The portal ids? * The portal ids?
*/ */
final static Integer[] portalIds = new Integer[] { 6142, 6143, 6144, 6145, 6146, 6147, 6148, 6149, final static Integer[] portalIds = new Integer[] {
6142, 6143, 6144, 6145, 6146, 6147, 6148, 6149,
6150, 6151, 6152, 6153, 6154, 6155, 6156, 6157, 6150, 6151, 6152, 6153, 6154, 6155, 6156, 6157,
7551, 7552, 7553, 7554, 7555, 7556, 7557, 7558
7551, 7552, 7553, 7554, 7555, 7556, 7557, 7558 }; };
/** /**
* Constructs a new {@code PCPortalNPC} {@code Object}. * Constructs a new {@code PCPortalNPC} {@code Object}.
@ -295,11 +301,11 @@ public final class PCPortalNPC extends AbstractNPC {
@Override @Override
public int[] getIds() { public int[] getIds() {
return new int[] { 6142, 6143, 6144, 6145, 6146, 6147, 6148, 6149, return new int[] {
6142, 6143, 6144, 6145, 6146, 6147, 6148, 6149,
6150, 6151, 6152, 6153, 6154, 6155, 6156, 6157, 6150, 6151, 6152, 6153, 6154, 6155, 6156, 6157,
7551, 7552, 7553, 7554, 7555, 7556, 7557, 7558
7551, 7552, 7553, 7554, 7555, 7556, 7557, 7558 }; };
} }
/** /**

View file

@ -307,6 +307,7 @@ public final class PestControlSession {
*/ */
public NPC addNPC(NPC npc) { public NPC addNPC(NPC npc) {
npc.addExtension(PestControlSession.class, this); npc.addExtension(PestControlSession.class, this);
npc.setAttribute("no-spawn-return", true);
npc.init(); npc.init();
return npc; return npc;
} }

View file

@ -403,9 +403,7 @@ public class NPC extends Entity {
/** /**
* Called when the NPC respawns. * Called when the NPC respawns.
*/ */
protected void onRespawn() { protected void onRespawn() {}
}
/** /**
* Handles the automatic actions of the NPC. * Handles the automatic actions of the NPC.
@ -417,6 +415,7 @@ public class NPC extends Entity {
!pathBoundMovement !pathBoundMovement
&& walkRadius > 0 && walkRadius > 0
&& !getLocation().withinDistance(getProperties().getSpawnLocation(), (int)(walkRadius * 1.5)) && !getLocation().withinDistance(getProperties().getSpawnLocation(), (int)(walkRadius * 1.5))
&& !getAttribute("no-spawn-return", false)
) )
{ {
if(!isNeverWalks()){ if(!isNeverWalks()){