Fixed cannons spamming chat about how you're already in combat or that they can't attack your familiar
Improved nechryaels' death spawn multicombat handling DFS now works on skeletal wyverns' ice breath
This commit is contained in:
@@ -71,7 +71,7 @@ public final class GWDGraardorSwingHandler extends CombatSwingHandler {
|
||||
if (!CHAMBER.insideBorder(t.getLocation())) {
|
||||
continue;
|
||||
}
|
||||
if (t.isAttackable(npc, CombatStyle.RANGE)) {
|
||||
if (t.isAttackable(npc, CombatStyle.RANGE, false)) {
|
||||
list.add(new BattleState(entity, t));
|
||||
}
|
||||
}
|
||||
@@ -180,4 +180,4 @@ public final class GWDGraardorSwingHandler extends CombatSwingHandler {
|
||||
else return -1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +87,7 @@ public final class GWDKreeArraSwingHandler extends CombatSwingHandler {
|
||||
if (!CHAMBER.insideBorder(t.getLocation())) {
|
||||
continue;
|
||||
}
|
||||
if (t.isAttackable(npc, CombatStyle.RANGE)) {
|
||||
if (t.isAttackable(npc, CombatStyle.RANGE, false)) {
|
||||
list.add(new BattleState(entity, t));
|
||||
}
|
||||
}
|
||||
@@ -214,4 +214,4 @@ public final class GWDKreeArraSwingHandler extends CombatSwingHandler {
|
||||
else return -1;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ public class GWDZilyanaSwingHandler extends CombatSwingHandler {
|
||||
NPC npc = (NPC) entity;
|
||||
List<BattleState> list = new ArrayList<>(20);
|
||||
for (Entity t : RegionManager.getLocalPlayers(npc.getCenterLocation(), (npc.size() >> 1) + 2)) {
|
||||
if (t.getLocation().getX() < 2908 && t.isAttackable(npc, CombatStyle.MAGIC)) {
|
||||
if (t.getLocation().getX() < 2908 && t.isAttackable(npc, CombatStyle.MAGIC, false)) {
|
||||
list.add(new BattleState(entity, t));
|
||||
}
|
||||
}
|
||||
@@ -157,4 +157,4 @@ public class GWDZilyanaSwingHandler extends CombatSwingHandler {
|
||||
state.getStyle().getSwingHandler().visualizeImpact(entity, victim, state);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,12 +84,14 @@ public final class GodWarsMinionNPC extends AbstractNPC {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttackable(Entity entity, CombatStyle style) {
|
||||
public boolean isAttackable(Entity entity, CombatStyle style, boolean message) {
|
||||
if (boss != null && boss.getId() == 6222 && style == CombatStyle.MELEE && entity instanceof Player) {
|
||||
((Player) entity).getPacketDispatch().sendMessage("The aviansie is flying too high for you to attack using melee.");
|
||||
if(message) {
|
||||
((Player) entity).getPacketDispatch().sendMessage("The aviansie is flying too high for you to attack using melee.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return super.isAttackable(entity, style);
|
||||
return super.isAttackable(entity, style, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -102,12 +102,14 @@ public final class GodWarsNPC extends AbstractNPC {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttackable(Entity entity, CombatStyle style) {
|
||||
public boolean isAttackable(Entity entity, CombatStyle style, boolean message) {
|
||||
if (style == CombatStyle.MELEE && faction == GodWarsFaction.ARMADYL && entity instanceof Player) {
|
||||
((Player) entity).getPacketDispatch().sendMessage("The aviansie is flying too high for you to attack using melee.");
|
||||
if(message) {
|
||||
((Player) entity).getPacketDispatch().sendMessage("The aviansie is flying too high for you to attack using melee.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return super.isAttackable(entity, style);
|
||||
return super.isAttackable(entity, style, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -244,12 +244,14 @@ public final class GodwarsBossNPC extends AbstractNPC {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttackable(Entity entity, CombatStyle style) {
|
||||
public boolean isAttackable(Entity entity, CombatStyle style, boolean message) {
|
||||
if (getId() == 6222 && style == CombatStyle.MELEE && entity instanceof Player) {
|
||||
((Player) entity).getPacketDispatch().sendMessage("The aviansie is flying too high for you to attack using melee.");
|
||||
if(message) {
|
||||
((Player) entity).getPacketDispatch().sendMessage("The aviansie is flying too high for you to attack using melee.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return super.isAttackable(entity, style);
|
||||
return super.isAttackable(entity, style, message);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -126,7 +126,7 @@ public final class KolodionNPC extends AbstractNPC {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttackable(Entity entity, CombatStyle style) {
|
||||
public boolean isAttackable(Entity entity, CombatStyle style, boolean message) {
|
||||
if (style != CombatStyle.MAGIC) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ public final class PCSquireNPC extends AbstractNPC {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttackable(Entity entity, CombatStyle style) {
|
||||
public boolean isAttackable(Entity entity, CombatStyle style, boolean message) {
|
||||
if (DeathTask.isDead(this) || entity instanceof Player) {
|
||||
return false;
|
||||
}
|
||||
|
||||
+2
-2
@@ -115,12 +115,12 @@ public abstract class PyramidPlunderNPC extends AbstractNPC {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttackable(Entity entity, CombatStyle style) {
|
||||
public boolean isAttackable(Entity entity, CombatStyle style, boolean message) {
|
||||
if (entity instanceof Player && entity != player) {
|
||||
((Player) entity).getPacketDispatch().sendMessage("It's not after you.");
|
||||
return false;
|
||||
}
|
||||
return super.isAttackable(entity, style);
|
||||
return super.isAttackable(entity, style, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -84,14 +84,14 @@ public final class AnimatedArmour extends NPC {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttackable(Entity entity, CombatStyle style) {
|
||||
public boolean isAttackable(Entity entity, CombatStyle style, boolean message) {
|
||||
if (entity != player) {
|
||||
if (entity instanceof Player) {
|
||||
((Player) entity).getPacketDispatch().sendMessage("This isn't your armour to attack.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return super.isAttackable(entity, style);
|
||||
return super.isAttackable(entity, style, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -867,7 +867,7 @@ public final class DBRCutscenePlugin extends CutscenePlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttackable(Entity entity, CombatStyle style) {
|
||||
public boolean isAttackable(Entity entity, CombatStyle style, boolean message) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1063,9 +1063,11 @@ public class ChristmasEvent extends HolidayEvent {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttackable(Entity entity, CombatStyle style) {
|
||||
public boolean isAttackable(Entity entity, CombatStyle style, boolean message) {
|
||||
if (entity instanceof Player) {
|
||||
((Player) entity).sendMessage("You can't attack a snowman.");
|
||||
if(message) {
|
||||
((Player) entity).sendMessage("You can't attack a snowman.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -143,21 +143,25 @@ public final class ElvargNPC extends AbstractNPC {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttackable(Entity entity, CombatStyle style) {
|
||||
public boolean isAttackable(Entity entity, CombatStyle style, boolean message) {
|
||||
if (!(entity instanceof Player)) {
|
||||
return super.isAttackable(entity, style);
|
||||
return super.isAttackable(entity, style, message);
|
||||
}
|
||||
final Player player = (Player) entity;
|
||||
if (player.getQuestRepository().getQuest("Dragon Slayer").getStage(player) == 40 && (player.getInventory().containsItem(DragonSlayer.ELVARG_HEAD))) {
|
||||
player.getPacketDispatch().sendMessage("You have already slain the dragon. Now you just need to return to Oziach for");
|
||||
player.getPacketDispatch().sendMessage("your reward!");
|
||||
return true;
|
||||
}
|
||||
if (player.getQuestRepository().getQuest("Dragon Slayer").getStage(player) > 40) {
|
||||
player.getPacketDispatch().sendMessage("You have already slain Elvarg.");
|
||||
if(message) {
|
||||
player.getPacketDispatch().sendMessage("You have already slain the dragon. Now you just need to return to Oziach for");
|
||||
player.getPacketDispatch().sendMessage("your reward!");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return super.isAttackable(entity, style);
|
||||
if (player.getQuestRepository().getQuest("Dragon Slayer").getStage(player) > 40) {
|
||||
if(message) {
|
||||
player.getPacketDispatch().sendMessage("You have already slain Elvarg.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return super.isAttackable(entity, style, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -322,4 +326,4 @@ public final class ElvargNPC extends AbstractNPC {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,15 +52,17 @@ public final class WormbrainNPC extends AbstractNPC {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttackable(Entity entity, CombatStyle style) {
|
||||
public boolean isAttackable(Entity entity, CombatStyle style, boolean message) {
|
||||
if (entity instanceof Player) {
|
||||
final Player player = (Player) entity;
|
||||
if (player.getQuestRepository().getQuest("Dragon Slayer").getStage(player) != 20) {
|
||||
player.getPacketDispatch().sendMessage("The goblin is already in prison. You have no reason to attack him.");
|
||||
if(message) {
|
||||
player.getPacketDispatch().sendMessage("The goblin is already in prison. You have no reason to attack him.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return super.isAttackable(entity, style);
|
||||
return super.isAttackable(entity, style, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -238,7 +238,7 @@ public final class RestlessGhostPlugin extends OptionHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttackable(final Entity entity, final CombatStyle style) {
|
||||
public boolean isAttackable(Entity entity, CombatStyle style, boolean message) {
|
||||
final Player player = ((Player) entity);
|
||||
final Player pl = getAttribute("player", null);
|
||||
return pl == null ? false : pl == player ? true : false;
|
||||
|
||||
@@ -52,11 +52,11 @@ public final class TreeSpiritNPC extends AbstractNPC {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttackable(Entity entity, CombatStyle style) {
|
||||
public boolean isAttackable(Entity entity, CombatStyle style, boolean message) {
|
||||
if (entity != player) {
|
||||
return false;
|
||||
}
|
||||
return super.isAttackable(entity, style);
|
||||
return super.isAttackable(entity, style, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+1
-1
@@ -57,7 +57,7 @@ public class WitchsExperimentNPC extends AbstractNPC {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttackable(Entity entity, CombatStyle style) {
|
||||
public boolean isAttackable(Entity entity, CombatStyle style, boolean message) {
|
||||
return p == entity;
|
||||
}
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ public final class SaradominWizardNPC extends AbstractNPC {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttackable(Entity entity, CombatStyle style) {
|
||||
public boolean isAttackable(Entity entity, CombatStyle style, boolean message) {
|
||||
if (!(entity instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
@@ -132,7 +132,7 @@ public final class SaradominWizardNPC extends AbstractNPC {
|
||||
Player p = entity.asPlayer();
|
||||
return p == player;
|
||||
}
|
||||
return super.isAttackable(entity, style);
|
||||
return super.isAttackable(entity, style, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -101,7 +101,7 @@ public final class UriNPC extends AbstractNPC {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttackable(Entity entity, CombatStyle style) {
|
||||
public boolean isAttackable(Entity entity, CombatStyle style, boolean message) {
|
||||
if (!(entity instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
@@ -109,7 +109,7 @@ public final class UriNPC extends AbstractNPC {
|
||||
Player p = entity.asPlayer();
|
||||
return p == player;
|
||||
}
|
||||
return super.isAttackable(entity, style);
|
||||
return super.isAttackable(entity, style, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -99,7 +99,7 @@ public final class ZamorakWizardNPC extends AbstractNPC {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttackable(Entity entity, CombatStyle style) {
|
||||
public boolean isAttackable(Entity entity, CombatStyle style, boolean message) {
|
||||
if (!(entity instanceof Player)) {
|
||||
return false;
|
||||
}
|
||||
@@ -107,7 +107,7 @@ public final class ZamorakWizardNPC extends AbstractNPC {
|
||||
Player p = entity.asPlayer();
|
||||
return p == player;
|
||||
}
|
||||
return super.isAttackable(entity, style);
|
||||
return super.isAttackable(entity, style, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -389,14 +389,16 @@ public final class WaterBirthDungeonZone extends MapZone implements Plugin<Objec
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttackable(Entity entity, CombatStyle style) {
|
||||
public boolean isAttackable(Entity entity, CombatStyle style, boolean message) {
|
||||
if (getId() != getOriginalId()) {
|
||||
return false;
|
||||
}
|
||||
if (entity.getLocation().getDistance(getLocation()) <= 3) {
|
||||
if (entity instanceof Player) {
|
||||
Player player = entity.asPlayer();
|
||||
player.sendMessage("The door is propped securely shut from this side...");
|
||||
if(message) {
|
||||
player.sendMessage("The door is propped securely shut from this side...");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -391,12 +391,14 @@ public final class PyreSitePlugin extends OptionHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttackable(Entity entity, CombatStyle style) {
|
||||
public boolean isAttackable(Entity entity, CombatStyle style, boolean message) {
|
||||
if (entity instanceof Player && entity != target) {
|
||||
((Player) entity).getPacketDispatch().sendMessage("It's not after you.");
|
||||
if(message) {
|
||||
((Player) entity).getPacketDispatch().sendMessage("It's not after you.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
return super.isAttackable(entity, style);
|
||||
return super.isAttackable(entity, style, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -113,7 +113,7 @@ public final class DMCHandler {
|
||||
player.getAudioManager().send(new Audio(2877), true, l);
|
||||
direction = DMCRevolution.values()[(direction.ordinal() + 1) % DMCRevolution.values().length];
|
||||
for (NPC npc : RegionManager.getLocalNpcs(l, 10)) {
|
||||
if (direction.isInSight(npc.getLocation().getX() - l.getX(), npc.getLocation().getY() - l.getY()) && npc.isAttackable(player, CombatStyle.RANGE) && CombatSwingHandler.isProjectileClipped(npc, l, false)) {
|
||||
if (direction.isInSight(npc.getLocation().getX() - l.getX(), npc.getLocation().getY() - l.getY()) && npc.isAttackable(player, CombatStyle.RANGE, false) && CombatSwingHandler.isProjectileClipped(npc, l, false)) {
|
||||
int speed = (int) (25 + (l.getDistance(npc.getLocation()) * 10));
|
||||
Projectile.create(l, npc.getLocation(), 53, 40, 36, 20, speed, 0, 128).send();
|
||||
player.getAudioManager().send(new Audio(1667), true, l);
|
||||
|
||||
@@ -376,13 +376,14 @@ public abstract class Entity extends Node {
|
||||
* Checks if this entity is attackable by the attacking entity.
|
||||
* @param entity The attacking entity.
|
||||
* @param style The combat style used.
|
||||
* @param message Whether to send the player a message indicating why the entity isn't attackable.
|
||||
* @return {@code True} if the attacking entity can attack this entity.
|
||||
*/
|
||||
public boolean isAttackable(Entity entity, CombatStyle style) {
|
||||
public boolean isAttackable(Entity entity, CombatStyle style, boolean message) {
|
||||
if (DeathTask.isDead(this)) {
|
||||
return false;
|
||||
}
|
||||
if (!entity.getZoneMonitor().continueAttack(this, style)) {
|
||||
if (!entity.getZoneMonitor().continueAttack(this, style, message)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -429,7 +430,7 @@ public abstract class Entity extends Node {
|
||||
* @param style the style.
|
||||
* @return {@code True} if so.
|
||||
*/
|
||||
public boolean continueAttack(Entity target, CombatStyle style) {
|
||||
public boolean continueAttack(Entity target, CombatStyle style, boolean message) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -144,7 +144,7 @@ public final class ChainhitSpecialHandler extends RangeSwingHandler implements P
|
||||
for (Iterator<? extends Entity> it = list.iterator(); it.hasNext();) {
|
||||
final Entity e = it.next();
|
||||
it.remove();
|
||||
if (!e.isAttackable(player, CombatStyle.RANGE) || !e.getProperties().isMultiZone()) {
|
||||
if (!e.isAttackable(player, CombatStyle.RANGE, false) || !e.getProperties().isMultiZone()) {
|
||||
continue;
|
||||
}
|
||||
double distance = victim.getLocation().getDistance(e.getLocation());
|
||||
|
||||
@@ -57,17 +57,19 @@ public abstract class IdleAbstractNPC extends AbstractNPC {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttackable(Entity entity, CombatStyle style) {
|
||||
public boolean isAttackable(Entity entity, CombatStyle style, boolean message) {
|
||||
if (isInvisible()) {
|
||||
return false;
|
||||
}
|
||||
if (getTask() != null && entity instanceof Player && getTask().levelReq > entity.getSkills().getStaticLevel(Skills.SLAYER)) {
|
||||
((Player) entity).getPacketDispatch().sendMessage("You need a higher slayer level to know how to wound this monster.");
|
||||
if(message) {
|
||||
((Player) entity).getPacketDispatch().sendMessage("You need a higher slayer level to know how to wound this monster.");
|
||||
}
|
||||
}
|
||||
if (DeathTask.isDead(this)) {
|
||||
return false;
|
||||
}
|
||||
if (!entity.getZoneMonitor().continueAttack(this, style)) {
|
||||
if (!entity.getZoneMonitor().continueAttack(this, style, message)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
@@ -136,4 +138,4 @@ public abstract class IdleAbstractNPC extends AbstractNPC {
|
||||
this.idle = idle;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -392,14 +392,16 @@ public class NPC extends Entity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttackable(Entity entity, CombatStyle style) {
|
||||
public boolean isAttackable(Entity entity, CombatStyle style, boolean message) {
|
||||
if ((entity instanceof Player && !definition.hasAction("attack")) || isInvisible()) {
|
||||
return false;
|
||||
}
|
||||
if (task != null && entity instanceof Player && task.levelReq > entity.getSkills().getStaticLevel(Skills.SLAYER)) {
|
||||
((Player) entity).getPacketDispatch().sendMessage("You need a higher slayer level to know how to wound this monster.");
|
||||
if(message) {
|
||||
((Player) entity).getPacketDispatch().sendMessage("You need a higher slayer level to know how to wound this monster.");
|
||||
}
|
||||
}
|
||||
return super.isAttackable(entity, style);
|
||||
return super.isAttackable(entity, style, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -224,11 +224,11 @@ public final class GiantMoleNPC extends AbstractNPC {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttackable(Entity entity, CombatStyle style) {
|
||||
public boolean isAttackable(Entity entity, CombatStyle style, boolean message) {
|
||||
if (digging) {
|
||||
return false;
|
||||
}
|
||||
return super.isAttackable(entity, style);
|
||||
return super.isAttackable(entity, style, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -212,7 +212,7 @@ public final class KalphiteQueenNPC extends AbstractNPC {
|
||||
private BattleState[] getRangeTargets(Entity e, Entity victim) {
|
||||
List<BattleState> list = new ArrayList<>(20);
|
||||
for (Entity t : RegionManager.getLocalPlayers(victim, -1 + (int) e.getCenterLocation().getDistance(victim.getLocation()))) {
|
||||
if (t.isAttackable(e, CombatStyle.RANGE)) {
|
||||
if (t.isAttackable(e, CombatStyle.RANGE, false)) {
|
||||
list.add(new BattleState(e, t));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -373,7 +373,7 @@ public class BorkNPC extends AbstractNPC {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttackable(Entity e, CombatStyle style) {
|
||||
public boolean isAttackable(Entity e, CombatStyle style, boolean message) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ public class GraveStoneNPC extends AbstractNPC {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttackable(Entity entity, CombatStyle style) {
|
||||
public boolean isAttackable(Entity entity, CombatStyle style, boolean message) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -155,7 +155,7 @@ public class VampireSlayerNPC extends AbstractNPC {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttackable(final Entity entity, final CombatStyle style) {
|
||||
public boolean isAttackable(final Entity entity, final CombatStyle style, boolean message) {
|
||||
final Player player = ((Player) entity);
|
||||
final Player pl = getAttribute("player", null);
|
||||
return pl == null ? false : pl == player ? true : false;
|
||||
|
||||
+2
-2
@@ -64,12 +64,12 @@ public final class GardenerNPC extends AbstractNPC {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttackable(Entity entity, CombatStyle style) {
|
||||
public boolean isAttackable(Entity entity, CombatStyle style, boolean message) {
|
||||
final Player target = getAttribute("target", null);
|
||||
if (target != entity) {
|
||||
return false;
|
||||
}
|
||||
return super.isAttackable(entity, style);
|
||||
return super.isAttackable(entity, style, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -190,18 +190,20 @@ public class RevenantNPC extends AbstractNPC {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean continueAttack(Entity target, CombatStyle style) {
|
||||
public boolean continueAttack(Entity target, CombatStyle style, boolean message) {
|
||||
return target instanceof Player ? checkCombatLevel(target.asPlayer()) : true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttackable(Entity entity, CombatStyle style) {
|
||||
public boolean isAttackable(Entity entity, CombatStyle style, boolean message) {
|
||||
if (entity.asPlayer().isArtificial()) {
|
||||
return false;
|
||||
}
|
||||
if (entity instanceof Player) {
|
||||
if (!checkCombatLevel(entity.asPlayer()) && !entity.asPlayer().isAdmin()) {
|
||||
entity.asPlayer().sendMessage("The level difference between you and your opponent is too great.");
|
||||
if(message) {
|
||||
entity.asPlayer().sendMessage("The level difference between you and your opponent is too great.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -214,7 +216,7 @@ public class RevenantNPC extends AbstractNPC {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return super.isAttackable(entity, style);
|
||||
return super.isAttackable(entity, style, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -730,7 +730,7 @@ public class Player extends Entity {
|
||||
}
|
||||
}
|
||||
Item item = equipment.get(EquipmentContainer.SLOT_SHIELD);
|
||||
if (item != null && (fire && (item.getId() == 11283 || item.getId() == 11284 || item.getId() == 1540) || (!fire && (item.getId() == 2890 || item.getId() == 9731)))) {
|
||||
if (item != null && (item.getId() == 11283 || item.getId() == 11284 || (fire && (item.getId() == 1540) || (!fire && (item.getId() == 2890 || item.getId() == 9731))))) {
|
||||
value |= 0x4;
|
||||
}
|
||||
if (prayer.get(PrayerType.PROTECT_FROM_MAGIC)) {
|
||||
@@ -755,11 +755,11 @@ public class Player extends Entity {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttackable(Entity entity, CombatStyle style) {
|
||||
public boolean isAttackable(Entity entity, CombatStyle style, boolean message) {
|
||||
if (entity instanceof NPC && !((NPC) entity).getDefinition().hasAction("attack") && !((NPC) entity).isIgnoreAttackRestrictions(this)) {
|
||||
return false;
|
||||
}
|
||||
return super.isAttackable(entity, style);
|
||||
return super.isAttackable(entity, style, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -119,7 +119,7 @@ public final class Prayer {
|
||||
}
|
||||
for (Object o : targets) {
|
||||
Entity entity = (Entity) o;
|
||||
if (entity.isAttackable(player, CombatStyle.MAGIC)) {
|
||||
if (entity.isAttackable(player, CombatStyle.MAGIC, false)) {
|
||||
entity.getImpactHandler().manualHit(player, 1 + RandomFunction.randomize(maximum), HitsplatType.NORMAL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,14 +83,14 @@ public final class ImplingNPC extends AbstractNPC {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttackable(Entity entity, CombatStyle style) {
|
||||
public boolean isAttackable(Entity entity, CombatStyle style, boolean message) {
|
||||
if (style != CombatStyle.MAGIC) {
|
||||
return false;
|
||||
}
|
||||
if (entity.getProperties().getSpell().getSpellId() == 12 || entity.getProperties().getSpell().getSpellId() == 30 || entity.getProperties().getSpell().getSpellId() == 56) {
|
||||
return true;
|
||||
}
|
||||
return super.isAttackable(entity, style);
|
||||
return super.isAttackable(entity, style, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -200,9 +200,9 @@ public final class FishingExplosivePlugin extends OptionHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttackable(final Entity entity, CombatStyle style) {
|
||||
public boolean isAttackable(Entity entity, CombatStyle style, boolean message) {
|
||||
final Player pl = getAttribute("player", null);
|
||||
return pl != null && pl == entity && super.isAttackable(entity, style);
|
||||
return pl != null && pl == entity && super.isAttackable(entity, style, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -162,16 +162,23 @@ public final class NechryaelNPC extends AbstractNPC {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttackable(Entity entity, CombatStyle style) {
|
||||
public boolean isAttackable(Entity entity, CombatStyle style, boolean message) {
|
||||
if (entity instanceof Player) {
|
||||
final Player t = (Player) entity;
|
||||
if (t != player) {
|
||||
t.getPacketDispatch().sendMessage("This isn't spawned for you.");
|
||||
if(message) {
|
||||
t.getPacketDispatch().sendMessage("This isn't spawned for you.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return super.isAttackable(entity, style);
|
||||
return super.isAttackable(entity, style, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isIgnoreMultiBoundaries(Entity victim) {
|
||||
return victim == player;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPoisonImmune() {
|
||||
@@ -182,6 +189,5 @@ public final class NechryaelNPC extends AbstractNPC {
|
||||
public int[] getIds() {
|
||||
return new int[] { DEATH_SPAWN };
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -220,37 +220,47 @@ public abstract class Familiar extends NPC implements Plugin<Object> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAttackable(Entity entity, CombatStyle style) {
|
||||
public boolean isAttackable(Entity entity, CombatStyle style, boolean message) {
|
||||
if (entity == owner) {
|
||||
owner.getPacketDispatch().sendMessage("You can't just betray your own familiar like that!");
|
||||
if(message) {
|
||||
owner.getPacketDispatch().sendMessage("You can't just betray your own familiar like that!");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (entity instanceof Player) {
|
||||
if (!owner.isAttackable(entity, style)) {
|
||||
if (!owner.isAttackable(entity, style, message)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!getProperties().isMultiZone()) {
|
||||
if (entity instanceof Player && !((Player) entity).getProperties().isMultiZone()) {
|
||||
((Player) entity).getPacketDispatch().sendMessage("You have to be in multicombat to attack a player's familiar.");
|
||||
if(message) {
|
||||
((Player) entity).getPacketDispatch().sendMessage("You have to be in multicombat to attack a player's familiar.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (entity instanceof Player) {
|
||||
((Player) entity).getPacketDispatch().sendMessage("This familiar is not in the a multicombat zone.");
|
||||
if(message) {
|
||||
((Player) entity).getPacketDispatch().sendMessage("This familiar is not in the a multicombat zone.");
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (entity instanceof Player) {
|
||||
if (!((Player) entity).getSkullManager().isWilderness()) {
|
||||
((Player) entity).getPacketDispatch().sendMessage("You have to be in the wilderness to attack a player's familiar.");
|
||||
if(message) {
|
||||
((Player) entity).getPacketDispatch().sendMessage("You have to be in the wilderness to attack a player's familiar.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (!owner.getSkullManager().isWilderness()) {
|
||||
((Player) entity).getPacketDispatch().sendMessage("This familiar's owner is not in the wilderness.");
|
||||
if(message) {
|
||||
((Player) entity).getPacketDispatch().sendMessage("This familiar's owner is not in the wilderness.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return super.isAttackable(entity, style);
|
||||
return super.isAttackable(entity, style, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -418,7 +428,7 @@ public abstract class Familiar extends NPC implements Plugin<Object> {
|
||||
* moves).
|
||||
*/
|
||||
public boolean canAttack(Entity target, boolean message) {
|
||||
if (!target.isAttackable(owner, owner.getProperties().getCombatPulse().getStyle())) {
|
||||
if (!target.isAttackable(owner, owner.getProperties().getCombatPulse().getStyle(), true)) {
|
||||
return false;
|
||||
}
|
||||
if (target.getLocation().getDistance(getLocation()) > 8) {
|
||||
@@ -427,7 +437,7 @@ public abstract class Familiar extends NPC implements Plugin<Object> {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
if (target.getLocks().isInteractionLocked() || !target.isAttackable(this, CombatStyle.MAGIC)) {
|
||||
if (target.getLocks().isInteractionLocked() || !target.isAttackable(this, CombatStyle.MAGIC, true)) {
|
||||
return false;
|
||||
}
|
||||
return isCombatFamiliar();
|
||||
|
||||
@@ -112,24 +112,26 @@ public final class ZoneMonitor {
|
||||
* @param style The combat style used.
|
||||
* @return {@code True} if so.
|
||||
*/
|
||||
public boolean continueAttack(Node target, CombatStyle style) {
|
||||
public boolean continueAttack(Node target, CombatStyle style, boolean message) {
|
||||
if (target instanceof Entity) {
|
||||
if (!entity.continueAttack((Entity) target, style)) {
|
||||
if (!entity.continueAttack((Entity) target, style, message)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
for (RegionZone z : zones) {
|
||||
if (!z.getZone().continueAttack(entity, target, style, true)) {
|
||||
if (!z.getZone().continueAttack(entity, target, style, message)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (entity instanceof Player && target instanceof Player) {
|
||||
if (!((Player) entity).getSkullManager().isWilderness() || !((Player) target).getSkullManager().isWilderness()) {
|
||||
((Player) entity).getPacketDispatch().sendMessage("You can only attack other players in the wilderness.");
|
||||
if(message) {
|
||||
((Player) entity).getPacketDispatch().sendMessage("You can only attack other players in the wilderness.");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (target instanceof Entity && !MapZone.checkMulti(entity, (Entity) target, true)) {
|
||||
if (target instanceof Entity && !MapZone.checkMulti(entity, (Entity) target, message)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
@@ -78,10 +78,10 @@ class ChronozonNPC(id: Int, location: Location?) : AbstractNPC(667, Location(308
|
||||
}
|
||||
}
|
||||
|
||||
override fun isAttackable(entity: Entity, style: CombatStyle?): Boolean {
|
||||
override fun isAttackable(entity: Entity, style: CombatStyle?, message: Boolean): Boolean {
|
||||
return entity == m_targetPlayer &&
|
||||
m_targetPlayer.questRepository.getQuest("Family Crest").getStage(m_targetPlayer) == 19 &&
|
||||
super.isAttackable(entity, style)
|
||||
super.isAttackable(entity, style, message)
|
||||
}
|
||||
|
||||
override fun clear() {
|
||||
|
||||
@@ -129,7 +129,7 @@ class CombatPulse(
|
||||
if (handler == null) {
|
||||
handler = entity.getSwingHandler(true)
|
||||
}
|
||||
if (!v.isAttackable(entity, handler!!.type)) {
|
||||
if (!v.isAttackable(entity, handler!!.type, true)) {
|
||||
return true
|
||||
}
|
||||
if (!swing(entity, victim, handler)) {
|
||||
|
||||
@@ -318,7 +318,7 @@ class PitfallNPC : AbstractNPC {
|
||||
return BEAST_IDS
|
||||
}
|
||||
|
||||
override fun isAttackable(entity: Entity, style: CombatStyle): Boolean {
|
||||
override fun isAttackable(entity: Entity, style: CombatStyle, message: Boolean): Boolean {
|
||||
return false
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user