mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2025-12-09 16:45:44 -07:00
Restricted random events inside KBD lair
This commit is contained in:
parent
af6d260a1e
commit
1ebbed5453
2 changed files with 39 additions and 0 deletions
|
|
@ -0,0 +1,14 @@
|
||||||
|
package content.region.wilderness.handlers
|
||||||
|
|
||||||
|
import core.api.*
|
||||||
|
import core.game.world.map.zone.ZoneBorders
|
||||||
|
import core.game.world.map.zone.ZoneRestriction
|
||||||
|
|
||||||
|
class KingBlackDragonArea : MapArea {
|
||||||
|
override fun defineAreaBorders() : Array<ZoneBorders> {
|
||||||
|
return arrayOf(ZoneBorders(2256, 4680, 2287, 4711, 0, true))
|
||||||
|
}
|
||||||
|
override fun getRestrictions() : Array<ZoneRestriction> {
|
||||||
|
return arrayOf(ZoneRestriction.RANDOM_EVENTS)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -7,6 +7,9 @@ import core.api.*
|
||||||
import core.game.system.timer.impl.AntiMacro
|
import core.game.system.timer.impl.AntiMacro
|
||||||
import core.game.world.map.Location
|
import core.game.world.map.Location
|
||||||
import core.game.world.map.zone.impl.WildernessZone
|
import core.game.world.map.zone.impl.WildernessZone
|
||||||
|
import content.region.wilderness.handlers.KingBlackDragonArea
|
||||||
|
import core.game.world.map.zone.MapZone
|
||||||
|
import core.game.world.map.zone.ZoneBuilder
|
||||||
import org.junit.jupiter.api.Assertions
|
import org.junit.jupiter.api.Assertions
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.rs09.consts.Items
|
import org.rs09.consts.Items
|
||||||
|
|
@ -132,6 +135,28 @@ class RandomEventTests {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test fun randomEventShouldNotSpawnInKingBlackDragonLair() {
|
||||||
|
TestUtils.getMockPlayer("antimacronospawninkbdlair").use { p ->
|
||||||
|
val timer = getTimer<AntiMacro>(p) ?: Assertions.fail("AntiMacro timer was null!")
|
||||||
|
TestUtils.advanceTicks(5, false)
|
||||||
|
|
||||||
|
// Manually configure KBD lair zone like ClassScanner does for MapArea instances
|
||||||
|
val kbdArea = KingBlackDragonArea()
|
||||||
|
val zone = object : MapZone(kbdArea.javaClass.simpleName + "MapArea", true, *kbdArea.getRestrictions()) {}
|
||||||
|
for(border in kbdArea.defineAreaBorders()) zone.register(border)
|
||||||
|
ZoneBuilder.configure(zone)
|
||||||
|
|
||||||
|
val kbdLocation = Location.create(2273, 4698, 0) // KBD spawn location
|
||||||
|
p.location = kbdLocation
|
||||||
|
|
||||||
|
Assertions.assertEquals(kbdLocation, p.location)
|
||||||
|
|
||||||
|
timer.nextExecution = getWorldTicks() + 5
|
||||||
|
TestUtils.advanceTicks(10, false)
|
||||||
|
Assertions.assertNull(AntiMacro.getEventNpc(p), "Random event should not spawn in KBD lair but one was found!")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//FIXME
|
//FIXME
|
||||||
//@Test fun randomEventShouldNotSpawnIfOneAlreadyActive() {
|
//@Test fun randomEventShouldNotSpawnIfOneAlreadyActive() {
|
||||||
// TestUtils.getMockPlayer("antimacronospawnifalreadyhas").use { p ->
|
// TestUtils.getMockPlayer("antimacronospawnifalreadyhas").use { p ->
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue