Merge remote-tracking branch 'origin/master'

This commit is contained in:
ceikry
2021-08-25 16:29:00 -05:00
8 changed files with 175 additions and 292 deletions
@@ -1,59 +1,59 @@
package core.game.node.entity.npc.other;
import core.game.node.entity.combat.DeathTask;
import core.game.node.entity.npc.AbstractNPC;
import core.game.world.map.Location;
import core.plugin.Initializable;
import core.tools.RandomFunction;
/**
* Handles the sheep npc's.
* @author 'Vexia
*/
@Initializable
public class SheepNPC extends AbstractNPC {
/**
* The NPC ids of NPCs using this plugin.
*/
private static final int[] ID = { 42, 43, 1271, 1272, 1529, 1762, 1763, 1764, 1765, 2311, 2377, 2378, 2379, 2380, 3310, 3311, 3579, 5148, 5149, 5150, 5151, 5152, 5153, 5154, 5155, 5156, 5157, 5158, 5159, 5160, 5161, 5162, 5163, 5164, 5165, 5172, 5173 };
/**
* Constructs a new {@code AlKharidWarriorPlugin} {@code Object}.
*/
public SheepNPC() {
super(0, null);
}
/**
* Constructs a new {@code AlKharidWarriorPlugin} {@code Object}.
* @param id The NPC id.
* @param location The location.
*/
private SheepNPC(int id, Location location) {
super(id, location);
}
@Override
public AbstractNPC construct(int id, Location location, Object... objects) {
return new SheepNPC(id, location);
}
@Override
public void tick() {
if (getProperties().getCombatPulse().isAttacking() || DeathTask.isDead(this)) {
super.tick();
return;
}
if (RandomFunction.random(35) == 5) {
sendChat("Baa!");
}
super.tick();
}
@Override
public int[] getIds() {
return ID;
}
}
package core.game.node.entity.npc.other;
import core.game.node.entity.combat.DeathTask;
import core.game.node.entity.npc.AbstractNPC;
import core.game.world.map.Location;
import core.plugin.Initializable;
import core.tools.RandomFunction;
/**
* Handles the sheep npc's.
* @author 'Vexia
*/
@Initializable
public class SheepNPC extends AbstractNPC {
/**
* The NPC ids of NPCs using this plugin.
*/
private static final int[] ID = { 42, 43, 1271, 1272, 1529, 1762, 1763, 1764, 1765, 2377, 2378, 2379, 2380, 3310, 3311, 3579, 5148, 5149, 5150, 5151, 5152, 5153, 5154, 5155, 5156, 5157, 5158, 5159, 5160, 5161, 5162, 5163, 5164, 5165, 5172, 5173 };
/**
* Constructs a new {@code AlKharidWarriorPlugin} {@code Object}.
*/
public SheepNPC() {
super(0, null);
}
/**
* Constructs a new {@code AlKharidWarriorPlugin} {@code Object}.
* @param id The NPC id.
* @param location The location.
*/
private SheepNPC(int id, Location location) {
super(id, location);
}
@Override
public AbstractNPC construct(int id, Location location, Object... objects) {
return new SheepNPC(id, location);
}
@Override
public void tick() {
if (getProperties().getCombatPulse().isAttacking() || DeathTask.isDead(this)) {
super.tick();
return;
}
if (RandomFunction.random(35) == 5) {
sendChat("Baa!");
}
super.tick();
}
@Override
public int[] getIds() {
return ID;
}
}
@@ -113,10 +113,10 @@ public final class SlayerManager {
flags.setCompletedTasks(flags.getCompletedTasks() + 1);
if ((flags.getCompletedTasks() > 4 || flags.canEarnPoints() ) && flags.getMaster() != Master.TURAEL && flags.getPoints() < 64000) {
int points = flags.getMaster().getTaskPoints()[0];
if (flags.getTaskStreak() % 10 == 0) {
points = flags.getMaster().getTaskPoints()[1];
} else if (flags.getTaskStreak() % 50 == 0) {
if (flags.getTaskStreak() % 50 == 0) {
points = flags.getMaster().getTaskPoints()[2];
} else if (flags.getTaskStreak() % 10 == 0) {
points = flags.getMaster().getTaskPoints()[1];
}
flags.incrementPoints(points);
if (flags.getPoints() > 64000) {
@@ -1,10 +1,13 @@
package rs09.game.interaction.region
import core.game.node.entity.impl.ForceMovement
import core.game.world.map.Direction
import api.ContentAPI
import core.game.node.entity.skill.agility.AgilityHandler
import core.game.system.task.Pulse
import core.game.world.map.Location
import core.game.world.update.flag.context.Animation
import core.game.world.update.flag.context.Graphics
import rs09.game.interaction.InteractionListener
import kotlin.random.Random
/**
* File to be used for anything Morytania related.
@@ -19,8 +22,12 @@ class MorytaniaListeners : InteractionListener() {
val GROTTO_BRIDGE = 3522
val outside = Location.create(3439, 3337, 0)
val inside = Location.create(3442, 9734, 1)
private val RUNNING_ANIM = Animation(1995)
private val JUMP_ANIM = Animation(1603)
private val swimAnim = Animation(6988)
private val jumpAnim = Animation(1603)
private val failWater = Location(3439,3330)
private val failMessage = "You nearly drown in the disgusting swamp."
private val splashGFX = Graphics(68)
override fun defineListeners() {
/* on(GROTTO_ENTRANCE,SCENERY,"enter"){ player, node ->
@@ -34,10 +41,36 @@ class MorytaniaListeners : InteractionListener() {
}
on(GROTTO_BRIDGE,SCENERY,"jump"){ player, node ->
if (player.location.y == 3328) {
ForceMovement.run(player, node.location, node.location.transform(0, 3, 0), RUNNING_ANIM, JUMP_ANIM, Direction.NORTH, 15).endAnimation = Animation.RESET
} else if (player.location.y == 3332){
ForceMovement.run(player, node.location, node.location.transform(0, -3, 0), RUNNING_ANIM, JUMP_ANIM, Direction.SOUTH, 15).endAnimation = Animation.RESET
val start = node.location
var failLand = Location(3438,3331)
var failAnim = Animation(770)
var fromGrotto = false
ContentAPI.lock(player,10)
// Switch to south facing animations if jumping from Grotto
if (start.y == 3331) {
fromGrotto = true
failAnim = Animation(771)
failLand = Location(3438,3328)
}
if (AgilityHandler.hasFailed(player, 1, 0.1)) {
val end = if (fromGrotto) failWater else start
AgilityHandler.forceWalk(player, -1, start, end, failAnim, 15, 0.0, null,0).endAnimation = swimAnim
AgilityHandler.forceWalk(player, -1, failWater, failLand, swimAnim, 15, 2.0, null,3)
ContentAPI.submitIndividualPulse(player, object : Pulse(2){
override fun pulse(): Boolean {
ContentAPI.visualize(player,failAnim,splashGFX)
ContentAPI.teleport(player,failWater)
// Deal 1-6 damage but wait until the player is back on land
AgilityHandler.fail(player,0,failLand,swimAnim,Random.nextInt(1,7),failMessage)
return true
}
})
}
else{
val end = if (fromGrotto) start.transform(0,-3,0) else start.transform(0,3,0)
AgilityHandler.forceWalk(player, -1, start, end, jumpAnim, 15, 15.0, null,0)
}
return@on true
}