Moved demon slayer cutscene trigger to its own MapArea

This commit is contained in:
Ceikry 2022-07-04 13:26:10 +00:00 committed by Ryan
parent f94fb24608
commit 7300e746b1
4 changed files with 35 additions and 3 deletions

View file

@ -177,7 +177,7 @@ public final class DemonSlayerCutscene extends CutscenePlugin {
@Override
public void register() {
register(new ZoneBorders(3222, 3364, 3234, 3375));
//register(new ZoneBorders(3222, 3364, 3234, 3375));
try {
new DarkWizardNPC().newInstance(null);
new DelrithNPC().newInstance(null);

View file

@ -751,6 +751,10 @@ fun <T> setAttribute(entity: Entity, attribute: String, value: T) {
entity.setAttribute(attribute, value)
}
fun removeAttribute(entity: Entity, attribute: String) {
entity.removeAttribute(attribute)
}
/**
* Locks the given entity for the given number of ticks
* @param entity the entity to lock

View file

@ -11,7 +11,7 @@ import core.game.world.map.zone.ZoneRestriction
* Interface that allows a class to define a map area.
* Optionally-overridable methods include [getRestrictions], [areaEnter], [areaLeave] and [entityStep]
*/
interface MapArea {
interface MapArea : ContentInterface {
var zone: MapZone
get(){
return zoneMaps[this.javaClass.simpleName + "MapArea"]!!

View file

@ -0,0 +1,28 @@
package rs09.game.content.quest.free.demonslayer
import api.*
import core.game.world.map.zone.ZoneBorders
import core.game.content.activity.ActivityManager
import core.game.node.entity.Entity
import core.game.node.entity.player.Player
import org.rs09.consts.Items
class DSCutsceneTrigger : MapArea {
override fun defineAreaBorders() : Array<ZoneBorders> {
return arrayOf(ZoneBorders(3222, 3364, 3234, 3375))
}
override fun areaEnter(entity: Entity) {
if (entity !is Player) return
val quest = entity.questRepository.getQuest("Demon Slayer")
val alreadyInCutscene = getAttribute(entity, "demon-slayer:cutscene", false)
val hasSilverlight = inInventory(entity, Items.SILVERLIGHT_2402) || inEquipment(entity, Items.SILVERLIGHT_2402)
if (quest.getStage(entity) == 30 && !alreadyInCutscene && hasSilverlight) {
ActivityManager.start(entity, "Demon Slayer Cutscene", false)
setAttribute(entity, "demon-slayer:cutscene", true)
}
}
}