mirror of
https://gitlab.com/2009scape/2009scape.git
synced 2026-08-22 10:55:13 -06:00
added fan station
This commit is contained in:
parent
8e42bdf718
commit
39e6a72e8a
4 changed files with 615 additions and 343 deletions
|
|
@ -2,11 +2,10 @@ package content.region.kandarin.seers.quest.elementalworkshop2
|
|||
|
||||
import content.data.Quests
|
||||
import content.global.handlers.iface.*
|
||||
import content.region.kandarin.seers.quest.elementalworkshop2.ElementalWorkshop2.Companion.EW2Varbit
|
||||
import content.region.kandarin.seers.quest.elementalworkshop2.ElementalWorkshop2.Companion.EW2StageVarbit
|
||||
import core.game.interaction.InteractionListener
|
||||
import core.api.*
|
||||
import core.game.interaction.IntType
|
||||
import core.game.interaction.QueueStrength
|
||||
import core.game.node.entity.player.Player
|
||||
import org.rs09.consts.Items
|
||||
|
||||
|
|
@ -215,7 +214,7 @@ class BeatenBook : InteractionListener {
|
|||
BookInterface.openBook(player, BookInterface.FANCY_BOOK_3_49, ::display)
|
||||
|
||||
setQuestStage(player, Quests.ELEMENTAL_WORKSHOP_II, 2)
|
||||
setVarbit(player, EW2Varbit, 2, true)
|
||||
setVarbit(player, EW2StageVarbit, 2, true)
|
||||
// storeBookInHouse(player, node) // todo uncomment this when poh costume room is in
|
||||
} else {
|
||||
// storeBookInHouse(player, node) // todo uncomment this when poh costume room is in
|
||||
|
|
|
|||
|
|
@ -1,14 +1,20 @@
|
|||
package content.region.kandarin.seers.quest.elementalworkshop2
|
||||
|
||||
import content.data.Quests
|
||||
import content.region.kandarin.seers.quest.elementalworkshop2.ElementalWorkshop2.Companion.EW2CartLever
|
||||
import content.region.kandarin.seers.quest.elementalworkshop2.ElementalWorkshop2.Companion.EW2CranePos
|
||||
import content.region.kandarin.seers.quest.elementalworkshop2.ElementalWorkshop2.Companion.EW2CraneState
|
||||
import content.region.kandarin.seers.quest.elementalworkshop2.ElementalWorkshop2.Companion.EW2CartLeverVarbit
|
||||
import content.region.kandarin.seers.quest.elementalworkshop2.ElementalWorkshop2.Companion.EW2CogVarbit1
|
||||
import content.region.kandarin.seers.quest.elementalworkshop2.ElementalWorkshop2.Companion.EW2CogVarbit2
|
||||
import content.region.kandarin.seers.quest.elementalworkshop2.ElementalWorkshop2.Companion.EW2CogVarbit3
|
||||
import content.region.kandarin.seers.quest.elementalworkshop2.ElementalWorkshop2.Companion.EW2CranePosVarbit
|
||||
import content.region.kandarin.seers.quest.elementalworkshop2.ElementalWorkshop2.Companion.EW2CraneStateVarbit
|
||||
import content.region.kandarin.seers.quest.elementalworkshop2.ElementalWorkshop2.Companion.EW2DoorLeverVarbit
|
||||
import content.region.kandarin.seers.quest.elementalworkshop2.ElementalWorkshop2.Companion.EW2FanLeverVarbit
|
||||
import content.region.kandarin.seers.quest.elementalworkshop2.ElementalWorkshop2.Companion.EW2HatchVarbit
|
||||
import content.region.kandarin.seers.quest.elementalworkshop2.ElementalWorkshop2.Companion.EW2JigCart
|
||||
import content.region.kandarin.seers.quest.elementalworkshop2.ElementalWorkshop2.Companion.EW2JigCartVarbit
|
||||
import content.region.kandarin.seers.quest.elementalworkshop2.ElementalWorkshop2.Companion.EW2MachineryVarbit
|
||||
import content.region.kandarin.seers.quest.elementalworkshop2.ElementalWorkshop2.Companion.EW2PipeVarbit
|
||||
import content.region.kandarin.seers.quest.elementalworkshop2.ElementalWorkshop2.Companion.EW2Varbit
|
||||
import content.region.kandarin.seers.quest.elementalworkshop2.ElementalWorkshop2.Companion.EW2StageVarbit
|
||||
import content.region.kandarin.seers.quest.elementalworkshop2.ElementalWorkshop2.Companion.EW2TankDoorVarbit
|
||||
import core.api.*
|
||||
import core.game.interaction.IntType
|
||||
import core.game.interaction.InteractionListener
|
||||
|
|
@ -22,22 +28,40 @@ import org.rs09.consts.*
|
|||
class EW2Listeners : InteractionListener {
|
||||
|
||||
/**
|
||||
* Overall there are 4 stations down here:
|
||||
* Quest structure and testing notes:
|
||||
*
|
||||
* 1- crane - takes ele bar. outputs hot ele bar
|
||||
* 2- anvil - takes hot ele bar. outputs smashed hot bar
|
||||
* 3- water - takes smashed hot bar. outputs smashed cooled bar
|
||||
* 4- fan - takes smashed cooled bar. outputs primed bar
|
||||
* I've divided the listeners into the below sections for easier parsing. Overall, the main EW2 workshop floor is divided
|
||||
* into 4 stations. A jig cart rolls between them. Each station only accepts one specific state of the jig cart, and only
|
||||
* progresses the jig cart by one state.
|
||||
*
|
||||
* each station only accepts one specific state of the jig cart, and only progresses the jig cart by one state.
|
||||
* Each station must be checked that it's in the correct state to allow the cart to travel around.
|
||||
*
|
||||
* Each station must only progress the cart state if it's the correct step, and otherwise fail gracefully.
|
||||
*
|
||||
* Start
|
||||
* 0 - Listeners for the dig site books, finding keys, stairs, jig cart, etc.
|
||||
*
|
||||
* EW2 main floor
|
||||
* 1 - crane - takes ele bar. outputs hot ele bar
|
||||
* 2 - anvil - takes hot ele bar. outputs smashed hot bar
|
||||
* 3 - water - takes smashed hot bar. outputs smashed cooled bar
|
||||
* 4 - fan - takes smashed cooled bar. outputs primed bar
|
||||
*
|
||||
* EW2 basement
|
||||
* 5 - mind imbuement station. Takes primed bar and outputs mind bar.
|
||||
*
|
||||
*/
|
||||
|
||||
// todo finish organizing the listeners under their stages
|
||||
|
||||
companion object {
|
||||
|
||||
// various states the crane can be in. they are a pattern, so the logic to flip and lower can be generalized.
|
||||
/**
|
||||
* This companion object stores helper functions to save and recall workshop state.
|
||||
* All the machinery states are stored in varbits and are updated in various listeners,
|
||||
* then synced in the various sync() functions. The whole workshop is synced using the
|
||||
* EW2Zone enter trigger, so when the player comes back, the workshop is where they left it.
|
||||
*/
|
||||
|
||||
// various states the crane can be in.
|
||||
val craneStates = intArrayOf(
|
||||
// Varbit 2644 = 0: Broken
|
||||
Scenery.OLD_CRANE_18638, // broken crane facing south, claw down
|
||||
|
|
@ -81,42 +105,50 @@ class EW2Listeners : InteractionListener {
|
|||
Location.create(1961, 5155, 2) // east (fans)
|
||||
)
|
||||
|
||||
// function to find my crane because it exists at some corner instead of the center.
|
||||
fun findCraneInArea(center: Location): core.game.node.scenery.Scenery? {
|
||||
// Search an area around the center
|
||||
for (x in -2..2) {
|
||||
for (y in -2..2) {
|
||||
val checkLoc = center.transform(x, y, 0)
|
||||
for (id in craneStates) {
|
||||
val found = RegionManager.getObject(checkLoc.z, checkLoc.x, checkLoc.y, id)
|
||||
if (found != null) return found
|
||||
}
|
||||
}
|
||||
}
|
||||
return null
|
||||
}
|
||||
val tankDoorStates = intArrayOf(
|
||||
Scenery.DOOR_18651, // door closed
|
||||
Scenery.DOOR_18652,
|
||||
Scenery.DOOR_18653,
|
||||
Scenery.DOOR_18654,
|
||||
Scenery.DOOR_18655,
|
||||
Scenery.DOOR_18656,
|
||||
Scenery.DOOR_18657,
|
||||
Scenery.DOOR_18658,
|
||||
Scenery.DOOR_18659
|
||||
)
|
||||
|
||||
// position the crane based on varbit states
|
||||
// todo it would be nice to animate this crane
|
||||
fun syncCrane(player: Player) {
|
||||
val mat = getVarbit(player, EW2CraneState)
|
||||
val pos = getVarbit(player, EW2CranePos)
|
||||
val mat = getVarbit(player, EW2CraneStateVarbit)
|
||||
val pos = getVarbit(player, EW2CranePosVarbit)
|
||||
|
||||
val index = (mat * 4) + pos
|
||||
val newId = craneStates[index]
|
||||
val center = Location.create(1954, 5145, 2)
|
||||
|
||||
val craneLoc = Location.create(1954, 5145, 2)
|
||||
val currentCrane = findCraneInArea(craneLoc)
|
||||
for (x in -2..2) {
|
||||
for (y in -2..2) {
|
||||
val checkLoc = center.transform(x, y, 0)
|
||||
|
||||
if (currentCrane != null) {
|
||||
// todo it would be nice to animate this crane
|
||||
replaceScenery(currentCrane, newId, -1)
|
||||
// look for the object at this specific tile
|
||||
val currentObject = RegionManager.getObject(checkLoc.z, checkLoc.x, checkLoc.y) ?: continue
|
||||
|
||||
// check if the object at this tile is a crane
|
||||
if (craneStates.contains(currentObject.id)) {
|
||||
if (currentObject.id != newId) {
|
||||
replaceScenery(currentObject, newId, -1)
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// update the jig cart based on varbit status
|
||||
fun syncCart(player: Player) {
|
||||
val cartState = getVarbit(player, EW2JigCart)
|
||||
val cartPosIndex = getVarbit(player, EW2CartLever)
|
||||
val cartState = getVarbit(player, EW2JigCartVarbit)
|
||||
val cartPosIndex = getVarbit(player, EW2CartLeverVarbit)
|
||||
|
||||
val targetId = jigCartStates[cartState]
|
||||
val targetLocation = jigCartLocations[cartPosIndex]
|
||||
|
|
@ -134,18 +166,70 @@ class EW2Listeners : InteractionListener {
|
|||
}
|
||||
// update location
|
||||
if (existingCart.location != targetLocation) {
|
||||
// todo it would be nice if the cart moved instead of teleporting. try and make the tracks walkable?
|
||||
existingCart.teleport(targetLocation)
|
||||
}
|
||||
} else {
|
||||
// Spawn if missing
|
||||
// Spawn if missing (like if this is the quest start)
|
||||
val newCart = NPC(targetId, targetLocation)
|
||||
newCart.init()
|
||||
}
|
||||
}
|
||||
|
||||
// values for the cogs
|
||||
val cogRange = (Scenery.COG_18667..Scenery.COG_18684).toList().toIntArray() // 18 different cogs. That is enough to give each cog a static/fwd spin/rev spin animation.
|
||||
|
||||
val smallCogs = intArrayOf(Scenery.COG_18673, Scenery.COG_18667, Scenery.COG_18670) // pin 1, pin 2, pin 3
|
||||
val medCogs = intArrayOf(Scenery.COG_18674, Scenery.COG_18668, Scenery.COG_18671) // pin 1, pin 2, pin 3
|
||||
val largeCogs = intArrayOf(Scenery.COG_18675, Scenery.COG_18669, Scenery.COG_18672) // pin 1, pin 2, pin 3
|
||||
|
||||
// offset by 9 from the static cogs. this is a guess for now (see below)
|
||||
val smallMovingCogs = intArrayOf(Scenery.COG_18682, Scenery.COG_18676, Scenery.COG_18679)
|
||||
val medMovingCogs = intArrayOf(Scenery.COG_18683, Scenery.COG_18677, Scenery.COG_18680)
|
||||
val largeMovingCogs = intArrayOf(Scenery.COG_18684, Scenery.COG_18678, Scenery.COG_18681)
|
||||
|
||||
// todo it'd be nice to have a function that swapped the cog scenery for an animated version.
|
||||
// function to swap scenery values of the cogs based on the varbit settings. this makes them appear to spin.
|
||||
fun syncCogs(player: Player) {
|
||||
|
||||
}
|
||||
|
||||
// syncs the tank door based on state of varbit 2653
|
||||
fun syncTankDoor(player: Player) {
|
||||
val doorState = getVarbit(player, EW2TankDoorVarbit)
|
||||
|
||||
val targetId = tankDoorStates[doorState]
|
||||
val center = Location.create(1953, 5164, 2)
|
||||
|
||||
// Scan the 5x5 area around the tank door location
|
||||
for (x in -2..2) {
|
||||
for (y in -2..2) {
|
||||
val checkLoc = center.transform(x, y, 0)
|
||||
val currentObject = RegionManager.getObject(checkLoc.z, checkLoc.x, checkLoc.y) ?: continue
|
||||
|
||||
sendMessage(player, "$currentObject")
|
||||
sendMessage(player,"$doorState")
|
||||
|
||||
// Check if the object is any of the possible door states
|
||||
if (tankDoorStates.contains(currentObject.id)) {
|
||||
if (currentObject.id != targetId) {
|
||||
replaceScenery(currentObject, targetId, -1)
|
||||
}
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun defineListeners() {
|
||||
|
||||
/**------------------------
|
||||
* SECTION 0 - START
|
||||
** ------------------------
|
||||
*/
|
||||
|
||||
// Bookcase at digsite where you start quest.
|
||||
on(Scenery.BOOKCASE_17382, IntType.SCENERY, "search") { player, _ ->
|
||||
if (isQuestComplete(player, Quests.ELEMENTAL_WORKSHOP_I) &&
|
||||
|
|
@ -159,7 +243,7 @@ class EW2Listeners : InteractionListener {
|
|||
|
||||
if(getQuestStage(player, Quests.ELEMENTAL_WORKSHOP_II) == 0) {
|
||||
setQuestStage(player, Quests.ELEMENTAL_WORKSHOP_II, 1)
|
||||
setVarbit(player, EW2Varbit, 1, true)
|
||||
setVarbit(player, EW2StageVarbit, 1, true)
|
||||
}
|
||||
} else {
|
||||
sendMessage(player, "You search the books...")
|
||||
|
|
@ -183,7 +267,7 @@ class EW2Listeners : InteractionListener {
|
|||
|
||||
if(getQuestStage(player, Quests.ELEMENTAL_WORKSHOP_II) == 2) {
|
||||
setQuestStage(player, Quests.ELEMENTAL_WORKSHOP_II, 3)
|
||||
setVarbit(player, EW2Varbit, 3, true)
|
||||
setVarbit(player, EW2StageVarbit, 3, true)
|
||||
}
|
||||
if(getVarbit(player, EW2MachineryVarbit) == 0)
|
||||
setVarbit(player, EW2MachineryVarbit, 1, true)
|
||||
|
|
@ -198,7 +282,7 @@ class EW2Listeners : InteractionListener {
|
|||
}
|
||||
if(getQuestStage(player, Quests.ELEMENTAL_WORKSHOP_II) == 3) {
|
||||
setQuestStage(player, Quests.ELEMENTAL_WORKSHOP_II, 4)
|
||||
setVarbit(player, EW2Varbit, 4)
|
||||
setVarbit(player, EW2StageVarbit, 4)
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
|
|
@ -217,7 +301,7 @@ class EW2Listeners : InteractionListener {
|
|||
|
||||
if(getQuestStage(player, Quests.ELEMENTAL_WORKSHOP_II) == 4) {
|
||||
setQuestStage(player, Quests.ELEMENTAL_WORKSHOP_II, 5)
|
||||
setVarbit(player, EW2Varbit, 5)
|
||||
setVarbit(player, EW2StageVarbit, 5)
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
|
|
@ -243,6 +327,324 @@ class EW2Listeners : InteractionListener {
|
|||
return@on true
|
||||
}
|
||||
|
||||
// schematic crate
|
||||
on(Scenery.SCHEMATIC_CRATE_18711, IntType.SCENERY, "take-from") { player, _ ->
|
||||
sendDialogueOptions(player, "There are two schematics here...", "Crane schematic", "Lever schematic")
|
||||
addDialogueAction(player) { _, buttonId ->
|
||||
when (buttonId) {
|
||||
2 -> {
|
||||
if(!inInventory(player, Items.CRANE_SCHEMATIC_9718)){
|
||||
addItemOrDrop(player, Items.CRANE_SCHEMATIC_9718)
|
||||
sendItemDialogue(player, Items.CRANE_SCHEMATIC_9718, "You take a copy of the schematic drawing.")
|
||||
}
|
||||
else sendDialogue(player, "You already have this schematic.")
|
||||
}
|
||||
3 -> {
|
||||
if(!inInventory(player, Items.LEVER_SCHEMATIC_9719)){
|
||||
addItemOrDrop(player, Items.LEVER_SCHEMATIC_9719)
|
||||
sendItemDialogue(player, Items.LEVER_SCHEMATIC_9719, "You take a copy of the schematic drawing.")
|
||||
}
|
||||
else sendDialogue(player, "You already have this schematic.")
|
||||
}
|
||||
}
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
|
||||
// lever that moves the cart between stations
|
||||
on(Scenery.LEVER_18620, IntType.SCENERY, "pull") { player, _ ->
|
||||
val currentPos = getVarbit(player, EW2CartLeverVarbit) // cart moving lever. 0 = start (south), 1 = west, 2 = north, 3 = east
|
||||
val cranePos = getVarbit(player, EW2CranePosVarbit) // 2 if crane is down on north side
|
||||
val doorPos = getVarbit(player, EW2DoorLeverVarbit) // 1 if door is open
|
||||
val fanPos = getVarbit(player, EW2FanLeverVarbit) // 1 if the fan is on
|
||||
|
||||
// crane must be up
|
||||
if (currentPos == 0 && cranePos == 2) {
|
||||
sendMessage(player, "You cannot do that while the claw is down.")
|
||||
return@on true
|
||||
}
|
||||
// door must be closed
|
||||
if (currentPos == 2 && doorPos == 1) {
|
||||
sendMessage(player, "You cannot do that while the door is open.")
|
||||
return@on true
|
||||
}
|
||||
// todo check the corkscrew because i think that'll shift the cart off the track
|
||||
// door must be closed
|
||||
if (currentPos == 3 && fanPos == 1) {
|
||||
sendMessage(player, "You cannot do that while the fan is on.")
|
||||
return@on true
|
||||
}
|
||||
|
||||
// positions cycles 0 -> 1 -> 2 -> 3 -> 0 etc.
|
||||
val nextPos = (currentPos + 1) % 4
|
||||
|
||||
animate(player, Animations.HUMAN_PULL_LEVER_4909)
|
||||
setVarbit(player, EW2CartLeverVarbit, nextPos, true)
|
||||
syncCart(player)
|
||||
|
||||
return@on true
|
||||
}
|
||||
|
||||
// take item from the jig cart
|
||||
on(jigCartStates, IntType.NPC, "take-from") { player, node ->
|
||||
when(node.id) {
|
||||
4914 -> {
|
||||
addItemOrDrop(player, Items.ELEMENTAL_METAL_2893)
|
||||
sendItemDialogue(player, Items.ELEMENTAL_METAL_2893, "You take the elemental metal.")
|
||||
animate(player, 537)
|
||||
setVarbit(player, EW2JigCartVarbit, 0, true)
|
||||
}
|
||||
4915 -> {
|
||||
sendMessage(player, "The bar is too hot to touch.")
|
||||
}
|
||||
4918 -> {
|
||||
addItemOrDrop(player, Items.PRIMED_BAR_9727)
|
||||
sendItemDialogue(player, Items.PRIMED_BAR_9727, "You take the primed bar.")
|
||||
animate(player, 537)
|
||||
setVarbit(player, EW2JigCartVarbit, 0, true)
|
||||
}
|
||||
}
|
||||
syncCart(player)
|
||||
return@on true
|
||||
}
|
||||
|
||||
// put bar on the jig cart
|
||||
onUseWith(IntType.NPC, intArrayOf(Items.ELEMENTAL_METAL_2893), NPCs.JIG_CART_4913) { player, used, _ ->
|
||||
val cranePos = getVarbit(player, EW2CranePosVarbit)
|
||||
|
||||
// if crane is south down, it's blocking the cart.
|
||||
if (cranePos == 2) {
|
||||
sendMessage(player, "You cannot place that while the claw is down.")
|
||||
return@onUseWith true
|
||||
}
|
||||
|
||||
setVarbit(player, EW2JigCartVarbit, 1, true)
|
||||
animate(player, 537)
|
||||
syncCart(player)
|
||||
removeItem(player, used)
|
||||
return@onUseWith true
|
||||
}
|
||||
|
||||
/**------------------------
|
||||
* SECTION 1 - THE CRANE
|
||||
** ------------------------
|
||||
*/
|
||||
// requires the elemental claw to be smithed and attached to the crane
|
||||
|
||||
// crane schematic
|
||||
on(Items.CRANE_SCHEMATIC_9718, IntType.ITEM, "read") { player, _ ->
|
||||
sendDialogue(player, "The schematic drawing details the construction and maintenance of a mechanical arm. One of the sections you notice is an explanation of how to make an elemental claw.")
|
||||
return@on true
|
||||
}
|
||||
|
||||
// lever schematic (what lever is this even for?)
|
||||
on(Items.LEVER_SCHEMATIC_9719, IntType.ITEM, "read") { player, _ ->
|
||||
openInterface(player, 466)
|
||||
return@on true
|
||||
}
|
||||
|
||||
// fix crane
|
||||
onUseWith(IntType.SCENERY, Items.CRANE_CLAW_9720, Scenery.OLD_CRANE_18636) { player, used, with ->
|
||||
// check if already repaired
|
||||
if(getVarbit(player, EW2CraneStateVarbit) != 0) {
|
||||
sendMessage(player, "The crane is already repaired.")
|
||||
return@onUseWith true
|
||||
}
|
||||
sendItemDialogue(player, used, "You replace the broken claw.")
|
||||
removeItem(player, used)
|
||||
|
||||
setVarbit(player, EW2CraneStateVarbit, 1, true)
|
||||
syncCrane(player)
|
||||
return@onUseWith true
|
||||
}
|
||||
|
||||
// west lever by crane. moves crane up and down.
|
||||
on(Scenery.AN_OLD_LEVER_18622, IntType.SCENERY, "pull") { player, _ ->
|
||||
val currentPos = getVarbit(player, EW2CranePosVarbit)
|
||||
val nextPos = currentPos xor 1
|
||||
val craneMat = getVarbit(player, EW2CraneStateVarbit) // Crane State. 0 = broken, 1 = fixed/empty, 2 = ele bar, 3 = hot bar.
|
||||
val cartState = getVarbit(player, EW2JigCartVarbit) // Jig Cart state. 0 = Empty, 1 = ele bar, 2 = hot bar, 3 = smashed hot, 4 = smashed cooled, 5 = primed
|
||||
|
||||
// todo make sure the crane doesn't pick up other bars
|
||||
// facing north: pick up and drop off bar
|
||||
if (currentPos == 3 && nextPos == 2) {
|
||||
if (craneMat == 1 && (cartState == 1 || cartState == 2)) {
|
||||
// pick up
|
||||
setVarbit(player, EW2CraneStateVarbit, cartState + 1)
|
||||
setVarbit(player, EW2JigCartVarbit, 0)
|
||||
sendMessage(player, "The crane claw picks up the bar from the cart.")
|
||||
syncCart(player)
|
||||
} else if ((craneMat == 2 || craneMat == 3) && cartState == 0) {
|
||||
// drop off
|
||||
setVarbit(player, EW2JigCartVarbit, craneMat - 1)
|
||||
setVarbit(player, EW2CraneStateVarbit, 1)
|
||||
sendMessage(player, "You lower the bar onto the jig cart.")
|
||||
syncCart(player)
|
||||
}
|
||||
}
|
||||
|
||||
// facing south: heat bar
|
||||
if (currentPos == 1 && nextPos == 0) {
|
||||
if (craneMat == 2) {
|
||||
// if holding elemental bar, transform into hot bar
|
||||
setVarbit(player, EW2CraneStateVarbit, 3)
|
||||
playAudio(player, Sounds.EW2_CRANE_LOWER_3169)
|
||||
}
|
||||
}
|
||||
setVarbit(player, EW2CranePosVarbit, nextPos, true)
|
||||
animate(player, Animations.HUMAN_PULL_LEVER_4909)
|
||||
syncCrane(player)
|
||||
return@on true
|
||||
}
|
||||
|
||||
// east lever by crane. rotates crane north and south
|
||||
on(Scenery.AN_OLD_LEVER_18621, IntType.SCENERY, "pull") { player, _ ->
|
||||
val currentPos = getVarbit(player,EW2CranePosVarbit)
|
||||
|
||||
// crane must be up to rotate
|
||||
if (currentPos == 0 || currentPos == 2) {
|
||||
sendMessage(player, "The arm cannot be rotated while the claw is down.")
|
||||
return@on true
|
||||
}
|
||||
|
||||
val nextPos = currentPos xor 2
|
||||
|
||||
setVarbit(player, EW2CranePosVarbit, nextPos, true)
|
||||
animate(player, Animations.HUMAN_PULL_LEVER_4909)
|
||||
syncCrane(player)
|
||||
return@on true
|
||||
}
|
||||
|
||||
/**------------------------
|
||||
* SECTION 2 - THE ANVIL
|
||||
** ------------------------
|
||||
*/
|
||||
// requires the junction box interface to be fixed
|
||||
|
||||
// opens the junction box
|
||||
on(Scenery.JUNCTION_BOX_18641, IntType.SCENERY, "open") { player, _ ->
|
||||
openInterface(player, Components.JUNCTION_BOX_262)
|
||||
return@on true
|
||||
}
|
||||
|
||||
// west lever, checks junction box status
|
||||
on(Scenery.AN_OLD_LEVER_18640, IntType.SCENERY, "pull") { player, _ ->
|
||||
|
||||
if (JunctionBoxInterface.isSolutionCorrect(player)) {
|
||||
val cartState = getVarbit(player, EW2JigCartVarbit) // Jig Cart state. 0 = Empty, 1 = ele bar, 2 = hot bar, 3 = smashed hot, 4 = smashed cooled, 5 = primed
|
||||
val cartPos = getVarbit(player, EW2CartLeverVarbit) // cart moving lever. 0 = start (south), 1 = west, 2 = north, 3 = east
|
||||
|
||||
// check if cart is here
|
||||
if (cartPos == 1) {
|
||||
when (cartState) {
|
||||
0 -> { // empty
|
||||
sendDialogue(player, "You pull the lever and the press operates, but there is nothing on the cart to flatten.")
|
||||
}
|
||||
// todo animate the hammer smash
|
||||
1 -> { // ele bar
|
||||
setVarbit(player, EW2JigCartVarbit, 4)
|
||||
// "hardy" is the real word used. I thought it was a typo for 'hammer' but it's not. https://en.wikipedia.org/wiki/Hardy_tool
|
||||
sendDialogue(player, "You pull the lever and the press responds. The hardy comes down, hitting the elemental bar. The bar is not hot enough to flatten.")
|
||||
syncCart(player)
|
||||
}
|
||||
2 -> { // hot ele bar
|
||||
setVarbit(player, EW2JigCartVarbit, 3)
|
||||
// "hardy" is correct. see above.
|
||||
sendDialogue(player, "You pull the lever and the press responds. The hardy comes down, hitting the elemental bar. The bar has been flattened.")
|
||||
syncCart(player)
|
||||
}
|
||||
else -> { // smashed hot, smashed cooled, or primed
|
||||
sendDialogue(player, "You pull the lever and the press responds. The hardy comes down, hitting the elemental bar. The bar is already flattened.")
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// cart in wrong position
|
||||
sendDialogue(player, "You pull the lever and the press operates, but the jig cart is not underneath it.")
|
||||
}
|
||||
} else {
|
||||
// The junction box is not configured correctly
|
||||
sendDialogue(player, "You pull the lever but nothing happens.")
|
||||
}
|
||||
|
||||
return@on true
|
||||
}
|
||||
|
||||
/**------------------------
|
||||
* SECTION 3 - WATER
|
||||
** ------------------------
|
||||
*/
|
||||
// requires the pipe to be replaced
|
||||
|
||||
// pipe crate
|
||||
on(Scenery.CRATE_18619, IntType.SCENERY, "search") { player, _ ->
|
||||
if (!inInventory(player, Items.PIPE_9723)) {
|
||||
addItemOrDrop(player, Items.PIPE_9723)
|
||||
sendMessage(player, "You find a pipe.")
|
||||
} else {
|
||||
sendMessage(player, "It's empty.")
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
|
||||
// fix the pipe
|
||||
onUseWith(IntType.SCENERY, Items.PIPE_9723, Scenery.PIPING_18650) { player, item, _ ->
|
||||
animate(player, 537)
|
||||
sendItemDialogue(player, item, "You replace the section of broken pipe.")
|
||||
playAudio(player, Sounds.EW2_PLACE_PIPE_3179)
|
||||
setVarbit(player, EW2PipeVarbit, 1, true)
|
||||
removeItem(player, item)
|
||||
return@onUseWith true
|
||||
}
|
||||
|
||||
// todo north lever
|
||||
// north lever that opens and closes the door
|
||||
on(Scenery.AN_OLD_LEVER_18648, IntType.SCENERY, "pull") { player, _ ->
|
||||
|
||||
val currentState = getVarbit(player, EW2TankDoorVarbit)
|
||||
|
||||
// Increment from 0-7, or reset to 0 if at 8
|
||||
val nextState = if (currentState < 8) currentState + 1 else 0
|
||||
|
||||
setVarbit(player, EW2TankDoorVarbit, nextState, true)
|
||||
syncTankDoor(player)
|
||||
|
||||
return@on true
|
||||
}
|
||||
|
||||
// todo corkscrew lever
|
||||
// corkscrew lever that grabs and ungrabs the cart as long as the door is open
|
||||
on(Scenery.CORKSCREW_LEVER_18649, IntType.SCENERY, "turn") { player, _ ->
|
||||
|
||||
return@on true
|
||||
}
|
||||
|
||||
// todo west water valve
|
||||
// west water valve fills the chamber if the door is closed "you open the valve" "you close the valve" make sure it's closed or the chamber will fill up again
|
||||
// changes cart state into flattened mind bar
|
||||
on(Scenery.WATER_VALVE_18646, IntType.SCENERY, "turn") { player, _ ->
|
||||
|
||||
return@on true
|
||||
}
|
||||
|
||||
// todo east water valve
|
||||
// east water valve drains the tank if it is full "you open the valve"
|
||||
on(Scenery.WATER_VALVE_18647, IntType.SCENERY, "turn") { player, _ ->
|
||||
|
||||
return@on true
|
||||
}
|
||||
|
||||
/**
|
||||
* Scenery.WATER_TANK_18660
|
||||
* Scenery.WATER_TANK_18661
|
||||
*/
|
||||
|
||||
|
||||
/**------------------------
|
||||
* SECTION 4 - FAN
|
||||
** ------------------------
|
||||
*/
|
||||
// requires the cogs to be placed
|
||||
|
||||
// small cog crate
|
||||
on(Scenery.CRATE_18618, IntType.SCENERY, "search") { player, _ ->
|
||||
if (!inInventory(player, Items.SMALL_COG_9726)) {
|
||||
|
|
@ -276,290 +678,165 @@ class EW2Listeners : InteractionListener {
|
|||
return@on true
|
||||
}
|
||||
|
||||
// pipe crate
|
||||
on(Scenery.CRATE_18619, IntType.SCENERY, "search") { player, _ ->
|
||||
if (!inInventory(player, Items.PIPE_9723)) {
|
||||
addItemOrDrop(player, Items.PIPE_9723)
|
||||
sendMessage(player, "You find a pipe.")
|
||||
} else {
|
||||
sendMessage(player, "It's empty.")
|
||||
// taking the cogs from the pins
|
||||
on(cogRange, IntType.SCENERY, "take") { player, node ->
|
||||
// determine what to take
|
||||
val cogToGive = when {
|
||||
smallCogs.contains(node.id) -> Items.SMALL_COG_9726
|
||||
medCogs.contains(node.id) -> Items.MEDIUM_COG_9725
|
||||
largeCogs.contains(node.id) -> Items.LARGE_COG_9724
|
||||
else -> -1
|
||||
}
|
||||
|
||||
if (cogToGive != -1) {
|
||||
// determine which varbit to reset
|
||||
// Pin 1 uses: 18673, 18674, 18675
|
||||
// Pin 2 uses: 18667, 18668, 18669
|
||||
// Pin 3 uses: 18670, 18671, 18672
|
||||
when (node.id) {
|
||||
18673, 18674, 18675 -> setVarbit(player, EW2CogVarbit1, 0, true)
|
||||
18667, 18668, 18669 -> setVarbit(player, EW2CogVarbit2, 0, true)
|
||||
18670, 18671, 18672 -> setVarbit(player, EW2CogVarbit3, 0, true)
|
||||
}
|
||||
|
||||
addItemOrDrop(player, cogToGive)
|
||||
animate(player, 537)
|
||||
sendMessage(player, "You remove the cog from the shaft.")
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
|
||||
// schematic crate
|
||||
on(Scenery.SCHEMATIC_CRATE_18711, IntType.SCENERY, "take-from") { player, _ ->
|
||||
sendDialogueOptions(player, "There are two schematics here...", "Crane schematic", "Lever schematic")
|
||||
addDialogueAction(player) { _, buttonId ->
|
||||
when (buttonId) {
|
||||
2 -> {
|
||||
if(!inInventory(player, Items.CRANE_SCHEMATIC_9718)){
|
||||
addItemOrDrop(player, Items.CRANE_SCHEMATIC_9718)
|
||||
sendItemDialogue(player, Items.CRANE_SCHEMATIC_9718, "You take a copy of the schematic drawing.")
|
||||
}
|
||||
else sendDialogue(player, "You already have this schematic.")
|
||||
}
|
||||
3 -> {
|
||||
if(!inInventory(player, Items.LEVER_SCHEMATIC_9719)){
|
||||
addItemOrDrop(player, Items.LEVER_SCHEMATIC_9719)
|
||||
sendItemDialogue(player, Items.LEVER_SCHEMATIC_9719, "You take a copy of the schematic drawing.")
|
||||
}
|
||||
else sendDialogue(player, "You already have this schematic.")
|
||||
}
|
||||
// use cog with pin 1
|
||||
// pin 1: 2655: val 0 is scenery 18665 (pin). val 1 is scenery 18673 (small cog). val 2 is scenery 18674 (med cog). val 3 is scenery 18675 (large cog).
|
||||
onUseWith(IntType.SCENERY, intArrayOf(Items.SMALL_COG_9726, Items.MEDIUM_COG_9725, Items.LARGE_COG_9724), Scenery.PIN_18665) { player, item, _ ->
|
||||
when(item.id) {
|
||||
Items.SMALL_COG_9726 -> {
|
||||
setVarbit(player, EW2CogVarbit1, 1, true)
|
||||
sendItemDialogue(player, item, "You put the small cog onto the shaft.")
|
||||
animate(player, 537)
|
||||
removeItem(player, item)
|
||||
}
|
||||
Items.MEDIUM_COG_9725 -> {
|
||||
setVarbit(player, EW2CogVarbit1, 2, true)
|
||||
sendItemDialogue(player, item, "You put the medium cog onto the shaft.")
|
||||
animate(player, 537)
|
||||
removeItem(player, item)
|
||||
}
|
||||
Items.LARGE_COG_9724 -> {
|
||||
setVarbit(player, EW2CogVarbit1, 3, true)
|
||||
sendItemDialogue(player, item, "You put the large cog onto the shaft.")
|
||||
animate(player, 537)
|
||||
removeItem(player, item)
|
||||
}
|
||||
}
|
||||
return@on true
|
||||
return@onUseWith true
|
||||
}
|
||||
|
||||
// crane schematic
|
||||
on(Items.CRANE_SCHEMATIC_9718, IntType.ITEM, "read") { player, _ ->
|
||||
sendDialogue(player, "The schematic drawing details the construction and maintenance of a mechanical arm. One of the sections you notice is an explanation of how to make an elemental claw.")
|
||||
return@on true
|
||||
}
|
||||
|
||||
// lever schematic
|
||||
on(Items.LEVER_SCHEMATIC_9719, IntType.ITEM, "read") { player, _ ->
|
||||
openInterface(player, 466)
|
||||
return@on true
|
||||
}
|
||||
|
||||
/**------------------------
|
||||
* STATION 1 - THE CRANE
|
||||
** ------------------------
|
||||
*/
|
||||
// requires the elemental claw to be smithed and attached to the crane
|
||||
|
||||
// west lever by crane. moves crane up and down.
|
||||
on(Scenery.AN_OLD_LEVER_18622, IntType.SCENERY, "pull") { player, _ ->
|
||||
val currentPos = getVarbit(player, EW2CranePos)
|
||||
val nextPos = currentPos xor 1
|
||||
val craneMat = getVarbit(player, EW2CraneState)
|
||||
val cartState = getVarbit(player, EW2JigCart)
|
||||
|
||||
// facing north: pick up and drop off bar
|
||||
if (currentPos == 3 && nextPos == 2) { // Moving from North-Up to North-Down
|
||||
if (craneMat == 1 && (cartState == 1 || cartState == 2)) {
|
||||
// pick up
|
||||
setVarbit(player, EW2CraneState, cartState + 1)
|
||||
setVarbit(player, EW2JigCart, 0)
|
||||
sendMessage(player, "The crane claw picks up the bar from the cart.")
|
||||
syncCart(player)
|
||||
} else if ((craneMat == 2 || craneMat == 3) && cartState == 0) {
|
||||
// drop off
|
||||
setVarbit(player, EW2JigCart, craneMat - 1)
|
||||
setVarbit(player, EW2CraneState, 1)
|
||||
sendMessage(player, "You lower the bar onto the jig cart.")
|
||||
syncCart(player)
|
||||
// use cog with pin 2
|
||||
// pin 2: 2656: val 0 is scenery 18664 (pin). val 1 is scenery 18667 (small cog). val 2 is scenery 18668 (med cog). val 3 is scenery 18669 (large cog)
|
||||
onUseWith(IntType.SCENERY, intArrayOf(Items.SMALL_COG_9726, Items.MEDIUM_COG_9725, Items.LARGE_COG_9724), Scenery.PIN_18664) { player, item, _ ->
|
||||
when(item.id) {
|
||||
Items.SMALL_COG_9726 -> {
|
||||
setVarbit(player, EW2CogVarbit2, 1, true)
|
||||
sendItemDialogue(player, item, "You put the small cog onto the shaft.")
|
||||
animate(player, 537)
|
||||
removeItem(player, item)
|
||||
}
|
||||
Items.MEDIUM_COG_9725 -> {
|
||||
setVarbit(player, EW2CogVarbit2, 2, true)
|
||||
sendItemDialogue(player, item, "You put the medium cog onto the shaft.")
|
||||
animate(player, 537)
|
||||
removeItem(player, item)
|
||||
}
|
||||
Items.LARGE_COG_9724 -> {
|
||||
setVarbit(player, EW2CogVarbit2, 3, true)
|
||||
sendItemDialogue(player, item, "You put the large cog onto the shaft.")
|
||||
animate(player, 537)
|
||||
removeItem(player, item)
|
||||
}
|
||||
}
|
||||
return@onUseWith true
|
||||
}
|
||||
|
||||
// facing south: process bar
|
||||
if (currentPos == 1 && nextPos == 0) {
|
||||
if (craneMat == 2) {
|
||||
// if holding elemental bar, transform into mind bar
|
||||
setVarbit(player, EW2CraneState, 3)
|
||||
playAudio(player, Sounds.EW2_CRANE_LOWER_3169)
|
||||
// use cog with pin 3
|
||||
// pin 3: 2657: val 0 is scenery 18666 (pin). val 1 is scenery 18670 (small cog). val 2 is scenery 18671 (med cog). val 3 is scenery 18672 (large cog)
|
||||
onUseWith(IntType.SCENERY, intArrayOf(Items.SMALL_COG_9726, Items.MEDIUM_COG_9725, Items.LARGE_COG_9724), Scenery.PIN_18666) { player, item, _ ->
|
||||
when(item.id) {
|
||||
Items.SMALL_COG_9726 -> {
|
||||
setVarbit(player, EW2CogVarbit3, 1, true)
|
||||
sendItemDialogue(player, item, "You put the small cog onto the shaft.")
|
||||
animate(player, 537)
|
||||
removeItem(player, item)
|
||||
}
|
||||
Items.MEDIUM_COG_9725 -> {
|
||||
setVarbit(player, EW2CogVarbit3, 2, true)
|
||||
sendItemDialogue(player, item, "You put the medium cog onto the shaft.")
|
||||
animate(player, 537)
|
||||
removeItem(player, item)
|
||||
}
|
||||
Items.LARGE_COG_9724 -> {
|
||||
setVarbit(player, EW2CogVarbit3, 3, true)
|
||||
sendItemDialogue(player, item, "You put the large cog onto the shaft.")
|
||||
animate(player, 537)
|
||||
removeItem(player, item)
|
||||
}
|
||||
}
|
||||
return@onUseWith true
|
||||
}
|
||||
|
||||
setVarbit(player, EW2CranePos, nextPos, true)
|
||||
// fan lever. Authentically this check should allow the machine to start and the fan to either not start, start backwards, or start correctly, but I'm simplifying it for my sanity.
|
||||
on(Scenery.AN_OLD_LEVER_18663, IntType.SCENERY, "pull") { player, _ ->
|
||||
animate(player, Animations.HUMAN_PULL_LEVER_4909)
|
||||
syncCrane(player)
|
||||
return@on true
|
||||
}
|
||||
|
||||
// east lever by crane. rotates crane north and south
|
||||
on(Scenery.AN_OLD_LEVER_18621, IntType.SCENERY, "pull") { player, _ ->
|
||||
val currentPos = getVarbit(player,EW2CranePos)
|
||||
val p1 = getVarbit(player, EW2CogVarbit1)
|
||||
val p2 = getVarbit(player, EW2CogVarbit2)
|
||||
val p3 = getVarbit(player, EW2CogVarbit3)
|
||||
val lever = getVarbit(player, EW2FanLeverVarbit)
|
||||
val cartpos = getVarbit(player, EW2CartLeverVarbit) // needs to be 3 to be at this station
|
||||
val cartstate = getVarbit(player, EW2JigCartVarbit) // needs to be state 4: smashed cooled
|
||||
|
||||
// crane must be up to rotate
|
||||
if (currentPos == 0 || currentPos == 2) {
|
||||
sendMessage(player, "The arm cannot be rotated while the claw is down.")
|
||||
return@on true
|
||||
}
|
||||
|
||||
val nextPos = currentPos xor 2
|
||||
|
||||
setVarbit(player, EW2CranePos, nextPos, true)
|
||||
animate(player, Animations.HUMAN_PULL_LEVER_4909)
|
||||
syncCrane(player)
|
||||
return@on true
|
||||
}
|
||||
|
||||
/**------------------------
|
||||
* STATION 2 - THE ANVIL
|
||||
** ------------------------
|
||||
*/
|
||||
// requires the junction box interface to be fixed
|
||||
|
||||
// west lever, checks junction box status
|
||||
on(Scenery.AN_OLD_LEVER_18640, IntType.SCENERY, "pull") { player, _ ->
|
||||
|
||||
if (JunctionBoxInterface.isSolutionCorrect(player)) {
|
||||
// Jig Cart state. 0 = Empty, 1 = ele bar, 2 = hot bar, 3 = smashed hot, 4 = smashed cooled, 5 = primed
|
||||
val cartState = getVarbit(player, EW2JigCart)
|
||||
val cartPos = getVarbit(player, EW2CartLever)
|
||||
|
||||
// check if cart is here
|
||||
if (cartPos == 1) {
|
||||
when (cartState) {
|
||||
0 -> { // empty
|
||||
sendDialogue(player, "You pull the lever and the press operates, but there is nothing on the cart to flatten.")
|
||||
}
|
||||
// todo animate the hammer smash
|
||||
1 -> { // ele bar
|
||||
setVarbit(player, EW2JigCart, 4)
|
||||
// "hardy" is the real word used. I thought it was a typo for 'hammer' but it's not. https://en.wikipedia.org/wiki/Hardy_tool
|
||||
sendDialogue(player, "You pull the lever and the press responds. The hardy comes down, hitting the elemental bar. The bar is not hot enough to flatten.")
|
||||
syncCart(player)
|
||||
}
|
||||
2 -> { // hot ele bar
|
||||
setVarbit(player, EW2JigCart, 3)
|
||||
// "hardy" is correct. see above.
|
||||
sendDialogue(player, "You pull the lever and the press responds. The hardy comes down, hitting the elemental bar. The bar has been flattened.")
|
||||
syncCart(player)
|
||||
}
|
||||
else -> { // smashed hot, smashed cooled, or primed
|
||||
sendDialogue(player, "You pull the lever and the press responds. The hardy comes down, hitting the elemental bar. The bar is already flattened.")
|
||||
}
|
||||
// check if the cogs are right. pin 1 (2655) should have the small cog. pin 2 (2656) should have the med cog. pin 3 (2656) should have the large cog.
|
||||
if (p1 == 1 && p2 == 2 && p3 == 3) {
|
||||
if(lever == 0) {
|
||||
// turn on
|
||||
sendDialogue(player, "The machine rumbles and the fan starts to blow.") // Is authentically two messages of "The machine starts rumbling." and "The fan starts to blow.", but I am simplifying this check.
|
||||
setVarbit(player, EW2FanLeverVarbit, 1, true)
|
||||
// check cart and cool if necessary. otherwise nothing should happen.
|
||||
if (cartpos == 3 && cartstate == 4) {
|
||||
setVarbit(player, EW2JigCartVarbit, 5, true)
|
||||
syncCart(player)
|
||||
}
|
||||
//todo animate the fan somehow
|
||||
// find scenery ID {FANSTOPPED} or {FANSTARTED} near tile Location.create(1961, 5154, 2).
|
||||
// swap for scenery {FANSTOPPED} if EW2FanStateVarbit is 0 or {FANSTARTED} if EW2FanStateVarbit is 1
|
||||
|
||||
} else {
|
||||
// cart in wrong position
|
||||
sendDialogue(player, "You pull the lever and the press operates, but the jig cart is not underneath it.")
|
||||
// turn off
|
||||
sendDialogue(player, "The machine grinds to a standstill.")
|
||||
setVarbit(player, EW2FanLeverVarbit, 0, true)
|
||||
}
|
||||
// cogs are not correct
|
||||
} else {
|
||||
// The junction box is not configured correctly
|
||||
sendDialogue(player, "You pull the lever but nothing happens.")
|
||||
sendDialogue(player, "The machine starts up, but the fan does not blow.")
|
||||
}
|
||||
|
||||
return@on true
|
||||
}
|
||||
|
||||
/**------------------------
|
||||
* STATION 2 - WATER
|
||||
* SECTION 5 - MIND IMBUE
|
||||
** ------------------------
|
||||
*/
|
||||
// requires the pipe to be replaced
|
||||
|
||||
// todo north lever
|
||||
// north lever that opens and closes the door
|
||||
on(Scenery.AN_OLD_LEVER_18648, IntType.SCENERY, "pull") { player, _ ->
|
||||
/**
|
||||
* EXTRACTOR_GUN_18693
|
||||
* EXTRACTOR_GUN_18694
|
||||
* EXTRACTOR_GUN_18695
|
||||
* EXTRACTOR_GUN_18696
|
||||
* EXTRACTOR_HAT_18690
|
||||
* EXTRACTOR_HAT_18691
|
||||
* EXTRACTOR_HAT_TOP_18692
|
||||
*/
|
||||
|
||||
return@on true
|
||||
}
|
||||
|
||||
// todo corkscrew lever
|
||||
// corkscrew lever that grabs and ungrabs the cart as long as the door is open
|
||||
on(Scenery.CORKSCREW_LEVER_18649, IntType.SCENERY, "turn") { player, _ ->
|
||||
|
||||
return@on true
|
||||
}
|
||||
|
||||
// todo west water valve
|
||||
// west water valve fills the chamber if the door is closed "you open the valve" "you close the valve" make sure it's closed or the chamber will fill up again
|
||||
// changes cart state into flattened mind bar
|
||||
on(Scenery.WATER_VALVE_18646, IntType.SCENERY, "turn") { player, _ ->
|
||||
|
||||
return@on true
|
||||
}
|
||||
|
||||
// todo east water valve
|
||||
// east water valve drains the tank if it is full "you open the valve"
|
||||
on(Scenery.WATER_VALVE_18647, IntType.SCENERY, "turn") { player, _ ->
|
||||
|
||||
return@on true
|
||||
}
|
||||
|
||||
// fix crane
|
||||
onUseWith(IntType.SCENERY, Items.CRANE_CLAW_9720, Scenery.OLD_CRANE_18636) { player, used, with ->
|
||||
// check if already repaired
|
||||
if(getVarbit(player, EW2CraneState) != 0) {
|
||||
sendMessage(player, "The crane is already repaired.")
|
||||
return@onUseWith true
|
||||
}
|
||||
sendItemDialogue(player, used, "You replace the broken claw.")
|
||||
removeItem(player, used)
|
||||
|
||||
setVarbit(player, EW2CraneState, 1, true)
|
||||
syncCrane(player)
|
||||
return@onUseWith true
|
||||
}
|
||||
|
||||
// opens the junction box
|
||||
on(Scenery.JUNCTION_BOX_18641, IntType.SCENERY, "open") { player, _ ->
|
||||
openInterface(player, Components.JUNCTION_BOX_262)
|
||||
return@on true
|
||||
}
|
||||
|
||||
// take item from the jig cart
|
||||
on(jigCartStates, IntType.NPC, "take-from") { player, node ->
|
||||
when(node.id) {
|
||||
4914 -> {
|
||||
addItemOrDrop(player, Items.ELEMENTAL_METAL_2893)
|
||||
sendItemDialogue(player, Items.ELEMENTAL_METAL_2893, "You take the elemental metal.")
|
||||
animate(player, 537)
|
||||
setVarbit(player, EW2JigCart, 0, true)
|
||||
}
|
||||
4915 -> {
|
||||
sendMessage(player, "The bar is too hot to touch.")
|
||||
}
|
||||
4918 -> {
|
||||
addItemOrDrop(player, Items.PRIMED_BAR_9727)
|
||||
sendItemDialogue(player, Items.PRIMED_BAR_9727, "You take the primed bar.")
|
||||
animate(player, 537)
|
||||
setVarbit(player, EW2JigCart, 0, true)
|
||||
}
|
||||
}
|
||||
syncCart(player)
|
||||
return@on true
|
||||
}
|
||||
|
||||
// fix the pipe
|
||||
onUseWith(IntType.SCENERY, Items.PIPE_9723, Scenery.PIPING_18650) { player, item, _ ->
|
||||
animate(player, 537)
|
||||
sendItemDialogue(player, item, "You replace the section of broken pipe.")
|
||||
playAudio(player, Sounds.EW2_PLACE_PIPE_3179)
|
||||
setVarbit(player, EW2PipeVarbit, 1, true)
|
||||
removeItem(player, item)
|
||||
return@onUseWith true
|
||||
}
|
||||
|
||||
// put regular bar on the jig cart
|
||||
onUseWith(IntType.NPC, intArrayOf(Items.ELEMENTAL_METAL_2893), NPCs.JIG_CART_4913) { player, used, _ ->
|
||||
val cranePos = getVarbit(player, EW2CranePos)
|
||||
|
||||
// if crane is south down, it's blocking the cart.
|
||||
if (cranePos == 2) {
|
||||
sendMessage(player, "You cannot place that while the claw is down.")
|
||||
return@onUseWith true
|
||||
}
|
||||
|
||||
setVarbit(player, EW2JigCart, 1, true)
|
||||
animate(player, 537)
|
||||
syncCart(player)
|
||||
removeItem(player, used)
|
||||
return@onUseWith true
|
||||
}
|
||||
|
||||
on(Scenery.LEVER_18620, IntType.SCENERY, "pull") { player, _ ->
|
||||
val currentPos = getVarbit(player, EW2CartLever)
|
||||
val cranePos = getVarbit(player, EW2CranePos)
|
||||
|
||||
// crane must be up
|
||||
if (currentPos == 0 && cranePos == 2) {
|
||||
sendMessage(player, "You cannot do that while the claw is down.")
|
||||
return@on true
|
||||
}
|
||||
|
||||
// positions cycles 0 -> 1 -> 2 -> 3 -> 0 etc.
|
||||
val nextPos = (currentPos + 1) % 4
|
||||
|
||||
animate(player, Animations.HUMAN_PULL_LEVER_4909)
|
||||
setVarbit(player, EW2CartLever, nextPos, true)
|
||||
syncCart(player)
|
||||
|
||||
return@on true
|
||||
}
|
||||
}
|
||||
|
||||
// fixes to get right interact locations
|
||||
|
|
|
|||
|
|
@ -1,17 +1,12 @@
|
|||
package content.region.kandarin.seers.quest.elementalworkshop2
|
||||
|
||||
import content.data.Quests
|
||||
import content.region.kandarin.seers.quest.elementalworkshop2.EW2Listeners.Companion.syncCart
|
||||
import content.region.kandarin.seers.quest.elementalworkshop2.EW2Listeners.Companion.syncCrane
|
||||
import core.api.*
|
||||
import core.game.node.entity.npc.NPC
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.entity.player.link.quest.Quest
|
||||
import core.game.node.entity.skill.Skills
|
||||
import core.game.world.map.Location
|
||||
import core.plugin.Initializable
|
||||
import org.rs09.consts.Items
|
||||
import org.rs09.consts.NPCs
|
||||
|
||||
/**
|
||||
* ELEMENTAL WORKSHOP II QUEST
|
||||
|
|
@ -21,39 +16,39 @@ import org.rs09.consts.NPCs
|
|||
*/
|
||||
|
||||
@Initializable
|
||||
class ElementalWorkshop2 : Quest(Quests.ELEMENTAL_WORKSHOP_II, 53, 52, 1, EW2Varbit, 0, 1, 11) {
|
||||
class ElementalWorkshop2 : Quest(Quests.ELEMENTAL_WORKSHOP_II, 53, 52, 1, EW2StageVarbit, 0, 1, 11) {
|
||||
|
||||
// a truckload of varbits
|
||||
companion object {
|
||||
const val ELEMENTALWORKSHOP2VARP = 896 // first EW2 varp that packages varbits 2639-2652
|
||||
const val EW2Varbit = 2639 // Main quest progress. Incremented with quest stages.
|
||||
const val EW2Varp1 = 896 // first EW2 varp that packages varbits 2639-2652
|
||||
const val EW2StageVarbit = 2639 // Main quest progress. Incremented with quest stages.
|
||||
const val EW2MachineryVarbit = 2640 // The machinery you have to search for the key. Set to 1 after you read the scroll.
|
||||
const val EW2HatchVarbit = 2641 // The hatch down to EW2. Set to 1 after you unlock it with the key.
|
||||
const val EW2CartLever = 2642 // cart moving lever. 0 = start (south), 1 = west, 2 = north, 3 = east
|
||||
const val EW2JigCart = 2643 // Jig Cart state. 0 = Empty, 1 = ele bar, 2 = hot bar, 3 = smashed hot, 4 = smashed cooled, 5 = primed
|
||||
const val EW2CraneState = 2644 // Crane State. 0 = Broken, 1 = Fixed/Empty, 2 = Elemental Bar, 3 = Mind Bar.
|
||||
const val EW2CranePos = 2645 // Crane Position. 0 = South Down, 1 = South Up, 2 = North Down, 3 = North Up.
|
||||
const val EW2JB1 = 2646 // junction box status
|
||||
const val EW2JB2 = 2647 // junction box status
|
||||
const val EW2JB3 = 2648 // junction box status
|
||||
//const val EW2JB = 2649 // junction box - this overlaps 2646, 2647, 2648
|
||||
const val EW2PipeVarbit = 2650
|
||||
//const val EW2 = 2651 // water valve west
|
||||
//const val EW2 = 2652 // cork screw lever and water valve east
|
||||
const val EW2CartLeverVarbit = 2642 // cart moving lever. 0 = start (south), 1 = west, 2 = north, 3 = east
|
||||
const val EW2JigCartVarbit = 2643 // Jig Cart state. 0 = Empty, 1 = ele bar, 2 = hot bar, 3 = smashed hot, 4 = smashed cooled, 5 = primed
|
||||
const val EW2CraneStateVarbit = 2644 // Crane State. 0 = broken, 1 = fixed/empty, 2 = ele bar, 3 = hot bar.
|
||||
const val EW2CranePosVarbit = 2645 // Crane Position. 0 = South Down, 1 = South Up, 2 = North Down, 3 = North Up.
|
||||
const val EW2JctVarbit1 = 2646 // junction box status. see junctionboxinterface for details.
|
||||
const val EW2JctVarbit2 = 2647 // junction box status. see junctionboxinterface for details.
|
||||
const val EW2JctVarbit3 = 2648 // junction box status. see junctionboxinterface for details.
|
||||
//const val EW2JctBoxVarbit = 2649 // junction box - this overlaps 2646, 2647, 2648. could be used to reset whole jct box at once.
|
||||
const val EW2PipeVarbit = 2650 // pipe varbit. 0 = broken, 1 = fixed
|
||||
const val EW2ValveWestVarbit = 2651 // water valve west. 0 = closed, 1 = open
|
||||
const val EW2ValveEastVarbit = 2652 // water valve east. 0 = closed, 1 = open
|
||||
|
||||
const val ELEMENTALWORKSHOP2VARP2 = 897 // second EW2 varp that packages varbits 2653-2664
|
||||
//const val EW2 = 2653
|
||||
//const val EW2 = 2654
|
||||
//const val EW2 = 2655 // cog pin
|
||||
//const val EW2 = 2656 // cog pin
|
||||
//const val EW2 = 2657 // cog pin
|
||||
//const val EW2 = 2658
|
||||
//const val EW2 = 2659
|
||||
//const val EW2 = 2660
|
||||
//const val EW2 = 2661
|
||||
//const val EW2 = 2662
|
||||
//const val EW2 = 2663
|
||||
//const val EW2 = 2664
|
||||
const val EW2Varp2 = 897 // second EW2 varp that packages varbits 2653-2664
|
||||
const val EW2TankDoorVarbit = 2653 // tank door, controlled by corkscrew lever. 0 = , 1 = , 2 = , 3 = , 4 = , 5 = , 6 = , 7 = , 8 =
|
||||
const val EW2DoorLeverVarbit = 2654 // door lever. 0 = closed, 1 = open
|
||||
const val EW2CogVarbit1 = 2655 // cog pin. 0 = no cog, 1 = small, 2 = med, 3 = large
|
||||
const val EW2CogVarbit2 = 2656 // cog pin. 0 = no cog, 1 = small, 2 = med, 3 = large
|
||||
const val EW2CogVarbit3 = 2657 // cog pin. 0 = no cog, 1 = small, 2 = med, 3 = large
|
||||
//const val EW2AllCogsVarbit = 2658 // overlaps the cog varbits. could be used to reset all cogs at once.
|
||||
const val EW2FanLeverVarbit = 2659 // fan switch. 0 = fan off, 1 = fan on
|
||||
//const val EW2FanStateVarbit = 2660 // fan blades. 0 = off, 1 = forward, 2 = reverse
|
||||
//const val EW2FanStationVarbit = 2661 // overlaps cogs, fan switch, and fan blades varbits
|
||||
//const val EW2 = 2662 // extractor gun. 0 = empty, 1 = primed bar, 2 = mind bar
|
||||
//const val EW2 = 2663 //
|
||||
//const val EW2 = 2664 // values from 1 to 7 back at the dig site library where you find the book.
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -166,8 +161,8 @@ class ElementalWorkshop2 : Quest(Quests.ELEMENTAL_WORKSHOP_II, 53, 52, 1, EW2Var
|
|||
// use ::setqueststage 53 0 to reset quest.
|
||||
override fun reset(player: Player) {
|
||||
// these varps wipes all the varbits
|
||||
setVarp(player, ELEMENTALWORKSHOP2VARP, 0, true)
|
||||
setVarp(player, ELEMENTALWORKSHOP2VARP2, 0, true)
|
||||
setVarp(player, EW2Varp1, 0, true)
|
||||
setVarp(player, EW2Varp2, 0, true)
|
||||
player.getQuestRepository().syncronizeTab(player)
|
||||
super.reset(player)
|
||||
}
|
||||
|
|
@ -184,7 +179,7 @@ class ElementalWorkshop2 : Quest(Quests.ELEMENTAL_WORKSHOP_II, 53, 52, 1, EW2Var
|
|||
drawReward(player, "Ability to make and equip", ln++)
|
||||
drawReward(player, "elemental mind equipment", ln)
|
||||
|
||||
setVarbit(player, EW2Varbit, 11, true)
|
||||
setVarbit(player, EW2StageVarbit, 11, true)
|
||||
rewardXP(player, Skills.SMITHING, 7500.0)
|
||||
rewardXP(player, Skills.CRAFTING, 7500.0)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
package content.region.kandarin.seers.quest.elementalworkshop2
|
||||
|
||||
import content.region.kandarin.seers.quest.elementalworkshop2.ElementalWorkshop2.Companion.EW2JB1
|
||||
import content.region.kandarin.seers.quest.elementalworkshop2.ElementalWorkshop2.Companion.EW2JB2
|
||||
import content.region.kandarin.seers.quest.elementalworkshop2.ElementalWorkshop2.Companion.EW2JB3
|
||||
import content.region.kandarin.seers.quest.elementalworkshop2.ElementalWorkshop2.Companion.EW2JctVarbit1
|
||||
import content.region.kandarin.seers.quest.elementalworkshop2.ElementalWorkshop2.Companion.EW2JctVarbit2
|
||||
import content.region.kandarin.seers.quest.elementalworkshop2.ElementalWorkshop2.Companion.EW2JctVarbit3
|
||||
import core.api.*
|
||||
import core.game.interaction.InterfaceListener
|
||||
import core.game.node.entity.player.Player
|
||||
|
|
@ -23,9 +23,9 @@ class JunctionBoxInterface : InterfaceListener {
|
|||
private val pipeSelectVarbit =
|
||||
4834 // 0 = no select, 1 = top left, 2 = top middle, 3 = top right, 4 = bottom left, 5 = bottom middle, 6 = bottom right
|
||||
|
||||
private val firstSelect = EW2JB1 // this is the main quest varbit used to save and recall pipe selection. values 0-15
|
||||
private val secondSelect = EW2JB2 // this is the main quest varbit used to save and recall pipe selection. values 0-15
|
||||
private val thirdSelect = EW2JB3 // this is the main quest varbit used to save and recall pipe selection. values 0-15
|
||||
private val firstSelect = EW2JctVarbit1 // this is the main quest varbit used to save and recall pipe selection. values 0-15
|
||||
private val secondSelect = EW2JctVarbit2 // this is the main quest varbit used to save and recall pipe selection. values 0-15
|
||||
private val thirdSelect = EW2JctVarbit3 // this is the main quest varbit used to save and recall pipe selection. values 0-15
|
||||
|
||||
// the interface children for displaying each placed pipe
|
||||
private val pipes = intArrayOf(
|
||||
|
|
@ -57,9 +57,9 @@ class JunctionBoxInterface : InterfaceListener {
|
|||
* Checks if the three specific pipes required for the puzzle solution are placed.
|
||||
*/
|
||||
fun isSolutionCorrect(player: Player): Boolean {
|
||||
val s1 = getVarbit(player, EW2JB1)
|
||||
val s2 = getVarbit(player, EW2JB2)
|
||||
val s3 = getVarbit(player, EW2JB3)
|
||||
val s1 = getVarbit(player, EW2JctVarbit1)
|
||||
val s2 = getVarbit(player, EW2JctVarbit2)
|
||||
val s3 = getVarbit(player, EW2JctVarbit3)
|
||||
|
||||
val requiredIndices = intArrayOf(3, 7, 12)
|
||||
val currentValues = intArrayOf(s1, s2, s3)
|
||||
|
|
@ -111,6 +111,7 @@ class JunctionBoxInterface : InterfaceListener {
|
|||
on(junctionBox) { player, _, _, buttonID, _, _ ->
|
||||
|
||||
// interface buttons
|
||||
// i think some of this is also controlled by 1318.cs2 fwiw
|
||||
val b1 = 24;
|
||||
val b2 = 25;
|
||||
val b3 = 20
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue