Added guard shouting in Jatizso

This commit is contained in:
ceikry
2021-07-08 19:00:34 -05:00
parent cd2ed29217
commit b9efc151ea
3 changed files with 119 additions and 2 deletions
@@ -21,6 +21,8 @@ public enum SpecialLadders implements LadderAchievementCheck {
INTRO_LEAVE(Location.create(2522, 4999, 0),Location.create(3230, 3240, 0)),
JATIZSO_MINE_UP(Location.create(2406,10188,0),Location.create(2397, 3811, 0)),
JATIZSO_MINE_DOWN(Location.create(2397, 3812, 0), Location.create(2405, 10188, 0)),
JATIZSO_TOWER_UP(Location.create(2373, 3800, 2),Location.create(2374, 3800, 0)),
JATIZSO_TOWER_DOWN(Location.create(2373, 3800, 0),Location.create(2374, 3800, 2)),
DRAYNOR_SEWER_SOUTHEAST_DOWN(new Location(3118, 3244, 0), new Location(3118, 9643, 0)),
DRAYNOR_SEWER_SOUTHEAST_UP(new Location(3118, 9643, 0), new Location(3118, 3243, 0)),
@@ -1,14 +1,38 @@
package rs09.game.interaction.region
import api.ContentAPI
import core.game.node.entity.player.link.audio.Audio
import core.game.system.task.Pulse
import core.game.world.map.Direction
import core.game.world.map.Location
import core.game.world.map.zone.ZoneBorders
import org.rs09.consts.NPCs
import rs09.game.camerautils.PlayerCamera
import rs09.game.interaction.InteractionListener
class JatizsoListeners : InteractionListener() {
val GATES_CLOSED = intArrayOf(21403,21405)
val NORTH_GATE_ZONE = ZoneBorders(2414,3822,2417,3825)
val WEST_GATE_ZONE = ZoneBorders(2386,3797,2390,3801)
val SOUTH_GAE_ZONE = ZoneBorders(2411,3795,2414,3799)
val BELL = 21394
val LINES = arrayOf(
arrayOf(
"YOU WOULDN'T KNOW HOW TO FIGHT A TROLL IF IT CAME UP AND BIT YER ARM OFF",
"YAK LOVERS",
"CALL THAT A TOWN? I'VE SEEN BETTER HAMLETS!",
"AND YOUR FATHER SMELLED OF WINTERBERRIES!",
"WOODEN BRIDGES ARE RUBBISH!",
"OUR KING'S BETTER THAN YOUR BURGHER!",
),
arrayOf(
"YOU WOULDN'T KNOW HOW TO SHAVE A YAK IF YOUR LIFE DEPENDED ON IT",
"MISERABLE LOSERS",
"YOUR MOTHER WAS A HAMSTER!",
"AT LEAST WE HAVE SOMETHING OTHER THAN SMELLY FISH!",
"AT LEAST WE CAN COOK!",
)
)
override fun defineListeners() {
on(GATES_CLOSED, SCENERY, "open"){player, node ->
if(NORTH_GATE_ZONE.insideBorder(player)){
@@ -33,9 +57,68 @@ class JatizsoListeners : InteractionListener() {
ContentAPI.replaceScenery(node.asScenery(), node.id + 1, -1, Direction.NORTH)
ContentAPI.replaceScenery(other.asScenery(), other.id + 1, -1, Direction.WEST)
}
ContentAPI.playAudio(player, ContentAPI.getAudio(81))
} else if(SOUTH_GAE_ZONE.insideBorder(player)){
if(node.id == GATES_CLOSED.first()){
val other = ContentAPI.getScenery(node.location.transform(-1, 0, 0)) ?: return@on true
ContentAPI.replaceScenery(node.asScenery(), node.id + 1, -1, Direction.SOUTH)
ContentAPI.replaceScenery(other.asScenery(), other.id - 1, -1, Direction.EAST)
} else {
val other = ContentAPI.getScenery(node.location.transform(1, 0, 0)) ?: return@on true
ContentAPI.replaceScenery(node.asScenery(), node.id + 1, -1, Direction.EAST)
ContentAPI.replaceScenery(other.asScenery(), other.id, -1, Direction.SOUTH)
}
}
ContentAPI.playAudio(player, ContentAPI.getAudio(81))
return@on true
}
on(NPCs.GUARD_5489, NPC, "watch-shouting"){player, node ->
ContentAPI.lock(player, 200)
ContentAPI.face(node.asNpc(), Location.create(2371, 3801, 2))
node.asNpc().isRespawn = false
ContentAPI.submitIndividualPulse(player, object : Pulse(4){
var id = node.id
var counter = 0
val other = ContentAPI.findLocalNPC(player, getOther(node.id))
override fun start() {
other?.isRespawn = false
}
override fun pulse(): Boolean {
val npc = ContentAPI.findLocalNPC(player, id) ?: return false
val index = when(id){
node.id -> 0
else -> 1
}
if(index == 1 && counter == 5) return true
ContentAPI.sendChat(npc, LINES[index][counter])
if(npc.id != node.id) counter++
id = getOther(id)
return false
}
override fun stop() {
ContentAPI.unlock(player)
other?.isRespawn = true
node.asNpc().isRespawn = true
super.stop()
}
fun getOther(npc: Int): Int{
return when(npc){
NPCs.GUARD_5489 -> NPCs.GUARD_5490
NPCs.GUARD_5490 -> NPCs.GUARD_5489
else -> NPCs.GUARD_5489
}
}
})
return@on true
}
on(BELL, SCENERY, "ring-bell"){player, _ ->
ContentAPI.playAudio(player, Audio(15))
ContentAPI.sendMessage(player, "You ring the warning bell, but everyone ignores it!")
return@on true
}
}
@@ -0,0 +1,32 @@
package rs09.game.node.entity.npc.other
import api.ContentAPI
import core.game.node.entity.npc.AbstractNPC
import core.game.world.map.Location
import core.plugin.Initializable
import org.rs09.consts.NPCs
@Initializable
class FremennikGuards : AbstractNPC {
//Constructor spaghetti because Arios I guess
constructor() : super(NPCs.GUARD_5489, null, true) {}
private constructor(id: Int, location: Location) : super(id, location) {}
override fun construct(id: Int, location: Location, vararg objects: Any?): AbstractNPC {
return FremennikGuards(id, location)
}
override fun getIds(): IntArray {
return intArrayOf(NPCs.GUARD_5489, NPCs.GUARD_5490)
}
override fun tick() {
if(this.isRespawn) {
when (id) {
NPCs.GUARD_5489 -> if (ContentAPI.getWorldTicks() % 5 == 0) ContentAPI.sendChat(this, "JATIZSO!")
NPCs.GUARD_5490 -> if (ContentAPI.getWorldTicks() % 8 == 0) ContentAPI.sendChat(this, "NEITIZNOT!")
}
}
super.tick()
}
}