mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-16 03:20:19 -07:00
Moved demon slayer cutscene trigger to its own MapArea
This commit is contained in:
parent
f94fb24608
commit
7300e746b1
4 changed files with 35 additions and 3 deletions
|
|
@ -177,7 +177,7 @@ public final class DemonSlayerCutscene extends CutscenePlugin {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void register() {
|
public void register() {
|
||||||
register(new ZoneBorders(3222, 3364, 3234, 3375));
|
//register(new ZoneBorders(3222, 3364, 3234, 3375));
|
||||||
try {
|
try {
|
||||||
new DarkWizardNPC().newInstance(null);
|
new DarkWizardNPC().newInstance(null);
|
||||||
new DelrithNPC().newInstance(null);
|
new DelrithNPC().newInstance(null);
|
||||||
|
|
|
||||||
|
|
@ -751,6 +751,10 @@ fun <T> setAttribute(entity: Entity, attribute: String, value: T) {
|
||||||
entity.setAttribute(attribute, value)
|
entity.setAttribute(attribute, value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun removeAttribute(entity: Entity, attribute: String) {
|
||||||
|
entity.removeAttribute(attribute)
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Locks the given entity for the given number of ticks
|
* Locks the given entity for the given number of ticks
|
||||||
* @param entity the entity to lock
|
* @param entity the entity to lock
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@ import core.game.world.map.zone.ZoneRestriction
|
||||||
* Interface that allows a class to define a map area.
|
* Interface that allows a class to define a map area.
|
||||||
* Optionally-overridable methods include [getRestrictions], [areaEnter], [areaLeave] and [entityStep]
|
* Optionally-overridable methods include [getRestrictions], [areaEnter], [areaLeave] and [entityStep]
|
||||||
*/
|
*/
|
||||||
interface MapArea {
|
interface MapArea : ContentInterface {
|
||||||
var zone: MapZone
|
var zone: MapZone
|
||||||
get(){
|
get(){
|
||||||
return zoneMaps[this.javaClass.simpleName + "MapArea"]!!
|
return zoneMaps[this.javaClass.simpleName + "MapArea"]!!
|
||||||
|
|
@ -29,4 +29,4 @@ interface MapArea {
|
||||||
companion object {
|
companion object {
|
||||||
val zoneMaps = HashMap<String, MapZone>()
|
val zoneMaps = HashMap<String, MapZone>()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue