Blast furnace code refactored
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
package content.minigame.blastfurnace
|
package content.minigame.blastfurnace
|
||||||
|
|
||||||
|
import content.global.skill.smithing.smelting.Bar
|
||||||
import core.api.*
|
import core.api.*
|
||||||
import core.game.container.impl.EquipmentContainer
|
import core.game.container.impl.EquipmentContainer
|
||||||
import core.game.node.entity.player.Player
|
import core.game.node.entity.player.Player
|
||||||
import core.game.node.entity.skill.Skills
|
import core.game.node.entity.skill.Skills
|
||||||
import core.game.node.item.Item
|
import core.game.node.item.Item
|
||||||
import content.global.skill.smithing.smelting.Bar
|
|
||||||
import core.game.system.task.Pulse
|
import core.game.system.task.Pulse
|
||||||
import core.game.world.map.Location
|
import core.game.world.map.Location
|
||||||
import core.tools.RandomFunction
|
import core.tools.RandomFunction
|
||||||
@@ -77,7 +77,7 @@ object BlastFurnace {
|
|||||||
giveSmithXp--
|
giveSmithXp--
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
interfaceManager()
|
//interfaceManager()
|
||||||
runConveyor()
|
runConveyor()
|
||||||
stoveCokeTemperature()
|
stoveCokeTemperature()
|
||||||
furnaceTemperature()
|
furnaceTemperature()
|
||||||
@@ -310,7 +310,7 @@ object BlastFurnace {
|
|||||||
/**Hi kids!
|
/**Hi kids!
|
||||||
* Do you like Varbits?
|
* Do you like Varbits?
|
||||||
* Wanna see me stick Nine Binary Bytes, through each one of my eyelids?
|
* Wanna see me stick Nine Binary Bytes, through each one of my eyelids?
|
||||||
* Wanna look at how many bars you have left inside the furnace???*/
|
* Wanna look at how many bars you have left inside the furnace???
|
||||||
|
|
||||||
fun interfaceManager() {
|
fun interfaceManager() {
|
||||||
var playerBars = listOf<Item>()
|
var playerBars = listOf<Item>()
|
||||||
@@ -357,4 +357,5 @@ object BlastFurnace {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,20 +1,52 @@
|
|||||||
package content.minigame.blastfurnace
|
package content.minigame.blastfurnace
|
||||||
|
|
||||||
import core.api.*
|
import core.api.addItem
|
||||||
|
import core.api.freeSlots
|
||||||
|
import core.game.interaction.InterfaceListener
|
||||||
import core.game.node.item.Item
|
import core.game.node.item.Item
|
||||||
import org.rs09.consts.Components
|
import org.rs09.consts.Components
|
||||||
import org.rs09.consts.Items
|
import org.rs09.consts.Items
|
||||||
import core.game.interaction.InterfaceListener
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Handles the blast furnace bar stock interface.
|
* Handles the blast furnace bar stock interface.
|
||||||
* @author definitely phil who didn't get help from ceikry at all haha :)
|
* @author phil, bushtail
|
||||||
* @version 69.0
|
* @version 2.0
|
||||||
*/
|
*/
|
||||||
class BlastFurnaceInterfaceListener : InterfaceListener {
|
class BlastFurnaceInterfaceListener : InterfaceListener {
|
||||||
|
|
||||||
override fun defineInterfaceListeners() {
|
override fun defineInterfaceListeners() {
|
||||||
|
|
||||||
|
onOpen(28,) { player, component ->
|
||||||
|
var playerBars = player.blastBars.toArray().filterNotNull()
|
||||||
|
var bronzeBit = 1
|
||||||
|
var ironBit = 1
|
||||||
|
var steelBit = 1
|
||||||
|
var mithrilBit = 1
|
||||||
|
var adamantiteBit = 1
|
||||||
|
var runiteBit = 1
|
||||||
|
var silverBit = 1
|
||||||
|
var goldBit = 1
|
||||||
|
var barTotal = 0
|
||||||
|
if (playerBars.isEmpty()) {
|
||||||
|
return@onOpen true
|
||||||
|
} else {
|
||||||
|
playerBars.forEach { barItem ->
|
||||||
|
when (barItem.id) {
|
||||||
|
Items.BRONZE_BAR_2349 -> player.varpManager.get(545).setVarbit(0, bronzeBit++).send(player)
|
||||||
|
Items.IRON_BAR_2351 -> player.varpManager.get(545).setVarbit(8, ironBit++).send(player)
|
||||||
|
Items.STEEL_BAR_2353 -> player.varpManager.get(545).setVarbit(16, steelBit++).send(player)
|
||||||
|
Items.MITHRIL_BAR_2359 -> player.varpManager.get(545).setVarbit(24, mithrilBit++).send(player)
|
||||||
|
Items.ADAMANTITE_BAR_2361 -> player.varpManager.get(546).setVarbit(0, adamantiteBit++).send(player)
|
||||||
|
Items.RUNITE_BAR_2363 -> player.varpManager.get(546).setVarbit(8, runiteBit++).send(player)
|
||||||
|
Items.SILVER_BAR_2355 -> player.varpManager.get(546).setVarbit(24, silverBit++).send(player)
|
||||||
|
Items.GOLD_BAR_2357 -> player.varpManager.get(546).setVarbit(16, goldBit++).send(player)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return@onOpen true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
on(Components.BLAST_FURNACE_BAR_STOCK_28){ player, _, _, buttonID, _, _ ->
|
on(Components.BLAST_FURNACE_BAR_STOCK_28){ player, _, _, buttonID, _, _ ->
|
||||||
val bar = BFBars.forId(buttonID) ?: return@on false
|
val bar = BFBars.forId(buttonID) ?: return@on false
|
||||||
val isAll = buttonID == bar.allButtonId
|
val isAll = buttonID == bar.allButtonId
|
||||||
@@ -40,11 +72,12 @@ class BlastFurnaceInterfaceListener : InterfaceListener {
|
|||||||
|
|
||||||
player.varpManager.get(bar.varpIndex).setVarbit(bar.offset, playerAmt - amtToWithdraw).send(player)
|
player.varpManager.get(bar.varpIndex).setVarbit(bar.offset, playerAmt - amtToWithdraw).send(player)
|
||||||
|
|
||||||
addItem(player, barItemId, amtToWithdraw)
|
|
||||||
while(amtToWithdraw > 0){
|
while(amtToWithdraw > 0){
|
||||||
player.blastBars.remove(Item(barItemId))
|
if(addItem(player, barItemId, amtToWithdraw) && player.blastBars.remove(Item(barItemId))) {
|
||||||
amtToWithdraw--
|
amtToWithdraw--
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if(player.blastBars.isEmpty) player.varpManager.get(543).clear().send(player)
|
if(player.blastBars.isEmpty) player.varpManager.get(543).clear().send(player)
|
||||||
return@on true
|
return@on true
|
||||||
}
|
}
|
||||||
@@ -61,7 +94,7 @@ class BlastFurnaceInterfaceListener : InterfaceListener {
|
|||||||
GOLD(21, 546, 16);
|
GOLD(21, 546, 16);
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
private val idMap = values().map { it.buttonId to it }.toMap()
|
private val idMap = values().associateBy { it.buttonId }
|
||||||
|
|
||||||
fun forId(buttonId: Int): BFBars? {
|
fun forId(buttonId: Int): BFBars? {
|
||||||
return idMap[buttonId] ?: idMap[buttonId - 2] ?: idMap[buttonId - 1]
|
return idMap[buttonId] ?: idMap[buttonId - 2] ?: idMap[buttonId - 1]
|
||||||
|
|||||||
@@ -1,21 +1,19 @@
|
|||||||
package content.minigame.blastfurnace
|
package content.minigame.blastfurnace
|
||||||
|
|
||||||
import core.api.Container
|
import content.global.skill.smithing.smelting.Bar
|
||||||
import core.api.*
|
import core.api.*
|
||||||
|
import core.game.interaction.InteractionListener
|
||||||
import core.game.node.entity.skill.Skills
|
import core.game.node.entity.skill.Skills
|
||||||
import core.game.node.item.Item
|
import core.game.node.item.Item
|
||||||
import content.global.skill.smithing.smelting.Bar
|
|
||||||
import core.game.system.task.Pulse
|
import core.game.system.task.Pulse
|
||||||
import core.game.interaction.InteractionListener
|
|
||||||
import core.game.interaction.IntType
|
|
||||||
import core.game.world.map.Location
|
import core.game.world.map.Location
|
||||||
import org.rs09.consts.Items
|
import org.rs09.consts.Items
|
||||||
|
|
||||||
/**"Most" of the listeners for blast furnace live in this funny little file, handles
|
/**"Most" of the listeners for blast furnace live in this file, handles
|
||||||
* listeners for most things from interacting with the temp gauge to putting ore on the
|
* listeners for most things from interacting with the temp gauge to putting ore on the
|
||||||
* conveyor belt. The only thing that's not in here as far as listeners goes is Ordan's unnoting.
|
* conveyor belt. The only thing that's not in here as far as listeners goes is Ordan's unnoting.
|
||||||
* That lives in OrdanDialogue.kt
|
* That lives in OrdanDialogue.kt
|
||||||
* @author phil lips*/
|
* @author phil, bushtail*/
|
||||||
|
|
||||||
class BlastFurnaceListeners : InteractionListener {
|
class BlastFurnaceListeners : InteractionListener {
|
||||||
|
|
||||||
@@ -56,9 +54,9 @@ class BlastFurnaceListeners : InteractionListener {
|
|||||||
|
|
||||||
override fun defineListeners() {
|
override fun defineListeners() {
|
||||||
|
|
||||||
/**FINALLY AFK STRENGTH TRAINING*/
|
/**Handles operating the pump*/
|
||||||
|
|
||||||
on(pump, IntType.SCENERY, "operate") { player, node ->
|
on(pump, SCENERY, "operate") { player, node ->
|
||||||
if(player.getSkills().getLevel(Skills.STRENGTH) >= 30) {
|
if(player.getSkills().getLevel(Skills.STRENGTH) >= 30) {
|
||||||
val pumpL = Location(1950, 4961, 0)
|
val pumpL = Location(1950, 4961, 0)
|
||||||
val pumpF = Location(1949, 4961, 0)
|
val pumpF = Location(1949, 4961, 0)
|
||||||
@@ -90,7 +88,7 @@ class BlastFurnaceListeners : InteractionListener {
|
|||||||
/**Logic for the pedals that run the conveyor, rewards Agility XP every tick that they're being
|
/**Logic for the pedals that run the conveyor, rewards Agility XP every tick that they're being
|
||||||
* pedaled but will stop once the conveyor breaks.*/
|
* pedaled but will stop once the conveyor breaks.*/
|
||||||
|
|
||||||
on(pedals, IntType.SCENERY, "pedal") { player, node ->
|
on(pedals, SCENERY, "pedal") { player, node ->
|
||||||
if(player.getSkills().getLevel(Skills.AGILITY) >= 30) {
|
if(player.getSkills().getLevel(Skills.AGILITY) >= 30) {
|
||||||
val pedalL = Location(1947, 4966, 0)
|
val pedalL = Location(1947, 4966, 0)
|
||||||
val pedalF = Location(1946, 4966, 0)
|
val pedalF = Location(1946, 4966, 0)
|
||||||
@@ -116,12 +114,12 @@ class BlastFurnaceListeners : InteractionListener {
|
|||||||
|
|
||||||
/**Lets players use a spade to take coke from the pile of coke*/
|
/**Lets players use a spade to take coke from the pile of coke*/
|
||||||
|
|
||||||
on(coke, IntType.SCENERY, "collect") { player, node ->
|
on(coke, SCENERY, "collect") { player, _ ->
|
||||||
if (inInventory(player, Items.SPADE_952, 1)) {
|
if (inInventory(player, Items.SPADE_952, 1)) {
|
||||||
animate(player, 2441)
|
if(removeItem(player, Items.SPADE_952, Container.INVENTORY) && addItem(player, Items.SPADEFUL_OF_COKE_6448, 1)) {
|
||||||
removeItem(player, Items.SPADE_952, Container.INVENTORY)
|
|
||||||
addItem(player, Items.SPADEFUL_OF_COKE_6448, 1)
|
|
||||||
lockInteractions(player,1)
|
lockInteractions(player,1)
|
||||||
|
animate(player, 2441)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
sendMessage(player, "You need a spade to do this!")
|
sendMessage(player, "You need a spade to do this!")
|
||||||
}
|
}
|
||||||
@@ -132,16 +130,18 @@ class BlastFurnaceListeners : InteractionListener {
|
|||||||
* and rewards firemaking XP when shoving coke in there, it will not allow players to shovel more
|
* and rewards firemaking XP when shoving coke in there, it will not allow players to shovel more
|
||||||
* coke in if it is already full.*/
|
* coke in if it is already full.*/
|
||||||
|
|
||||||
on(stove, IntType.SCENERY, "refuel") { player, node ->
|
on(stove, SCENERY,"refuel") { player, _ ->
|
||||||
if (inInventory(player, Items.SPADEFUL_OF_COKE_6448, 1) && BlastFurnace.stoveCoke < 30 && player.getSkills().getLevel(Skills.FIREMAKING) >= 30) {
|
if (inInventory(player, Items.SPADEFUL_OF_COKE_6448, 1) && BlastFurnace.stoveCoke < 30 && player.getSkills().getLevel(Skills.FIREMAKING) >= 30) {
|
||||||
animate(player, 2442)
|
animate(player, 2442)
|
||||||
lockInteractions(player,2)
|
lockInteractions(player,2)
|
||||||
submitIndividualPulse(player, object : Pulse() {
|
submitIndividualPulse(player, object : Pulse() {
|
||||||
override fun pulse(): Boolean {
|
override fun pulse(): Boolean {
|
||||||
removeItem(player, Items.SPADEFUL_OF_COKE_6448, Container.INVENTORY)
|
return if(removeItem(player, Items.SPADEFUL_OF_COKE_6448, Container.INVENTORY) && addItem(player, Items.SPADE_952, 1)) {
|
||||||
addItem(player, Items.SPADE_952, 1)
|
|
||||||
animate(player, 2443)
|
animate(player, 2443)
|
||||||
return true
|
true
|
||||||
|
} else {
|
||||||
|
false
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
rewardXP(player, Skills.FIREMAKING, 5.0)
|
rewardXP(player, Skills.FIREMAKING, 5.0)
|
||||||
@@ -156,22 +156,21 @@ class BlastFurnaceListeners : InteractionListener {
|
|||||||
return@on true
|
return@on true
|
||||||
}
|
}
|
||||||
|
|
||||||
/**This beautiiful block of bullshit handles the logic for putting coal and ores
|
/**This block of code handles the logic for putting coal and ores
|
||||||
* on the conveyor belt. It won't let you put anything on there if there's no room
|
* on the conveyor belt. It won't let you put anything on there if there's no room
|
||||||
* in your blast ore or blast coal player containers, the way it works is that it
|
* in your blast ore or blast coal player containers, the way it works is that it
|
||||||
* puts your coal and ore into the blast furnace containers however, the blast furnace will NOT
|
* puts your coal and ore into the blast furnace containers however, the blast furnace will NOT
|
||||||
* smelt your ores because it's waiting for a player attribute to be set by the ore NPCs that this spawns
|
* smelt your ores because it's waiting for a player attribute to be set by the ore NPCs that this spawns*/
|
||||||
* Is it fucky? Yes
|
|
||||||
* Does it work? Also yes*/
|
on(conveyorLoad, SCENERY, "put-ore-on") { player, node ->
|
||||||
on(conveyorLoad, IntType.SCENERY, "put-ore-on") { player, node ->
|
val rocksInInventory = playerOre.filter {inInventory(player, it)}
|
||||||
val rocksInInven = playerOre.filter {inInventory(player, it)}
|
|
||||||
var oreToActuallyAdd = 0
|
var oreToActuallyAdd = 0
|
||||||
var coalToActuallyAdd = 0
|
var coalToActuallyAdd = 0
|
||||||
if(player.blastCoal.freeSlots() > 0 || player.blastOre.freeSlots() > 0) {
|
if(player.blastCoal.freeSlots() > 0 || player.blastOre.freeSlots() > 0) {
|
||||||
player.dialogueInterpreter.sendOptions("Add all your ore to the furnace?", "Yes", "No")
|
player.dialogueInterpreter.sendOptions("Add all your ore to the furnace?", "Yes", "No")
|
||||||
player.dialogueInterpreter.addAction { player, button ->
|
player.dialogueInterpreter.addAction { player, button ->
|
||||||
if (button == 2 && rocksInInven.isNotEmpty()) {
|
if (button == 2 && rocksInInventory.isNotEmpty()) {
|
||||||
rocksInInven.forEach { oreID ->
|
rocksInInventory.forEach { oreID ->
|
||||||
val oreAmount = amountInInventory(player, oreID)
|
val oreAmount = amountInInventory(player, oreID)
|
||||||
val copperInPot = player.blastOre.getAmount(436)
|
val copperInPot = player.blastOre.getAmount(436)
|
||||||
val tinInPot = player.blastOre.getAmount(438)
|
val tinInPot = player.blastOre.getAmount(438)
|
||||||
@@ -198,27 +197,31 @@ class BlastFurnaceListeners : InteractionListener {
|
|||||||
val bar = Bar.forOre(oreID)
|
val bar = Bar.forOre(oreID)
|
||||||
if(oreID == Items.COAL_453) {
|
if(oreID == Items.COAL_453) {
|
||||||
if (coalToActuallyAdd > 0 && getStatLevel(player, Skills.SMITHING) >= 30) {
|
if (coalToActuallyAdd > 0 && getStatLevel(player, Skills.SMITHING) >= 30) {
|
||||||
player.blastCoal.add(Item(Items.COAL_453,coalToActuallyAdd))
|
if(removeItem(player, Item(oreID, coalToActuallyAdd), Container.INVENTORY) && player.blastCoal.add(Item(Items.COAL_453,coalToActuallyAdd))) {
|
||||||
removeItem(player, Item(oreID, coalToActuallyAdd), Container.INVENTORY)
|
|
||||||
BlastFurnaceOre(player, BFOreVariant.values()[playerOre.indexOf(oreID)],coalToActuallyAdd).init()
|
BlastFurnaceOre(player, BFOreVariant.values()[playerOre.indexOf(oreID)],coalToActuallyAdd).init()
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if(getStatLevel(player, Skills.SMITHING) < 30){
|
else if(getStatLevel(player, Skills.SMITHING) < 30){
|
||||||
sendDialogue(player, "My Smithing level is not high enough to use Coal!")
|
sendDialogue(player, "My Smithing level is not high enough to use Coal!")
|
||||||
}
|
}
|
||||||
else sendDialogue(player, "It looks like the melting pot is already full of coal!")
|
else sendDialogue(player, "It looks like the melting pot is already full of coal!")
|
||||||
} else if (bar != null) {
|
} else if (bar != null) {
|
||||||
if (oreToActuallyAdd > 0 && getStatLevel(player, Skills.SMITHING) >= bar.level) {
|
if (oreToActuallyAdd > 0 && getStatLevel(player, Skills.SMITHING) >= bar.level) {
|
||||||
player.blastOre.add(Item(oreID,oreToActuallyAdd))
|
if(removeItem(player, Item(oreID, oreToActuallyAdd), Container.INVENTORY) && player.blastOre.add(Item(oreID,oreToActuallyAdd))) {
|
||||||
removeItem(player, Item(oreID, oreToActuallyAdd), Container.INVENTORY)
|
BlastFurnaceOre(
|
||||||
BlastFurnaceOre(player, BFOreVariant.values()[playerOre.indexOf(oreID)],oreToActuallyAdd).init()
|
player,
|
||||||
|
BFOreVariant.values()[playerOre.indexOf(oreID)],
|
||||||
|
oreToActuallyAdd
|
||||||
|
).init()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if(getStatLevel(player, Skills.SMITHING) < bar.level){
|
else if(getStatLevel(player, Skills.SMITHING) < bar.level){
|
||||||
sendDialogue(player, "My Smithing level is not high enough to smelt ${bar.name.toLowerCase()}!")
|
sendDialogue(player, "My Smithing level is not high enough to smelt ${bar.name.lowercase()}!")
|
||||||
}
|
}
|
||||||
else sendDialogue(player, "It looks like the melting pot is already full of ore!")
|
else sendDialogue(player, "It looks like the melting pot is already full of ore!")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}else if (button == 2 && rocksInInven.isEmpty()){
|
} else if (button == 2 && rocksInInventory.isEmpty()){
|
||||||
sendDialogue(player,"I should make sure that I have some ore before doing this.")
|
sendDialogue(player,"I should make sure that I have some ore before doing this.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -229,7 +232,7 @@ class BlastFurnaceListeners : InteractionListener {
|
|||||||
/**Added this because clicking on ore then the belt and getting "Nothing interesting happens" is annoying
|
/**Added this because clicking on ore then the belt and getting "Nothing interesting happens" is annoying
|
||||||
* it's essentially the same thing as above except without the dialogue because if you're clicking on ore
|
* it's essentially the same thing as above except without the dialogue because if you're clicking on ore
|
||||||
* and trying to use it on the conveyor belt then you know what you're trying to do.*/
|
* and trying to use it on the conveyor belt then you know what you're trying to do.*/
|
||||||
onUseWith(IntType.SCENERY,conveyorLoad,*playerOre){ player, _, oreType ->
|
onUseWith(SCENERY,playerOre,conveyorLoad){ player, oreType, _ ->
|
||||||
val amountInInventory = player.inventory.getAmount(oreType.id)
|
val amountInInventory = player.inventory.getAmount(oreType.id)
|
||||||
val spaceForCoal = player.blastCoal.freeSlots()
|
val spaceForCoal = player.blastCoal.freeSlots()
|
||||||
val spaceForOre = player.blastOre.freeSlots()
|
val spaceForOre = player.blastOre.freeSlots()
|
||||||
@@ -259,9 +262,13 @@ class BlastFurnaceListeners : InteractionListener {
|
|||||||
val bar = Bar.forOre(oreType.id)
|
val bar = Bar.forOre(oreType.id)
|
||||||
if(oreType.id == Items.COAL_453) {
|
if(oreType.id == Items.COAL_453) {
|
||||||
if (amountToAdd > 0 && getStatLevel(player, Skills.SMITHING) >= 30) {
|
if (amountToAdd > 0 && getStatLevel(player, Skills.SMITHING) >= 30) {
|
||||||
player.blastCoal.add(Item(oreType.id,amountToAdd))
|
if(removeItem(player, Item(oreType.id, amountToAdd), Container.INVENTORY) && player.blastCoal.add(Item(oreType.id,amountToAdd))) {
|
||||||
removeItem(player, Item(oreType.id, amountToAdd), Container.INVENTORY)
|
BlastFurnaceOre(
|
||||||
BlastFurnaceOre(player, BFOreVariant.values()[playerOre.indexOf(oreType.id)],amountToAdd).init()
|
player,
|
||||||
|
BFOreVariant.values()[playerOre.indexOf(oreType.id)],
|
||||||
|
amountToAdd
|
||||||
|
).init()
|
||||||
|
}
|
||||||
}else if(getStatLevel(player,Skills.SMITHING) < 30){
|
}else if(getStatLevel(player,Skills.SMITHING) < 30){
|
||||||
sendDialogue(player,"My Smithing level is not high enough to use Coal!")
|
sendDialogue(player,"My Smithing level is not high enough to use Coal!")
|
||||||
}
|
}
|
||||||
@@ -281,14 +288,14 @@ class BlastFurnaceListeners : InteractionListener {
|
|||||||
|
|
||||||
/**This handles interacting with the temperature gauge on the furnace*/
|
/**This handles interacting with the temperature gauge on the furnace*/
|
||||||
|
|
||||||
on(tGauge, IntType.SCENERY, "read") { player, node ->
|
on(tGauge, SCENERY, "read") { player, _ ->
|
||||||
player.interfaceManager.openComponent(30)
|
player.interfaceManager.openComponent(30)
|
||||||
return@on true
|
return@on true
|
||||||
}
|
}
|
||||||
|
|
||||||
/**This handles taking bars from the dispenser*/
|
/**This handles taking bars from the dispenser*/
|
||||||
|
|
||||||
on(dispenser, IntType.SCENERY, "search", "take"){ player, node ->
|
on(dispenser,SCENERY,"search", "take"){ player, _ ->
|
||||||
if(player.varpManager.get(543).getVarbitValue(8) == 0 || player.varpManager.get(543).getVarbitValue(8) == 3) {
|
if(player.varpManager.get(543).getVarbitValue(8) == 0 || player.varpManager.get(543).getVarbitValue(8) == 3) {
|
||||||
player.interfaceManager.openComponent(28)
|
player.interfaceManager.openComponent(28)
|
||||||
}
|
}
|
||||||
@@ -297,7 +304,7 @@ class BlastFurnaceListeners : InteractionListener {
|
|||||||
|
|
||||||
/**Handles using a bucket of water on the bar dispenser*/
|
/**Handles using a bucket of water on the bar dispenser*/
|
||||||
|
|
||||||
onUseWith(IntType.SCENERY,dispenser,Items.BUCKET_OF_WATER_1929){ player, used, with ->
|
onUseWith(SCENERY,Items.BUCKET_OF_WATER_1929,*dispenser){ player, _, _ ->
|
||||||
when {
|
when {
|
||||||
player.varpManager.get(543).getVarbitValue(8) == 2 -> {
|
player.varpManager.get(543).getVarbitValue(8) == 2 -> {
|
||||||
removeItem(player,Items.BUCKET_OF_WATER_1929,Container.INVENTORY)
|
removeItem(player,Items.BUCKET_OF_WATER_1929,Container.INVENTORY)
|
||||||
@@ -318,9 +325,9 @@ class BlastFurnaceListeners : InteractionListener {
|
|||||||
return@onUseWith true
|
return@onUseWith true
|
||||||
}
|
}
|
||||||
|
|
||||||
/**The sequel to Limp Bizkits hit single, "Fix shit"*/
|
/**Handles pipe repairing*/
|
||||||
|
|
||||||
on(brokenPotPipe, IntType.SCENERY, "repair"){ player, _ ->
|
on(brokenPotPipe,SCENERY,"repair"){ player, _ ->
|
||||||
if(player.getSkills().getLevel(Skills.CRAFTING) >= 30){
|
if(player.getSkills().getLevel(Skills.CRAFTING) >= 30){
|
||||||
if(inInventory(player,Items.HAMMER_2347,1)) {
|
if(inInventory(player,Items.HAMMER_2347,1)) {
|
||||||
rewardXP(player, Skills.CRAFTING, 50.0)
|
rewardXP(player, Skills.CRAFTING, 50.0)
|
||||||
@@ -330,12 +337,12 @@ class BlastFurnaceListeners : InteractionListener {
|
|||||||
sendMessage(player, "I need a hammer to do this!")
|
sendMessage(player, "I need a hammer to do this!")
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
sendDialogue(player,"I need 30 Craft in order to do this")
|
sendDialogue(player,"I need 30 Crafting in order to do this")
|
||||||
}
|
}
|
||||||
return@on true
|
return@on true
|
||||||
}
|
}
|
||||||
|
|
||||||
on(brokenPumpPipe, IntType.SCENERY, "repair"){ player, _ ->
|
on(brokenPumpPipe,SCENERY, "repair"){ player, _ ->
|
||||||
if(player.getSkills().getLevel(Skills.CRAFTING) >= 30){
|
if(player.getSkills().getLevel(Skills.CRAFTING) >= 30){
|
||||||
if(inInventory(player,Items.HAMMER_2347,1)) {
|
if(inInventory(player,Items.HAMMER_2347,1)) {
|
||||||
rewardXP(player, Skills.CRAFTING, 50.0)
|
rewardXP(player, Skills.CRAFTING, 50.0)
|
||||||
@@ -345,12 +352,12 @@ class BlastFurnaceListeners : InteractionListener {
|
|||||||
sendMessage(player, "I need a hammer to do this!")
|
sendMessage(player, "I need a hammer to do this!")
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
sendDialogue(player,"I need 30 Craft in order to do this")
|
sendDialogue(player,"I need 30 Crafting in order to do this")
|
||||||
}
|
}
|
||||||
return@on true
|
return@on true
|
||||||
}
|
}
|
||||||
|
|
||||||
on(brokenBelt, IntType.SCENERY, "repair"){ player, _ ->
|
on(brokenBelt,SCENERY,"repair"){ player, _ ->
|
||||||
if(player.getSkills().getLevel(Skills.CRAFTING) >= 30){
|
if(player.getSkills().getLevel(Skills.CRAFTING) >= 30){
|
||||||
if(inInventory(player,Items.HAMMER_2347,1)) {
|
if(inInventory(player,Items.HAMMER_2347,1)) {
|
||||||
rewardXP(player, Skills.CRAFTING, 50.0)
|
rewardXP(player, Skills.CRAFTING, 50.0)
|
||||||
@@ -360,12 +367,12 @@ class BlastFurnaceListeners : InteractionListener {
|
|||||||
sendMessage(player, "I need a hammer to do this!")
|
sendMessage(player, "I need a hammer to do this!")
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
sendDialogue(player,"I need 30 Craft in order to do this")
|
sendDialogue(player,"I need 30 Crafting in order to do this")
|
||||||
}
|
}
|
||||||
return@on true
|
return@on true
|
||||||
}
|
}
|
||||||
|
|
||||||
on(brokenCog, IntType.SCENERY, "repair"){ player, _ ->
|
on(brokenCog,SCENERY,"repair"){ player, _ ->
|
||||||
if(player.getSkills().getLevel(Skills.CRAFTING) >= 30){
|
if(player.getSkills().getLevel(Skills.CRAFTING) >= 30){
|
||||||
if(inInventory(player,Items.HAMMER_2347,1)) {
|
if(inInventory(player,Items.HAMMER_2347,1)) {
|
||||||
rewardXP(player, Skills.CRAFTING, 50.0)
|
rewardXP(player, Skills.CRAFTING, 50.0)
|
||||||
|
|||||||
@@ -2,11 +2,9 @@ package content.minigame.blastfurnace
|
|||||||
|
|
||||||
import core.api.*
|
import core.api.*
|
||||||
import core.game.node.entity.Entity
|
import core.game.node.entity.Entity
|
||||||
import core.game.node.entity.player.Player
|
|
||||||
import core.game.world.map.zone.MapZone
|
import core.game.world.map.zone.MapZone
|
||||||
import core.game.world.map.zone.ZoneBorders
|
import core.game.world.map.zone.ZoneBorders
|
||||||
import core.game.world.map.zone.ZoneBuilder
|
import core.game.world.map.zone.ZoneBuilder
|
||||||
import core.game.world.map.zone.ZoneMonitor
|
|
||||||
import core.plugin.Initializable
|
import core.plugin.Initializable
|
||||||
import core.plugin.Plugin
|
import core.plugin.Plugin
|
||||||
|
|
||||||
@@ -16,7 +14,7 @@ import core.plugin.Plugin
|
|||||||
|
|
||||||
|
|
||||||
//Remove this once the funny dupe gets fixed
|
//Remove this once the funny dupe gets fixed
|
||||||
//@Initializable
|
@Initializable
|
||||||
class BlastFurnaceZone : MapZone("Blast Furnace Zone",true), Plugin<Any> {
|
class BlastFurnaceZone : MapZone("Blast Furnace Zone",true), Plugin<Any> {
|
||||||
|
|
||||||
var pulseStarted = false
|
var pulseStarted = false
|
||||||
|
|||||||
Reference in New Issue
Block a user