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:
@@ -1,6 +1,6 @@
|
||||
package core.game.node.entity.combat;
|
||||
|
||||
import core.ServerConstants;
|
||||
import content.data.EnchantedJewellery;
|
||||
import core.game.container.impl.EquipmentContainer;
|
||||
import core.game.node.entity.skill.Skills;
|
||||
import content.global.skill.summoning.familiar.Familiar;
|
||||
@@ -14,6 +14,7 @@ import core.game.system.task.Pulse;
|
||||
import core.game.bots.AIPlayer;
|
||||
import core.game.world.GameWorld;
|
||||
import core.game.world.map.zone.ZoneType;
|
||||
import org.rs09.consts.Items;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
@@ -200,12 +201,13 @@ public final class ImpactHandler {
|
||||
impactQueue.add(impact);
|
||||
if (entity instanceof Player && !dead) {
|
||||
final Player p = entity.asPlayer();
|
||||
if (p.getZoneMonitor().getType() != ZoneType.SAFE.getId() && p.getSkullManager().getLevel() <= 30 && (p.getEquipment().contains(2570, 1))) {
|
||||
if (p.getZoneMonitor().getType() != ZoneType.SAFE.getId() && (p.getEquipment().contains(Items.RING_OF_LIFE_2570, 1))) {
|
||||
int percentage = (int) (entity.getSkills().getStaticLevel(Skills.HITPOINTS) * 0.10);
|
||||
if (p.getSkills().getLifepoints() <= percentage) {
|
||||
p.getEquipment().remove(new Item(2570));
|
||||
p.sendMessage("Your ring of life saves you and in the process is destroyed.");
|
||||
p.teleport(ServerConstants.HOME_LOCATION);
|
||||
Item rolItem = new Item(Items.RING_OF_LIFE_2570);
|
||||
if (EnchantedJewellery.RING_OF_LIFE.attemptTeleport(p, rolItem, 0, true)) {
|
||||
p.sendMessage("Your ring of life saves you and in the process is destroyed.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package core.game.system.command.sets
|
||||
|
||||
import core.api.log
|
||||
import core.api.sendMessage
|
||||
import core.cache.Cache
|
||||
import core.game.node.scenery.Scenery
|
||||
import core.game.node.scenery.SceneryBuilder
|
||||
import core.game.node.entity.npc.NPC
|
||||
import core.game.node.item.Item
|
||||
import core.tools.SystemLogger
|
||||
import core.game.system.command.CommandPlugin
|
||||
import core.plugin.Initializable
|
||||
import core.game.system.command.Privilege
|
||||
@@ -22,19 +22,40 @@ class SpawnCommandSet : CommandSet(Privilege.ADMIN){
|
||||
*/
|
||||
define("npc"){player,args ->
|
||||
if (args.size < 2) {
|
||||
reject(player,"syntax error: id (optional) direction")
|
||||
reject(player, "syntax: id (required) amount (optional) isWalks (optional)")
|
||||
return@define
|
||||
}
|
||||
val npc = NPC.create(CommandPlugin.toInteger(args[1]!!), player!!.location)
|
||||
npc.setAttribute("spawned:npc", true)
|
||||
npc.isRespawn = false
|
||||
npc.direction = player.direction
|
||||
npc.init()
|
||||
npc.isWalks = args.size > 2
|
||||
val npcString = "{" + npc.location.x + "," + npc.location.y + "," + npc.location.z + "," + (if (npc.isWalks) "1" else "0") + "," + npc.direction.ordinal + "}"
|
||||
val amount = if (args.size > 2) CommandPlugin.toInteger(args[2]) else 1
|
||||
if (amount < 1) {
|
||||
reject(player, "Invalid amount")
|
||||
return@define
|
||||
}
|
||||
if (amount > 900) {
|
||||
reject(player, "Based on experience, spawning that many NPCs at once is a bad idea")
|
||||
return@define
|
||||
}
|
||||
var isWalks = false
|
||||
if (args.size > 3) {
|
||||
if (args[3] == "true") {
|
||||
isWalks = true
|
||||
} else if (args[3] != "" && args[3] != "false") {
|
||||
reject(player, "The \"isWalks\" argument only accepts \"true\" and \"false\"")
|
||||
return@define
|
||||
}
|
||||
}
|
||||
var npcString = ""
|
||||
for (i in 1..amount) {
|
||||
val npc = NPC.create(CommandPlugin.toInteger(args[1]), player.location)
|
||||
npc.setAttribute("spawned:npc", true)
|
||||
npc.isRespawn = false
|
||||
npc.direction = player.direction
|
||||
npc.init()
|
||||
npc.isWalks = isWalks
|
||||
npcString = "{" + npc.location.x + "," + npc.location.y + "," + npc.location.z + "," + (if (npc.isWalks) "1" else "0") + "," + npc.direction.ordinal + "}"
|
||||
println(npcString)
|
||||
}
|
||||
val clpbrd = Toolkit.getDefaultToolkit().systemClipboard
|
||||
clpbrd.setContents(StringSelection(npcString), null)
|
||||
println(npcString)
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -19,7 +19,7 @@ class SkillRestore : RSTimer (1, "skillrestore", isAuto = true, isSoft = true) {
|
||||
var skills = entity.skills
|
||||
|
||||
for (i in 0 until 24) {
|
||||
if (i == Skills.PRAYER) continue
|
||||
if (i == Skills.PRAYER || i == Skills.SUMMONING) continue
|
||||
if (ticksSinceLastRestore[i]++ >= restoreTicks[i]) {
|
||||
if (i == Skills.HITPOINTS && entity.skills.lifepoints < entity.skills.maximumLifepoints) {
|
||||
skills.heal (getHealAmount(entity))
|
||||
|
||||
@@ -24,12 +24,12 @@ import org.rs09.consts.Items;
|
||||
public final class ZoneMonitor {
|
||||
|
||||
/**
|
||||
* The set of dragonstone teleport jewellery, which allow teleporting from up to and including level 30 wildy.
|
||||
* Used to check if a player can teleport from 20 < level <= 30 wildy, see canTeleportByDragonstoneJewellery.
|
||||
* The set of jewellery which allow teleporting from up to and including level 30 wildy.
|
||||
* Used to check if a player can teleport from 20 < level <= 30 wildy, see canTeleportByJewellery.
|
||||
* Note: the check is based on the nextJewellery (see EnchantedJewellery.kt), so this list should not contain the (4) items, and should contain the empty ones.
|
||||
* @author Player Name
|
||||
*/
|
||||
static final Set<Integer> DRAGONSTONE_TELEPORT_JEWELLERY = Set.of(
|
||||
static final Set<Integer> MID_WILDY_TELEPORT_JEWELLERY = Set.of(
|
||||
Items.AMULET_OF_GLORY_1704,
|
||||
Items.AMULET_OF_GLORY1_1706,
|
||||
Items.AMULET_OF_GLORY2_1708,
|
||||
@@ -49,7 +49,8 @@ public final class ZoneMonitor {
|
||||
Items.RING_OF_WEALTH_14638,
|
||||
Items.RING_OF_WEALTH1_14640,
|
||||
Items.RING_OF_WEALTH2_14642,
|
||||
Items.RING_OF_WEALTH3_14644
|
||||
Items.RING_OF_WEALTH3_14644,
|
||||
Items.RING_OF_LIFE_2570
|
||||
);
|
||||
|
||||
/**
|
||||
@@ -235,7 +236,7 @@ public final class ZoneMonitor {
|
||||
* @return {@code True} if so.
|
||||
*/
|
||||
public boolean teleport(int type, Node node) {
|
||||
if (type != -1 && entity.isTeleBlocked() && !canTeleportByDragonstoneJewellery(type, node)) {
|
||||
if (type != -1 && entity.isTeleBlocked() && !canTeleportByJewellery(type, node)) {
|
||||
if (entity.isPlayer()) {
|
||||
entity.asPlayer().sendMessage("A magical force has stopped you from teleporting.");
|
||||
}
|
||||
@@ -250,11 +251,11 @@ public final class ZoneMonitor {
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a player can teleport with a dragonstone jewellery piece in >= 1 <= 30 wilderness level
|
||||
* Checks if a player can teleport with a jewellery piece in >= 1 <= 30 wilderness level
|
||||
* @return {@code True} if so.
|
||||
*/
|
||||
private boolean canTeleportByDragonstoneJewellery(int type, Node node) {
|
||||
if (type != 1 || !DRAGONSTONE_TELEPORT_JEWELLERY.contains(node.asItem().getId())) {
|
||||
private boolean canTeleportByJewellery(int type, Node node) {
|
||||
if (type != 1 || !MID_WILDY_TELEPORT_JEWELLERY.contains(node.asItem().getId())) {
|
||||
return false;
|
||||
}
|
||||
if (entity.timers.getTimer("teleblock") != null)
|
||||
|
||||
@@ -113,7 +113,7 @@ public final class WildernessZone extends MapZone {
|
||||
int normalGloveRate = isDeepWildy && isRevOrCele ? 100 : (int)((1.0/(1.0-Math.pow(1.0 - (1.0/(double)pvpGearRate), 16.0))) * 5.0 / 6.0);
|
||||
|
||||
if (RandomFunction.roll(e.getId() == NPCs.CHAOS_ELEMENTAL_3200 ? cEleGloveRate : normalGloveRate)) {
|
||||
byte glove = (byte) RandomFunction.random(1, 13);
|
||||
byte glove = (byte) RandomFunction.random(1, 14);
|
||||
Item reward = new Item(BrawlingGloves.forIndicator(glove).getId());
|
||||
GroundItemManager.create(reward, e.asNpc().getDropLocation(), killer.asPlayer());
|
||||
Repository.sendNews(killer.getUsername() + " has received " + reward.getName().toLowerCase() + " from a " + e.asNpc().getName() + "!");
|
||||
|
||||
Reference in New Issue
Block a user