Light source is now required to get boots of lightness

Boots of lightness now work as expected
This commit is contained in:
oftheshire 2025-11-25 13:00:31 +00:00 committed by Ryan
parent 1fa2d3460f
commit 8dd82dd356
6 changed files with 79 additions and 13 deletions

View file

@ -1,12 +1,15 @@
package content.global.skill.crafting.lightsources package content.global.skill.crafting.lightsources
import content.data.LightSource
import core.api.log import core.api.log
import core.api.*
import core.cache.def.impl.ItemDefinition import core.cache.def.impl.ItemDefinition
import core.game.container.Container import core.game.container.Container
import core.game.interaction.OptionHandler import core.game.interaction.OptionHandler
import core.game.node.Node import core.game.node.Node
import core.game.node.entity.player.Player import core.game.node.entity.player.Player
import core.game.node.item.Item import core.game.node.item.Item
import core.game.world.map.Location
import core.tools.SystemLogger import core.tools.SystemLogger
import core.plugin.Initializable import core.plugin.Initializable
import core.plugin.Plugin import core.plugin.Plugin
@ -32,6 +35,12 @@ class LightSourceExtinguisher : OptionHandler(){
lightSource ?: return false.also { log(this::class.java, Log.WARN, "UNHANDLED EXTINGUISH OPTION: ID = ${node.id}") } lightSource ?: return false.also { log(this::class.java, Log.WARN, "UNHANDLED EXTINGUISH OPTION: ID = ${node.id}") }
// For Temple of Ikov - if you are in the dark basement, do not let light source extinguish.
if(player.location.isInRegion(10648)) {
sendMessage(player, "Extinguishing the " + LightSource.getActiveLightSource(player).product.name.lowercase() + " would leave you without a light source.")
return true
}
player.inventory.replace(node.asItem(), Item(lightSource.fullID)) player.inventory.replace(node.asItem(), Item(lightSource.fullID))
return true return true
} }

View file

@ -1,12 +1,16 @@
package content.global.skill.crafting.lightsources package content.global.skill.crafting.lightsources
import core.api.*
import core.api.teleport
import core.game.container.Container import core.game.container.Container
import core.game.event.LitLightSourceEvent import core.game.event.LitLightSourceEvent
import core.game.interaction.NodeUsageEvent import core.game.interaction.NodeUsageEvent
import core.game.interaction.UseWithHandler import core.game.interaction.UseWithHandler
import core.game.node.entity.Entity
import core.game.node.entity.player.Player import core.game.node.entity.player.Player
import core.game.node.entity.skill.Skills import core.game.node.entity.skill.Skills
import core.game.node.item.Item import core.game.node.item.Item
import core.game.world.map.Location
import core.plugin.Initializable import core.plugin.Initializable
import core.plugin.Plugin import core.plugin.Plugin
@ -72,6 +76,14 @@ class LightSourceLighter : UseWithHandler(590,36,38){
return true return true
} }
// For Temple of Ikov - if you are in the dark basement and light a light source, switch to the light basement.
// For the listener that covers the firemaking cape perk, see content.global.skill.skillcapeperks.SkillcapePerks.kt
if(event.player.location.isInRegion(10648) && event.player.location.withinDistance(Location(2639,9738,0), 8)) {
teleport(event.player, Location.create(event.player.getLocation().getX(), event.player.getLocation().getY() + 23, event.player.getLocation().getZ()))
closeDialogue(event.player)
// Dark basement is region 10648, min 2639 9738 0, max 2643 9744 0. Add 23 to the Y loc to tele to light basement
}
if(!light(event.player,used,lightSource)){ if(!light(event.player,used,lightSource)){
event.player.sendMessage("You need a Firemaking level of at least ${lightSource.levelRequired} to light this.") event.player.sendMessage("You need a Firemaking level of at least ${lightSource.levelRequired} to light this.")
} }

View file

