diff --git a/Server/src/main/content/data/consumables/Consumables.java b/Server/src/main/content/data/consumables/Consumables.java
index 0b60525f6..22a5eeb32 100644
--- a/Server/src/main/content/data/consumables/Consumables.java
+++ b/Server/src/main/content/data/consumables/Consumables.java
@@ -4,7 +4,6 @@ import content.data.consumables.effects.*;
import core.game.consumable.*;
import org.rs09.consts.Items;
import core.game.node.entity.player.link.diary.DiaryType;
-import core.game.node.entity.state.EntityState;
import core.game.world.update.flag.context.Animation;
import core.game.node.entity.skill.Skills;
import content.data.consumables.effects.KegOfBeerEffect;
@@ -164,7 +163,7 @@ public enum Consumables {
LIME_SLICES(new Food(new int[] {2124}, new HealingEffect(2))),
PEACH(new Food(new int[] {6883}, new HealingEffect(8))),
WHITE_TREE_FRUIT(new Food(new int[] {6469}, new MultiEffect(new RandomEnergyEffect(5, 10), new HealingEffect(3)))),
- STRANGE_FRUIT(new Food(new int[] {464}, new MultiEffect(new RemoveStateEffect(EntityState.POISONED.ordinal()), new EnergyEffect(30)))),
+ STRANGE_FRUIT(new Food(new int[] {464}, new MultiEffect(new RemoveTimerEffect("poison"), new EnergyEffect(30)))),
/** Gnome Cooking */
TOAD_CRUNCHIES(new Food(new int[] {2217}, new HealingEffect(12))),
@@ -321,11 +320,11 @@ public enum Consumables {
SUPER_STRENGTH(new Potion(new int[] {2440, 157, 159, 161}, new SkillEffect(Skills.STRENGTH, 3, 0.2))),
SUPER_ATTACK(new Potion(new int[] {2436, 145, 147, 149}, new SkillEffect(Skills.ATTACK, 3, 0.2))),
SUPER_DEFENCE(new Potion(new int[] {2442, 163, 165, 167}, new SkillEffect(Skills.DEFENCE, 3, 0.2))),
- ANTIPOISON(new Potion(new int[] {2446, 175, 177, 179}, new MultiEffect(new SetAttributeEffect("poison:immunity", 143), new RemoveStateEffect(EntityState.POISONED.ordinal())))),
- ANTIPOISON_(new Potion(new int[] {5943, 5945, 5947, 5949}, new MultiEffect(new SetAttributeEffect("poison:immunity", 863), new RemoveStateEffect(EntityState.POISONED.ordinal())))),
- ANTIPOISON__(new Potion(new int[] {5952, 5954, 5956, 5958}, new MultiEffect(new SetAttributeEffect("poison:immunity", 2000), new RemoveStateEffect(EntityState.POISONED.ordinal())))),
- SUPER_ANTIP(new Potion(new int[] {2448, 181, 183, 185}, new MultiEffect(new SetAttributeEffect("poison:immunity", 1000), new RemoveStateEffect(EntityState.POISONED.ordinal())))),
- RELICYM(new Potion(new int[] {4842, 4844, 4846, 4848}, new MultiEffect(new SetAttributeEffect("disease:immunity", 300), new RemoveStateEffect("disease")))),
+ ANTIPOISON(new Potion(new int[] {2446, 175, 177, 179}, new AddTimerEffect("poison:immunity", 143))),
+ ANTIPOISON_(new Potion(new int[] {5943, 5945, 5947, 5949}, new AddTimerEffect("poison:immunity", 863))),
+ ANTIPOISON__(new Potion(new int[] {5952, 5954, 5956, 5958}, new AddTimerEffect("poison:immunity", 2000))),
+ SUPER_ANTIP(new Potion(new int[] {2448, 181, 183, 185}, new AddTimerEffect("poison:immunity", 1000))),
+ RELICYM(new Potion(new int[] {4842, 4844, 4846, 4848}, new MultiEffect(new SetAttributeEffect("disease:immunity", 300), new RemoveTimerEffect("disease")))),
AGILITY(new Potion(new int[] {3032, 3034, 3036, 3038}, new SkillEffect(Skills.AGILITY, 3, 0))),
HUNTER(new Potion(new int[] {9998, 10000, 10002, 10004}, new SkillEffect(Skills.HUNTER, 3, 0))),
RESTORE(new Potion(new int[] {2430, 127, 129, 131}, new RestoreEffect(10, 0.3))),
@@ -338,9 +337,9 @@ public enum Consumables {
SUPER_RESTO(new Potion(new int[] {3024, 3026, 3028, 3030}, new MultiEffect(new RestoreEffect(8, 0.25), new PrayerEffect(8, 0.25), new SummoningEffect(8, 0.25)))),
ZAMMY_BREW(new Potion(new int[] {2450, 189, 191, 193}, new MultiEffect(new DamageEffect(10, true), new SkillEffect(Skills.ATTACK, 0, 0.15), new SkillEffect(Skills.STRENGTH, 0, 0.25), new SkillEffect(Skills.DEFENCE, 0, -0.1), new RandomPrayerEffect(0, 10)))),
ANTIFIRE(new Potion(new int[] {2452, 2454, 2456, 2458}, new SetAttributeEffect("fire:immune", 600, true))),
- GUTH_REST(new Potion(new int[] {4417, 4419, 4421, 4423}, new MultiEffect(new RemoveStateEffect(EntityState.POISONED.ordinal()), new EnergyEffect(5), new HealingEffect(5)))),
+ GUTH_REST(new Potion(new int[] {4417, 4419, 4421, 4423}, new MultiEffect(new RemoveTimerEffect("poison"), new EnergyEffect(5), new HealingEffect(5)))),
MAGIC_ESS(new Potion(new int[] {11491, 11489}, new SkillEffect(Skills.MAGIC,3,0))),
- SANFEW(new Potion(new int[] {10925, 10927, 10929, 10931}, new MultiEffect(new RestoreEffect(8,0.25), new PrayerEffect(8,0.25), new RemoveStateEffect(EntityState.POISONED.ordinal()), new RemoveStateEffect("disease")))),
+ SANFEW(new Potion(new int[] {10925, 10927, 10929, 10931}, new MultiEffect(new RestoreEffect(8,0.25), new PrayerEffect(8,0.25), new RemoveTimerEffect("poison"), new RemoveTimerEffect("disease")))),
SUPER_ENERGY(new Potion(new int[] {3016, 3018, 3020, 3022}, new EnergyEffect(20))),
BLAMISH_OIL(new FakeConsumable(1582, new String[] {"You know... I'd really rather not."})),
@@ -348,8 +347,8 @@ public enum Consumables {
PRAYERMIX(new BarbarianMix(new int[] {11465, 11467}, new MultiEffect(new PrayerEffect(7, 0.25), new HealingEffect(6)))),
ZAMMY_MIX(new BarbarianMix(new int[] {11521, 11523}, new MultiEffect(new DamageEffect(10, true), new SkillEffect(Skills.ATTACK, 0, 0.15), new SkillEffect(Skills.STRENGTH, 0, 0.25), new SkillEffect(Skills.DEFENCE, 0, -0.1), new RandomPrayerEffect(0, 10)))),
ATT_MIX(new BarbarianMix(new int[] {11429, 11431}, new MultiEffect(new SkillEffect(Skills.ATTACK, 3, 0.1), new HealingEffect(3)))),
- ANTIP_MIX(new BarbarianMix(new int[] {11433, 11435}, new MultiEffect(new RemoveStateEffect(EntityState.POISONED.ordinal()), new SetAttributeEffect("poison:immunity", 143), new HealingEffect(3)))),
- RELIC_MIX(new BarbarianMix(new int[] {11437, 11439}, new MultiEffect(new RemoveStateEffect("disease"), new SetAttributeEffect("disease:immunity", 300), new HealingEffect(3)))),
+ ANTIP_MIX(new BarbarianMix(new int[] {11433, 11435}, new MultiEffect(new AddTimerEffect("poison:immunity", 143), new HealingEffect(3)))),
+ RELIC_MIX(new BarbarianMix(new int[] {11437, 11439}, new MultiEffect(new RemoveTimerEffect("disease"), new SetAttributeEffect("disease:immunity", 300), new HealingEffect(3)))),
STR_MIX(new BarbarianMix(new int[] {11443, 11441}, new MultiEffect(new SkillEffect(Skills.STRENGTH, 3, 0.1), new HealingEffect(3)))),
RESTO_MIX(new BarbarianMix(new int[] {11449, 11451}, new MultiEffect(new RestoreEffect(10, 0.3), new HealingEffect(3)))),
SUPER_RESTO_MIX(new BarbarianMix(new int [] {11493, 11495}, new MultiEffect(new RestoreEffect(8,0.25), new PrayerEffect(8, 0.25), new SummoningEffect(8, 0.25), new HealingEffect(6)))),
diff --git a/Server/src/main/content/data/consumables/effects/AddTimerEffect.kt b/Server/src/main/content/data/consumables/effects/AddTimerEffect.kt
new file mode 100644
index 000000000..48b11b475
--- /dev/null
+++ b/Server/src/main/content/data/consumables/effects/AddTimerEffect.kt
@@ -0,0 +1,13 @@
+package content.data.consumables.effects
+
+import core.api.*
+import core.game.system.timer.impl.PoisonImmunity
+import core.game.consumable.ConsumableEffect
+import core.game.node.entity.player.Player
+
+class AddTimerEffect (val identifier: String, vararg val args: Any) : ConsumableEffect() {
+ override fun activate (p: Player) {
+ val timer = spawnTimer (identifier, args) ?: return
+ registerTimer (p, timer)
+ }
+}
diff --git a/Server/src/main/content/data/consumables/effects/RemoveStateEffect.java b/Server/src/main/content/data/consumables/effects/RemoveStateEffect.java
deleted file mode 100644
index 7c2d5040a..000000000
--- a/Server/src/main/content/data/consumables/effects/RemoveStateEffect.java
+++ /dev/null
@@ -1,25 +0,0 @@
-package content.data.consumables.effects;
-
-import core.game.consumable.ConsumableEffect;
-import core.game.node.entity.player.Player;
-import core.game.node.entity.state.EntityState;
-
-public class RemoveStateEffect extends ConsumableEffect {
- int state = -1;
- String statekey;
- @Deprecated
- public RemoveStateEffect(int state){
- this.state = state;
- }
- public RemoveStateEffect(String key){
- statekey = key;
- }
- @Override
- public void activate(Player p) {
- if(state == -1){
- p.clearState(statekey);
- return;
- }
- p.getStateManager().remove(EntityState.values()[state]);
- }
-}
diff --git a/Server/src/main/content/data/consumables/effects/RemoveTimerEffect.kt b/Server/src/main/content/data/consumables/effects/RemoveTimerEffect.kt
new file mode 100644
index 000000000..6d45c35e9
--- /dev/null
+++ b/Server/src/main/content/data/consumables/effects/RemoveTimerEffect.kt
@@ -0,0 +1,11 @@
+package content.data.consumables.effects
+
+import core.api.*
+import core.game.consumable.ConsumableEffect
+import core.game.node.entity.player.Player
+
+class RemoveTimerEffect (val identifier: String) : ConsumableEffect() {
+ override fun activate (p: Player) {
+ removeTimer (p, identifier)
+ }
+}
diff --git a/Server/src/main/content/global/activity/cchallange/ChampionChallengeListener.kt b/Server/src/main/content/global/activity/cchallange/ChampionChallengeListener.kt
index a854778b7..8cea6d806 100644
--- a/Server/src/main/content/global/activity/cchallange/ChampionChallengeListener.kt
+++ b/Server/src/main/content/global/activity/cchallange/ChampionChallengeListener.kt
@@ -15,7 +15,6 @@ import core.game.global.action.DoorActionHandler
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import core.game.node.entity.player.Player
-import core.game.node.entity.state.EntityState
import core.game.node.item.Item
import core.game.system.task.Pulse
import core.game.world.map.Location
@@ -174,7 +173,6 @@ class ChampionChallengeListener : InteractionListener, MapArea {
override fun pulse(): Boolean {
when (counter++) {
1 -> {
- player.stateManager.get(EntityState.TELEBLOCK)
player.familiarManager.dismiss()
}
2 -> DoorActionHandler.handleDoor(player, node.asScenery())
@@ -231,4 +229,4 @@ class ChampionChallengeListener : InteractionListener, MapArea {
ZoneRestriction.RANDOM_EVENTS
)
}
-}
\ No newline at end of file
+}
diff --git a/Server/src/main/content/global/activity/shootingstar/ShootingStarState.kt b/Server/src/main/content/global/activity/shootingstar/ShootingStarState.kt
deleted file mode 100644
index 0adbf564d..000000000
--- a/Server/src/main/content/global/activity/shootingstar/ShootingStarState.kt
+++ /dev/null
@@ -1,47 +0,0 @@
-package content.global.activity.shootingstar
-
-import core.game.node.entity.player.Player
-import core.game.node.entity.state.PlayerState
-import core.game.node.entity.state.State
-import core.game.system.task.Pulse
-import core.tools.ticksToSeconds
-import org.json.simple.JSONObject
-
-@PlayerState("shooting-star")
-class ShootingStarState(player: Player? = null) : State(player) {
- var ticksLeft = 1500
-
- override fun save(root: JSONObject) {
- root["ticksLeft"] = ticksLeft
- }
-
- override fun parse(_data: JSONObject) {
- if(_data.containsKey("ticksLeft")){
- ticksLeft = _data["ticksLeft"].toString().toInt()
- }
- }
-
- override fun newInstance(player: Player?): State {
- return ShootingStarState(player)
- }
-
- override fun createPulse() {
- player ?: return
- if(ticksLeft <= 0) return
- pulse = object : Pulse(){
- override fun pulse(): Boolean {
- val minutes = ticksToSeconds(ticksLeft) / 60.0
- if(minutes % 5.0 == 0.0){
- player.sendMessage("
You have $minutes minutes of your mining bonus left")
- }
- if(ticksLeft-- <= 0){
- player.sendMessage("Your mining bonus has run out!")
- pulse = null
- return true
- }
- return false
- }
- }
- }
-
-}
\ No newline at end of file
diff --git a/Server/src/main/content/global/activity/shootingstar/StarBonus.kt b/Server/src/main/content/global/activity/shootingstar/StarBonus.kt
new file mode 100644
index 000000000..d0c764e7d
--- /dev/null
+++ b/Server/src/main/content/global/activity/shootingstar/StarBonus.kt
@@ -0,0 +1,28 @@
+package content.global.activity.shootingstar
+
+import core.api.*
+import core.game.system.timer.*
+import core.game.node.entity.Entity
+import core.game.node.entity.player.Player
+import org.json.simple.*
+
+class StarBonus : PersistTimer (1, "shootingstar:bonus") {
+ var ticksLeft = 1500
+
+ override fun save (root: JSONObject, entity: Entity) {
+ root["ticksLeft"] = ticksLeft.toString()
+ }
+
+ override fun parse (root: JSONObject, entity: Entity) {
+ ticksLeft = root["ticksLeft"].toString().toInt()
+ }
+
+ override fun run (entity: Entity) : Boolean {
+ if (entity is Player && ticksLeft == 500) {
+ entity.sendMessage("You have 5 minutes of your mining bonus left")
+ } else if (entity is Player && ticksLeft == 0) {
+ entity.sendMessage("Your mining bonus has run out!")
+ }
+ return ticksLeft-- > 0
+ }
+}
diff --git a/Server/src/main/content/global/activity/shootingstar/StarSpriteDialogue.kt b/Server/src/main/content/global/activity/shootingstar/StarSpriteDialogue.kt
index c1a1e6a75..56b7e1554 100644
--- a/Server/src/main/content/global/activity/shootingstar/StarSpriteDialogue.kt
+++ b/Server/src/main/content/global/activity/shootingstar/StarSpriteDialogue.kt
@@ -198,7 +198,8 @@ class StarSpriteDialogue(player: Player? = null) : core.game.dialogue.DialoguePl
getStoreFile()[player.username.toLowerCase()] = true //flag daily as completed
- player.registerState("shooting-star")?.init()
+ val timer = getOrStartTimer (player)
+ timer.ticksLeft = 1500
if(wearingRing){
val item = intArrayOf(Items.COSMIC_RUNE_564, Items.ASTRAL_RUNE_9075, Items.GOLD_ORE_445, Items.COINS_995).random()
@@ -263,8 +264,8 @@ class StarSpriteDialogue(player: Player? = null) : core.game.dialogue.DialoguePl
fun rollForRingBonus(player: Player, bonusId: Int, bonusBaseAmt: Int){
if(RandomFunction.roll(3)){
- val state = player.states["shooting-star"] as? ShootingStarState ?: return
- state.ticksLeft += secondsToTicks(TimeUnit.MINUTES.toSeconds(5).toInt())
+ var bonus = getOrStartTimer (player)
+ bonus.ticksLeft += 500
sendMessage(player, colorize("%RYour ring shines dimly as if imbued with energy."))
} else if(RandomFunction.roll(5)){
addItem(player, bonusId, bonusBaseAmt)
diff --git a/Server/src/main/content/global/handlers/item/KeldagrimVotingBond.java b/Server/src/main/content/global/handlers/item/KeldagrimVotingBond.java
deleted file mode 100644
index dd4612ee0..000000000
--- a/Server/src/main/content/global/handlers/item/KeldagrimVotingBond.java
+++ /dev/null
@@ -1,188 +0,0 @@
-//package core.game.interaction.item;
-//
-//import java.text.DecimalFormat;
-//import java.util.concurrent.TimeUnit;
-//
-//import core.cache.def.impl.ItemDefinition;
-//import core.game.dialogue.DialogueInterpreter;
-//import core.game.dialogue.DialoguePlugin;
-//import core.game.content.ttrail.ClueLevel;
-//import core.game.content.ttrail.ClueScrollPlugin;
-//import core.game.interaction.OptionHandler;
-//import core.game.node.Node;
-//import core.game.node.entity.player.Player;
-//import core.game.node.entity.state.EntityState;
-//import core.game.node.item.Item;
-//import core.game.world.repository.Repository;
-//import core.plugin.Plugin;
-//import core.plugin.PluginManager;
-//import core.plugin.InitializablePlugin;
-//import core.tools.RandomFunction;
-//
-///**
-// * Handles the keldagrim voting bond item.
-// * @author Vexia
-// *
-// */
-//@InitializablePlugin
-//public class KeldagrimVotingBond extends OptionHandler {
-//
-// /**
-// * The keldagrim bond item.
-// */
-// private static final Item BOND = new Item(14807);
-//
-// /**
-// * The ultra lamp item.
-// */
-// private static final Item ULTRA_LAMP = new Item(14820);
-//
-// @Override
-// public Plugin