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
8 changed files with 41 additions and 18 deletions
@@ -133,6 +133,7 @@ public final class AnimalMagnetismPlugin extends OptionHandler {
player.faceLocation(new Location(3659, 3519, 0));
if (player.getInventory().containsItem(new Item(4252))) {
player.animate(Animation.create(1652));
player.getAudioManager().send(1132);
player.getInventory().remove(new Item(4252));
player.getInventory().add(item);
player.sendMessage("You refill the ectophial from the Ectofuntus.");
@@ -38,6 +38,7 @@ public class EctoplasmFillPlugin extends UseWithHandler {
public boolean handle(NodeUsageEvent event) {
final Player player = event.getPlayer();
player.animate(Animation.create(4471));
player.getAudioManager().send(1132);
player.getPacketDispatch().sendMessage("You fill the bucket with ectoplasm.");
player.getPulseManager().run(new Pulse(3, player) {
@Override
@@ -46,6 +47,7 @@ public class EctoplasmFillPlugin extends UseWithHandler {
player.getInventory().add(new Item(4286));
if (player.getInventory().contains(1925, 1)) {
player.animate(Animation.create(4471), 1);
player.getAudioManager().send(1132);
return false;
}
}
@@ -35,6 +35,7 @@ public class EctophialFillPlugin extends UseWithHandler {
final Player player = event.getPlayer();
player.lock(3);
player.animate(Animation.create(1652));
player.getAudioManager().send(1132);
GameWorld.getPulser().submit(new Pulse(3, player) {
@Override
public boolean pulse() {
@@ -30,6 +30,7 @@ public final class ObeliskOptionPlugin extends OptionHandler {
return true;
}
player.visualize(Animation.create(8502), Graphics.create(1308));
player.getAudioManager().send(4214);
player.getSkills().setLevel(Skills.SUMMONING, player.getSkills().getStaticLevel(Skills.SUMMONING));
player.getPacketDispatch().sendMessage("You renew your summoning points.");
return true;
@@ -112,6 +112,8 @@ public abstract class Familiar extends NPC implements Plugin<Object> {
*/
private final int attackStyle;
private boolean firstCall = true;
/**
* Constructs a new {@code Familiar} {@code Object}.
* @param owner The owner.
@@ -346,6 +348,7 @@ public abstract class Familiar extends NPC implements Plugin<Object> {
if (specialMove(special)) {
setAttribute("special-delay", GameWorld.getTicks() + 3);
owner.getInventory().remove(new Item(scroll.getItemId()));
owner.getAudioManager().send(4161);
visualizeSpecialMove();
updateSpecialPoints(specialCost);
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"));
getProperties().setTeleportLocation(destination);
if (!(this instanceof Pet)) {
if(firstCall) {
owner.getAudioManager().send(4366);
firstCall = false;
} else {
owner.getAudioManager().send(188);
}
if (size() > 1) {
graphics(LARGE_SUMMON_GRAPHIC);
} else {
@@ -734,4 +743,4 @@ public abstract class Familiar extends NPC implements Plugin<Object> {
public int getSpecialPoints() {
return specialPoints;
}
}
}
@@ -295,21 +295,19 @@ object RegionManager {
return null
}
var destination: Location? = null
for (i in 0..3) {
outer@ for (i in 0..7) {
val dir = Direction.get(i)
val l = owner.location.transform(dir, if (dir.toInteger() < 2) 1 else node.size())
var success = true
for (x in 0 until node.size()) {
for (y in 0 until node.size()) {
if (isClipped(l.transform(x, y, 0))) {
success = false
break
inner@for(j in 0 until node.size()) {
val l = owner.location.transform(dir, j)
for (x in 0 until node.size()) {
for (y in 0 until node.size()) {
if (isClipped(l.transform(x, y, 0))) {
continue@inner
}
}
}
}
if (success) {
destination = l
break
break@outer
}
}
return destination