@ -1,6 +1,8 @@
package content.global.skill.skillcapeperks package content.global.skill.skillcapeperks
import core.api.sendMessage
import core.game.interaction.InteractionListener import core.game.interaction.InteractionListener
import core.game.world.GameWorld
class SkillcapeEquipmentPlugin : InteractionListener { class SkillcapeEquipmentPlugin : InteractionListener {
override fun defineListeners() { override fun defineListeners() {
@ -19,6 +21,13 @@ class SkillcapeEquipmentPlugin : InteractionListener {
onUnequip(capes){player, node -> onUnequip(capes){player, node ->
val skillcape = Skillcape.forId(node.id) val skillcape = Skillcape.forId(node.id)
// For Temple of Ikov. Do not let player unequip firemaking skillcape in the dark basement (need to keep an active light source).
if(player.location.isInRegion(10648) && (node.id == 9804 || node.id == 9805) && GameWorld.settings?.skillcape_perks == true) {
sendMessage(player, "Unequipping that skillcape would leave you without a light source.")
return@onUnequip false
}
val perk = SkillcapePerks.forSkillcape(skillcape) val perk = SkillcapePerks.forSkillcape(skillcape)
perk.deactivate(player) perk.deactivate(player)
return@onUnequip true return@onUnequip true

View file

@ -131,8 +131,15 @@ enum class SkillcapePerks(val attribute: String, val effect: ((Player) -> Unit)?
player.setAttribute("/save:$attribute",true) player.setAttribute("/save:$attribute",true)
} }
player.debug("Activated ${this.name}") player.debug("Activated ${this.name}")
if(this == CONSTANT_GLOW) if(this == CONSTANT_GLOW) {
DarkZone.checkDarkArea(player) DarkZone.checkDarkArea(player)
// For Temple of Ikov - if you are in the dark basement and put on the firemaking cape with its 2009Scape light source perk, switch to the light basement.
// For the listener that teleports if you light a normal light source, see content.global.skill.crafting.lightsources.LightSourceLighter.kt
if(player.location.isInRegion(10648) && player.location.withinDistance(Location(2639,9738,0), 8)) {
teleport(player, Location.create(player.getLocation().getX(), player.getLocation().getY() + 23, player.getLocation().getZ()))
closeDialogue(player)
}
}
} }
fun operate(player: Player){ fun operate(player: Player){

View file

@ -1,7 +1,6 @@
package content.global.skill.slayer; package content.global.skill.slayer;
import core.cache.def.impl.SceneryDefinition; import core.cache.def.impl.SceneryDefinition;
import core.game.global.action.ClimbActionHandler;
import core.game.global.action.DigAction; import core.game.global.action.DigAction;
import core.game.global.action.DigSpadeHandler; import core.game.global.action.DigSpadeHandler;
import core.game.interaction.OptionHandler; import core.game.interaction.OptionHandler;
@ -34,8 +33,6 @@ public class SlayerPlugin extends OptionHandler {
SceneryDefinition.forId(15767).getHandlers().put("option:enter", this); SceneryDefinition.forId(15767).getHandlers().put("option:enter", this);
SceneryDefinition.forId(15811).getHandlers().put("option:exit", this); SceneryDefinition.forId(15811).getHandlers().put("option:exit", this);
SceneryDefinition.forId(15812).getHandlers().put("option:exit", this); SceneryDefinition.forId(15812).getHandlers().put("option:exit", this);
SceneryDefinition.forId(96).getHandlers().put("option:climb-up", this);
SceneryDefinition.forId(35121).getHandlers().put("option:climb-down", this);
for (Location loc : BRYNE_DIGS) { for (Location loc : BRYNE_DIGS) {
DigSpadeHandler.register(loc, new DigAction() { DigSpadeHandler.register(loc, new DigAction() {
@Override @Override
@ -53,27 +50,25 @@ public class SlayerPlugin extends OptionHandler {
public boolean handle(Player player, Node node, String option) { public boolean handle(Player player, Node node, String option) {
switch (node.getId()) { switch (node.getId()) {
case 8785: case 8785:
// Outside of trap door in East Ardy
player.teleport(new Location(2543, 3327, 0)); player.teleport(new Location(2543, 3327, 0));
break; break;
case 23158: case 23158:
case 23157: case 23157:
// Outside brine rat cave
player.teleport(new Location(2729, 3733, 0)); player.teleport(new Location(2729, 3733, 0));
break; break;
case 15767: case 15767:
if (!hasRequirement(player, Quests.CABIN_FEVER)) if (!hasRequirement(player, Quests.CABIN_FEVER))
return true; return true;
player.teleport(new Location(3748, 9373, 0)); player.teleport(new Location(3748, 9373, 0));
// Cave horrors - inside of cave
break; break;
case 15811: case 15811:
case 15812: case 15812:
// Cave horrors - outside of cave
player.teleport(new Location(3749, 2973, 0)); player.teleport(new Location(3749, 2973, 0));
break; break;
case 96:
ClimbActionHandler.climb(player, null, new Location(2649, 9804, 0));
break;
case 35121:
ClimbActionHandler.climb(player, null, new Location(2641, 9763, 0));
break;
} }
return true; return true;
} }
@ -81,11 +76,9 @@ public class SlayerPlugin extends OptionHandler {
@Override @Override
public Location getDestination(Node node, Node n) { public Location getDestination(Node node, Node n) {
if (n.getId() == 23158 || n.getId() == 23157) { if (n.getId() == 23158 || n.getId() == 23157) {
// Inside brine rate cave
return new Location(2690, 10124, 0); return new Location(2690, 10124, 0);
} }
if (n.getId() == 96) {
return new Location(2641, 9763, 0);
}
return null; return null;
} }

View file

@ -1,7 +1,9 @@
package content.region.kandarin.quest.templeofikov package content.region.kandarin.quest.templeofikov
import content.data.LightSource
import content.data.Quests import content.data.Quests
import content.global.skill.agility.AgilityHandler import content.global.skill.agility.AgilityHandler
import content.global.skill.skillcapeperks.SkillcapePerks
import core.api.* import core.api.*
import core.game.global.action.DoorActionHandler import core.game.global.action.DoorActionHandler
import core.game.global.action.PickupHandler import core.game.global.action.PickupHandler
@ -114,6 +116,40 @@ class TempleOfIkovListeners : InteractionListener {
// https://www.youtube.com/watch?v=6ZGpJNeGLJ0 // https://www.youtube.com/watch?v=6ZGpJNeGLJ0
// sendDialogue("Hmm...bit dark down here! I'm not going to venture far!") // sendDialogue("Hmm...bit dark down here! I'm not going to venture far!")
// Ikov dungeon top stairs to either boots of lightness or the dark room
on(Scenery.STAIRS_35121, SCENERY, "Climb-down") { player, node ->
if (LightSource.hasActiveLightSource(player) || SkillcapePerks.isActive(SkillcapePerks.CONSTANT_GLOW, player)) { // has light source
teleport(player, Location.create(2641, 9763, 0))
} else { // doesn't have light source
teleport(player, Location.create(2641, 9740, 0))
sendDialogueLines(player, "Hmm...bit dark down here! I'm not going to venture far!")
}
true
}
// Ikov dungeon bottom stairs (lit) to top stairs
on(Scenery.STAIRS_96, SCENERY, "Climb-up") { player, node ->
teleport(player, Location.create(2649, 9804, 0))
}
// Ikov dungeon bottom stairs (dark) to top stairs
on(Scenery.STAIRS_33232, SCENERY, "Climb-up") { player, node ->
teleport(player, Location.create(2649, 9804, 0))
}
// don't let light extinguish or cape take off
val lightSourceProducts = LightSource.values().map { it.product.id }.toIntArray()
on(lightSourceProducts, ITEM, "drop") { player, light ->
val active = LightSource.getActiveLightSource(player).product.id
if (player.location.isInRegion(10648) && light.id == active) {
sendMessage(player, "Dropping the " + LightSource.getActiveLightSource(player).product.name.lowercase() + " would leave you without a light source.")
return@on false
}
val removed = removeItem(player, light.id)
if (removed) produceGroundItem(player, light.id)
return@on true
}
// B: Attach lever, authentic if you log out, the lever is lost, and you have to do that bridge again // B: Attach lever, authentic if you log out, the lever is lost, and you have to do that bridge again
onUseWith(SCENERY, Items.LEVER_83, Scenery.LEVER_BRACKET_86) { player, used, with -> onUseWith(SCENERY, Items.LEVER_83, Scenery.LEVER_BRACKET_86) { player, used, with ->