Fixed an off-by-one error that made cooking brawlers unobtainable

Reworked the ::npc admin command to take an optional amount argument. Usage: ::npc id [amount] [shouldWalk]
Summoning points now no longer regenerate automatically
Rewrote the ring of life
Reverting a slayer ring to an enchanted gem no longer destroys the item if inventory is full
The inauthentic mounted glory in a POH now respects teleblock
Fixed revenents infinite healing
Winkins' farm exit message is now split correctly
Added egg spawn in front of the chicken shrine in Zanaris and added its authentic use handler to the shrine
This commit is contained in:
Player Name
2024-04-17 07:34:12 +00:00
committed by Ryan
parent 50eb295fda
commit 6deadc6f90
12 changed files with 149 additions and 78 deletions
@@ -2,8 +2,10 @@ package content.data
import content.global.skill.magic.TeleportMethod
import content.global.skill.slayer.SlayerManager.Companion.getInstance
import core.ServerConstants
import core.api.*
import core.game.event.TeleportEvent
import core.game.interaction.QueueStrength
import core.game.node.entity.player.Player
import core.game.node.entity.player.link.TeleportManager
import core.game.node.item.Item
@@ -18,7 +20,7 @@ import java.util.*
/**
* Represents an enchanted jewellery.
* @author Vexia & downthecrop
* @author Vexia, downthecrop, Player Name
*/
enum class EnchantedJewellery(
@@ -186,6 +188,13 @@ enum class EnchantedJewellery(
Items.RING_OF_WEALTH2_14642,
Items.RING_OF_WEALTH1_14640,
Items.RING_OF_WEALTH_14638
),
RING_OF_LIFE(arrayOf<String>(),
arrayOf(
Location.create(ServerConstants.HOME_LOCATION)
),
true,
Items.RING_OF_LIFE_2570
);
val isCrumble: Boolean = crumble
@@ -199,7 +208,7 @@ enum class EnchantedJewellery(
constructor(options: Array<String>, locations: Array<Location>, vararg ids: Int) : this(options, locations, false, *ids)
/**
* Method used to teleport the player to the desired location.
* Method used when the player "Use"s the jewellery piece.
* @param player the player.
* @param item the used jewellery item.
* @param buttonID the button id.
@@ -212,39 +221,52 @@ enum class EnchantedJewellery(
}
return
}
attemptTeleport(player, item, buttonID, isEquipped)
}
/**
* Method used to actually teleport the player to the desired location.
* @param player the player.
* @param item the used jewellery item.
* @param buttonID the button id.
* @param isEquipped If the player is operating.
*/
fun attemptTeleport(player: Player, item: Item, buttonID: Int, isEquipped: Boolean): Boolean {
val itemIndex = getItemIndex(item)
val nextJewellery = Item(getNext(itemIndex))
if (canTeleport(player, nextJewellery)) {
Pulser.submit(object : Pulse(0) {
private var count = 0
private var location = getLocation(buttonID)
override fun pulse(): Boolean {
when (count) {
0 -> {
lock(player,4)
visualize(player, ANIMATION, GRAPHICS)
playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200)
player.impactHandler.disabledTicks = 4
closeInterface(player)
}
3 -> {
teleport(player,location)
resetAnimator(player)
if (isLastItemIndex(itemIndex)) {
if (isCrumble) crumbleJewellery(player, item, isEquipped)
} else {
replaceJewellery(player, item, nextJewellery, isEquipped)
}
unlock(player)
player.dispatch(TeleportEvent(TeleportManager.TeleportType.NORMAL, TeleportMethod.JEWELRY, item, location))
return true
}
}
count += 1
return false
}
})
if (!canTeleport(player, nextJewellery)) {
return false
}
Pulser.submit(object : Pulse(0) {
private var count = 0
private var location = getLocation(buttonID)
override fun pulse(): Boolean {
when (count) {
0 -> {
lock(player,4)
visualize(player, ANIMATION, GRAPHICS)
playGlobalAudio(player.location, Sounds.TELEPORT_ALL_200)
player.impactHandler.disabledTicks = 4
closeInterface(player)
}
3 -> {
teleport(player,location)
resetAnimator(player)
if (isLastItemIndex(itemIndex)) {
if (isCrumble) crumbleJewellery(player, item, isEquipped)
} else {
replaceJewellery(player, item, nextJewellery, isEquipped)
}
unlock(player)
player.dispatch(TeleportEvent(TeleportManager.TeleportType.NORMAL, TeleportMethod.JEWELRY, item, location))
return true
}
}
count += 1
return false
}
})
return true
}
private fun replaceJewellery(player: Player, item: Item, nextJewellery: Item, isEquipped: Boolean) {
@@ -262,8 +284,11 @@ enum class EnchantedJewellery(
removeItem(player, item)
}
if (isSlayerRing(item)) {
addItem(player, Items.ENCHANTED_GEM_4155)
sendMessage(player, "Your Ring of Slaying reverts back into a regular enchanted gem.")
queueScript(player, 1, QueueStrength.SOFT) {
addItemOrDrop(player, Items.ENCHANTED_GEM_4155)
sendMessage(player, "Your Ring of Slaying reverts back into a regular enchanted gem.")
return@queueScript stopExecuting(player)
}
}
}
@@ -11,10 +11,11 @@ import content.data.EnchantedJewellery
import core.game.interaction.InteractionListener
import core.game.interaction.IntType
import core.tools.START_DIALOGUE
import org.rs09.consts.Items
/**
* Listener for enchanted jewellery options
* @author Ceikry & downthecrop
* @author Ceikry, downthecrop, Player Name
*/
class EnchantedJewelleryListener : InteractionListener {
@@ -33,6 +34,10 @@ class EnchantedJewelleryListener : InteractionListener {
private fun handle(player: Player, node: Node, isEquipped: Boolean) {
player.pulseManager.clear(PulseType.STANDARD)
val item = node.asItem()
if (item.id == Items.RING_OF_LIFE_2570) {
sendMessage(player, "You can't operate that.")
return
}
val jewellery = EnchantedJewellery.idMap[item.id]
if (jewellery != null) {
if (jewellery.isLastItemIndex(jewellery.getItemIndex(item)) && !jewellery.isCrumble) {
@@ -60,4 +65,4 @@ class EnchantedJewelleryListener : InteractionListener {
}
}
}
}
}
@@ -5,10 +5,12 @@ import core.api.teleport
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import core.game.node.entity.player.Player
import core.game.node.item.Item
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 org.rs09.consts.Items
import org.rs09.consts.Sounds
import java.util.concurrent.Executors
import java.util.concurrent.TimeUnit
@@ -46,6 +48,9 @@ class MountedGlory : InteractionListener {
}
}
private fun mountedGloryTeleport(player : Player, int : Int) {
if (!player.zoneMonitor.teleport(1, Item(Items.AMULET_OF_GLORY_1704))) {
return
}
Executors.newSingleThreadScheduledExecutor().schedule({
player.pulseManager.run(object : Pulse() {
var counter = 0
@@ -63,4 +68,4 @@ class MountedGlory : InteractionListener {
})
}, 0, TimeUnit.SECONDS)
}
}
}
@@ -60,9 +60,9 @@ class Vinesweeper : InteractionListener, InterfaceListener, MapArea {
if(entity is Player) {
entity.interfaceManager.closeOverlay()
if(!logout) {
entity.sendMessage("Winkin's Farm thanks you for your visit.")
entity.sendMessage("Leftover ogleroots and flags have been returned to the establishment.")
entity.sendMessage("You have been reimbursed at a rate of 10gp per ogleroot and the flags have been collected.")
sendMessage(entity, "Winkin's Farm thanks you for your visit.")
sendMessage(entity, "Leftover ogleroots and flags have been returned to the establishment.")
sendMessage(entity, "You have been reimbursed at a rate of 10gp per ogleroot and the flags have been collected.")
val flags = entity.inventory.getAmount(Item(Items.FLAG_12625))
if(flags > 0) {
entity.setAttribute("/save:vinesweeper:stored-flags", flags)
@@ -33,6 +33,10 @@ class EvilChickenLairListener: InteractionListener {
}
return@onUseWith true
}
onUseWith(IntType.SCENERY, Items.EGG_1944, Scenery.CHICKEN_SHRINE_12093) { player, _, _ ->
sendMessage(player, "Nice idea, but nothing interesting happens.")
return@onUseWith true
}
onUseWith(IntType.SCENERY, Items.ROPE_954, Scenery.TUNNEL_ENTRANCE_12253) { player, _, node ->
if(removeItem(player, Item(Items.ROPE_954)))
replaceScenery(node as core.game.node.scenery.Scenery, Scenery.TUNNEL_ENTRANCE_12254, 100)
@@ -26,7 +26,7 @@ import static core.api.ContentAPIKt.playGlobalAudio;
/**
* Handles a revenant NPC.
* @author Ceikry-ish (mostly Vexia code still)
* @author Ceikry-ish (mostly Vexia code still), Player Name
*/
@Initializable
public class RevenantNPC extends AbstractNPC {
@@ -88,6 +88,7 @@ public class RevenantNPC extends AbstractNPC {
configureBonuses();
super.configure();
this.swingHandler = new RevenantCombatHandler(getProperties().getAttackAnimation(), getProperties().getMagicAnimation(), getProperties().getRangeAnimation());
setAttribute("food-items", 20);
}
@Override
@@ -116,16 +117,23 @@ public class RevenantNPC extends AbstractNPC {
public void tick() {
skills.pulse();
getWalkingQueue().update();
if (this.getViewport().getRegion().isActive())
if (this.getViewport().getRegion().isActive()) {
getUpdateMasks().prepare(this);
if (!DeathTask.isDead(this) && getSkills().getLifepoints() <= (getSkills().getStaticLevel(Skills.HITPOINTS) / 2) && getAttribute("eat-delay", 0) < GameWorld.getTicks()) {
lock(3);
getProperties().getCombatPulse().delayNextAttack(3);
getSkills().heal(10);
for (Player p : RegionManager.getLocalPlayers(this)) {
playAudio(p, Sounds.EAT_2393);
}
if (!DeathTask.isDead(this)) {
int curhp = getSkills().getLifepoints();
int maxhp = getSkills().getStaticLevel(Skills.HITPOINTS);
int fooditems = getAttribute("food-items", 0);
if (curhp < maxhp / 2 && fooditems > 0 && getAttribute("eat-delay", 0) < GameWorld.getTicks()) {
lock(3);
getProperties().getCombatPulse().delayNextAttack(3);
getSkills().heal(maxhp / 6);
for (Player p : RegionManager.getLocalPlayers(this)) {
playAudio(p, Sounds.EAT_2393);
}
setAttribute("eat-delay", GameWorld.getTicks() + 6);
setAttribute("food-items", fooditems - 1);
}
setAttribute("eat-delay", GameWorld.getTicks() + 6);
}
behavior.tick(this);
if (aggressiveHandler != null && aggressiveHandler.selectTarget()) {
@@ -196,9 +204,9 @@ public class RevenantNPC extends AbstractNPC {
public boolean isAttackable(Entity entity, CombatStyle style, boolean message) {
if (entity instanceof Player) {
if (!hasAcceptableCombatLevel(entity.asPlayer()) && !entity.asPlayer().isAdmin()) {
if(message) {
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;
}
}