mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-10 10:20:41 -07:00
Fixed pest control spinner NPCs returning to spawn and becoming unattackable (pest control now playable again)
This commit is contained in:
parent
dff8bf5c14
commit
c8f6f9cb59
4 changed files with 89 additions and 83 deletions
|
|
@ -24,57 +24,64 @@ 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 = {
|
||||||
{ 3728, 3729, 3730 }, // Intermediate
|
{ 3727, 3728, 3729 }, // Novice
|
||||||
{ 3729, 3730, 3731 }, // Veteran
|
{ 3728, 3729, 3730 }, // Intermediate
|
||||||
|
{ 3729, 3730, 3731 }, // Veteran
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The shifter NPCs.
|
* The shifter NPCs.
|
||||||
*/
|
*/
|
||||||
private static final int[][] SHIFTERS = { { 3732, 3733, 3734, 3735, 3736, 3737 }, // Novice
|
private static final int[][] SHIFTERS = {
|
||||||
{ 3734, 3735, 3736, 3737, 3738, 3739 }, // Intermediate
|
{ 3732, 3733, 3734, 3735, 3736, 3737 }, // Novice
|
||||||
{ 3736, 3737, 3738, 3739, 3740, 3741 }, // Veteran
|
{ 3734, 3735, 3736, 3737, 3738, 3739 }, // Intermediate
|
||||||
|
{ 3736, 3737, 3738, 3739, 3740, 3741 }, // Veteran
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The ravager NPCs.
|
* The ravager NPCs.
|
||||||
*/
|
*/
|
||||||
private static final int[][] RAVAGERS = { { 3742, 3743, 3744 }, // Novice
|
private static final int[][] RAVAGERS = {
|
||||||
{ 3743, 3744, 3745 }, // Intermediate
|
{ 3742, 3743, 3744 }, // Novice
|
||||||
{ 3744, 3745, 3746 }, // Veteran
|
{ 3743, 3744, 3745 }, // Intermediate
|
||||||
|
{ 3744, 3745, 3746 }, // Veteran
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The spinner NPCs.
|
* The spinner NPCs.
|
||||||
*/
|
*/
|
||||||
private static final int[][] SPINNERS = { { 3747, 3748, 3749 }, // Novice
|
private static final int[][] SPINNERS = {
|
||||||
{ 3748, 3749, 3750 }, // Intermediate
|
{ 3747, 3748, 3749 }, // Novice
|
||||||
{ 3749, 3750, 3751 }, // Veteran
|
{ 3748, 3749, 3750 }, // Intermediate
|
||||||
|
{ 3749, 3750, 3751 }, // Veteran
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The torcher NPCs.
|
* The torcher NPCs.
|
||||||
*/
|
*/
|
||||||
private static final int[][] TORCHERS = { { 3752, 3753, 3754, 3755, 3756, 3757 }, // Novice
|
private static final int[][] TORCHERS = {
|
||||||
{ 3754, 3755, 3756, 3757, 3758, 3759 }, // Intermediate
|
{ 3752, 3753, 3754, 3755, 3756, 3757 }, // Novice
|
||||||
{ 3756, 3757, 3758, 3759, 3760, 3761 }, // Veteran
|
{ 3754, 3755, 3756, 3757, 3758, 3759 }, // Intermediate
|
||||||
|
{ 3756, 3757, 3758, 3759, 3760, 3761 }, // Veteran
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The defiler NPCs.
|
* The defiler NPCs.
|
||||||
*/
|
*/
|
||||||
private static final int[][] DEFILERS = { { 3762, 3763, 3764, 3765, 3766, 3767 }, // Novice
|
private static final int[][] DEFILERS = {
|
||||||
{ 3764, 3765, 3766, 3767, 3768, 3769 }, // Intermediate
|
{ 3762, 3763, 3764, 3765, 3766, 3767 }, // Novice
|
||||||
{ 3766, 3767, 3768, 3769, 3770, 3771 }, // Veteran
|
{ 3764, 3765, 3766, 3767, 3768, 3769 }, // Intermediate
|
||||||
|
{ 3766, 3767, 3768, 3769, 3770, 3771 }, // Veteran
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The brawler NPCs.
|
* The brawler NPCs.
|
||||||
*/
|
*/
|
||||||
private static final int[][] BRAWLERS = { { 3772, 3773, 3774 }, // Novice
|
private static final int[][] BRAWLERS = {
|
||||||
{ 3773, 3774, 3775 }, // Intermediate
|
{ 3772, 3773, 3774 }, // Novice
|
||||||
{ 3774, 3775, 3776 }, // Veteran
|
{ 3773, 3774, 3775 }, // Intermediate
|
||||||
|
{ 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}.
|
||||||
|
|
@ -151,10 +157,10 @@ public final class PCPortalNPC extends AbstractNPC {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldPreventStacking(Entity mover) {
|
public boolean shouldPreventStacking(Entity mover) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onImpact(final Entity entity, BattleState state) {
|
public void onImpact(final Entity entity, BattleState state) {
|
||||||
|
|
@ -189,49 +195,49 @@ public final class PCPortalNPC extends AbstractNPC {
|
||||||
for (int i = 0; i < amount; i++) {
|
for (int i = 0; i < amount; i++) {
|
||||||
int[] ids = SHIFTERS[index];
|
int[] ids = SHIFTERS[index];
|
||||||
switch (r.nextInt(7)) {
|
switch (r.nextInt(7)) {
|
||||||
case 0:
|
case 0:
|
||||||
ids = SPLATTERS[index];
|
ids = SPLATTERS[index];
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
ids = SHIFTERS[index];
|
ids = SHIFTERS[index];
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
ids = RAVAGERS[index];
|
ids = RAVAGERS[index];
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
boolean spawn = false;
|
boolean spawn = false;
|
||||||
for (PCSpinnerNPC npc : spinners) {
|
for (PCSpinnerNPC npc : spinners) {
|
||||||
if (npc == null || !npc.isActive()) {
|
if (npc == null || !npc.isActive()) {
|
||||||
spawn = true;
|
spawn = true;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
if (spawn) {
|
||||||
if (spawn) {
|
ids = SPINNERS[index];
|
||||||
ids = SPINNERS[index];
|
} else {
|
||||||
} else {
|
ids = TORCHERS[index];
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
ids = TORCHERS[index];
|
ids = TORCHERS[index];
|
||||||
}
|
break;
|
||||||
break;
|
case 5:
|
||||||
case 4:
|
|
||||||
ids = TORCHERS[index];
|
|
||||||
break;
|
|
||||||
case 5:
|
|
||||||
ids = DEFILERS[index];
|
|
||||||
break;
|
|
||||||
case 6:
|
|
||||||
spawn = false;
|
|
||||||
for (NPC npc : brawlers) {
|
|
||||||
if (npc == null || !npc.isActive()) {
|
|
||||||
spawn = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (spawn) {
|
|
||||||
ids = BRAWLERS[index];
|
|
||||||
} else {
|
|
||||||
ids = DEFILERS[index];
|
ids = DEFILERS[index];
|
||||||
}
|
break;
|
||||||
break;
|
case 6:
|
||||||
|
spawn = false;
|
||||||
|
for (NPC npc : brawlers) {
|
||||||
|
if (npc == null || !npc.isActive()) {
|
||||||
|
spawn = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (spawn) {
|
||||||
|
ids = BRAWLERS[index];
|
||||||
|
} else {
|
||||||
|
ids = DEFILERS[index];
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
int x = dir.getStepX() * 3;
|
int x = dir.getStepX() * 3;
|
||||||
int y = dir.getStepY() * 3;
|
int y = dir.getStepY() * 3;
|
||||||
|
|
@ -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 };
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -111,10 +111,10 @@ public final class PCSpinnerNPC extends AbstractNPC {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldPreventStacking(Entity mover) {
|
public boolean shouldPreventStacking(Entity mover) {
|
||||||
return mover instanceof NPC;
|
return mover instanceof NPC;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onImpact(final Entity entity, BattleState state) {
|
public void onImpact(final Entity entity, BattleState state) {
|
||||||
|
|
|
||||||
|
|
@ -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()){
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue