Merge branch 'summoning-fixes' into 'master'

Some summoning-related fixes:

See merge request 2009scape/2009scape!315
This commit is contained in:
Ceikry 2021-10-22 19:38:26 +00:00
commit 8c43154b21
8 changed files with 41 additions and 18 deletions

View file

@ -133,6 +133,7 @@ public final class AnimalMagnetismPlugin extends OptionHandler {
player.faceLocation(new Location(3659, 3519, 0)); player.faceLocation(new Location(3659, 3519, 0));
if (player.getInventory().containsItem(new Item(4252))) { if (player.getInventory().containsItem(new Item(4252))) {
player.animate(Animation.create(1652)); player.animate(Animation.create(1652));
player.getAudioManager().send(1132);
player.getInventory().remove(new Item(4252)); player.getInventory().remove(new Item(4252));
player.getInventory().add(item); player.getInventory().add(item);
player.sendMessage("You refill the ectophial from the Ectofuntus."); player.sendMessage("You refill the ectophial from the Ectofuntus.");

View file

@ -38,6 +38,7 @@ public class EctoplasmFillPlugin extends UseWithHandler {
public boolean handle(NodeUsageEvent event) { public boolean handle(NodeUsageEvent event) {
final Player player = event.getPlayer(); final Player player = event.getPlayer();
player.animate(Animation.create(4471)); player.animate(Animation.create(4471));
player.getAudioManager().send(1132);
player.getPacketDispatch().sendMessage("You fill the bucket with ectoplasm."); player.getPacketDispatch().sendMessage("You fill the bucket with ectoplasm.");
player.getPulseManager().run(new Pulse(3, player) { player.getPulseManager().run(new Pulse(3, player) {
@Override @Override
@ -46,6 +47,7 @@ public class EctoplasmFillPlugin extends UseWithHandler {
player.getInventory().add(new Item(4286)); player.getInventory().add(new Item(4286));
if (player.getInventory().contains(1925, 1)) { if (player.getInventory().contains(1925, 1)) {
player.animate(Animation.create(4471), 1); player.animate(Animation.create(4471), 1);
player.getAudioManager().send(1132);
return false; return false;
} }
} }

View file

@ -35,6 +35,7 @@ public class EctophialFillPlugin extends UseWithHandler {
final Player player = event.getPlayer(); final Player player = event.getPlayer();
player.lock(3); player.lock(3);
player.animate(Animation.create(1652)); player.animate(Animation.create(1652));
player.getAudioManager().send(1132);
GameWorld.getPulser().submit(new Pulse(3, player) { GameWorld.getPulser().submit(new Pulse(3, player) {
@Override @Override
public boolean pulse() { public boolean pulse() {

View file

@ -30,6 +30,7 @@ public final class ObeliskOptionPlugin extends OptionHandler {
return true; return true;
} }
player.visualize(Animation.create(8502), Graphics.create(1308)); player.visualize(Animation.create(8502), Graphics.create(1308));
player.getAudioManager().send(4214);
player.getSkills().setLevel(Skills.SUMMONING, player.getSkills().getStaticLevel(Skills.SUMMONING)); player.getSkills().setLevel(Skills.SUMMONING, player.getSkills().getStaticLevel(Skills.SUMMONING));
player.getPacketDispatch().sendMessage("You renew your summoning points."); player.getPacketDispatch().sendMessage("You renew your summoning points.");
return true; return true;

View file

@ -112,6 +112,8 @@ public abstract class Familiar extends NPC implements Plugin<Object> {
*/ */
private final int attackStyle; private final int attackStyle;
private boolean firstCall = true;
/** /**
* Constructs a new {@code Familiar} {@code Object}. * Constructs a new {@code Familiar} {@code Object}.
* @param owner The owner. * @param owner The owner.
@ -346,6 +348,7 @@ public abstract class Familiar extends NPC implements Plugin<Object> {
if (specialMove(special)) { if (specialMove(special)) {
setAttribute("special-delay", GameWorld.getTicks() + 3); setAttribute("special-delay", GameWorld.getTicks() + 3);
owner.getInventory().remove(new Item(scroll.getItemId())); owner.getInventory().remove(new Item(scroll.getItemId()));
owner.getAudioManager().send(4161);
visualizeSpecialMove(); visualizeSpecialMove();
updateSpecialPoints(specialCost); updateSpecialPoints(specialCost);
owner.getSkills().addExperience(Skills.SUMMONING, scroll.getExperience(), true); owner.getSkills().addExperience(Skills.SUMMONING, scroll.getExperience(), true);
@ -536,6 +539,12 @@ public abstract class Familiar extends NPC implements Plugin<Object> {
setInvisible(getZoneMonitor().isRestricted(ZoneRestriction.FOLLOWERS) && !owner.getLocks().isLocked("enable_summoning")); setInvisible(getZoneMonitor().isRestricted(ZoneRestriction.FOLLOWERS) && !owner.getLocks().isLocked("enable_summoning"));
getProperties().setTeleportLocation(destination); getProperties().setTeleportLocation(destination);
if (!(this instanceof Pet)) { if (!(this instanceof Pet)) {
if(firstCall) {
owner.getAudioManager().send(4366);
firstCall = false;
} else {
owner.getAudioManager().send(188);
}
if (size() > 1) { if (size() > 1) {
graphics(LARGE_SUMMON_GRAPHIC); graphics(LARGE_SUMMON_GRAPHIC);
} else { } else {
@ -734,4 +743,4 @@ public abstract class Familiar extends NPC implements Plugin<Object> {
public int getSpecialPoints() { public int getSpecialPoints() {
return specialPoints; return specialPoints;
} }
} }

View file

@ -295,21 +295,19 @@ object RegionManager {
return null return null
} }
var destination: Location? = null var destination: Location? = null
for (i in 0..3) { outer@ for (i in 0..7) {
val dir = Direction.get(i) val dir = Direction.get(i)
val l = owner.location.transform(dir, if (dir.toInteger() < 2) 1 else node.size()) inner@for(j in 0 until node.size()) {
var success = true val l = owner.location.transform(dir, j)
for (x in 0 until node.size()) { for (x in 0 until node.size()) {
for (y in 0 until node.size()) { for (y in 0 until node.size()) {
if (isClipped(l.transform(x, y, 0))) { if (isClipped(l.transform(x, y, 0))) {
success = false continue@inner
break }
} }
} }
}
if (success) {
destination = l destination = l
break break@outer
} }
} }
return destination return destination

View file

@ -15,6 +15,7 @@ import core.game.node.entity.player.link.audio.Audio
import core.game.node.entity.player.link.prayer.PrayerType import core.game.node.entity.player.link.prayer.PrayerType
import core.game.node.entity.skill.Skills import core.game.node.entity.skill.Skills
import core.game.node.entity.skill.summoning.familiar.Familiar import core.game.node.entity.skill.summoning.familiar.Familiar
import core.game.world.map.RegionManager
import core.game.world.map.path.Pathfinder import core.game.world.map.path.Pathfinder
import core.game.world.update.flag.context.Animation import core.game.world.update.flag.context.Animation
import core.tools.RandomFunction import core.tools.RandomFunction
@ -521,11 +522,21 @@ abstract class CombatSwingHandler(var type: CombatStyle?) {
*/ */
@JvmStatic @JvmStatic
fun isProjectileClipped(entity: Node, victim: Node?, checkClose: Boolean): Boolean { fun isProjectileClipped(entity: Node, victim: Node?, checkClose: Boolean): Boolean {
return if (checkClose) { for(x1 in 0 until entity.size()) {
if (entity.id == 54) { // /temp until emp is back. for(y1 in 0 until entity.size()) {
Pathfinder.find(entity as Entity, victim!!, false, Pathfinder.SMART).isSuccessful val src = entity.location.transform(x1, y1, 0)
} else Pathfinder.find(entity as Entity, victim!!, false, Pathfinder.DUMB).isSuccessful for(x2 in 0 until victim!!.size()) {
} else Pathfinder.find(entity as Entity, victim!!, false, Pathfinder.PROJECTILE).isSuccessful for(y2 in 0 until victim!!.size()) {
val dst = victim!!.location.transform(x2, y2, 0)
val path = Pathfinder.PROJECTILE.find(src, 1, dst, 1, 1, 0, 0, 0, false, RegionManager::getClippingFlag)
if(path.isSuccessful && (!checkClose || path.points.size <= 1)) {
return true
}
}
}
}
}
return false
} }
} }

View file

@ -44,7 +44,7 @@ open class MeleeSwingHandler
distance += if (entity.walkingQueue.isRunningBoth) 2 else 1 distance += if (entity.walkingQueue.isRunningBoth) 2 else 1
goodRange = canMelee(entity, victim, distance) goodRange = canMelee(entity, victim, distance)
} }
if (!isProjectileClipped(entity, victim, true)) { if (!isProjectileClipped(entity, victim, !usingHalberd(entity))) {
return InteractionType.NO_INTERACT return InteractionType.NO_INTERACT
} }
val isRunning = entity.walkingQueue.runDir != -1 val isRunning = entity.walkingQueue.runDir != -1