Redwings Content Drop: Blast Furnace, Secondary Banks, Seers Diary
This commit is contained in:
@@ -0,0 +1,405 @@
|
||||
package rs09.game.content.activity.blastfurnace
|
||||
|
||||
import api.*
|
||||
import core.game.container.impl.EquipmentContainer
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.entity.skill.Skills
|
||||
import core.game.node.item.Item
|
||||
import core.game.system.task.Pulse
|
||||
import core.game.world.map.Location
|
||||
import core.tools.RandomFunction
|
||||
import org.rs09.consts.Items
|
||||
import org.rs09.consts.Items.GOLDSMITH_GAUNTLETS_776
|
||||
|
||||
/**le Blast Furnace has arrived:
|
||||
* Handles most of the Blast Furnace's operating logic, there is some crosstalk between
|
||||
* this file and BlastFurnaceListeners.kt as well as the BlastFurnaceZone.kt.
|
||||
* This also handles a lot of the varbit fuckery for the furnace. The other
|
||||
* varbit fuckery is handled in BlastFurnaceListeners.
|
||||
* Varbits are still slightly busted but not in a way that breaks the operation or usage of
|
||||
* Blast Furnace, just visual and I've had enough of the funny binary numbers to say fuck it
|
||||
* and will just come back to it at a later date.
|
||||
* @author phil lips*/
|
||||
|
||||
object BlastFurnace {
|
||||
|
||||
val belt1 = getScenery(1943, 4967, 0)
|
||||
val belt2 = getScenery(1943, 4966, 0)
|
||||
val belt3 = getScenery(1943, 4965, 0)
|
||||
val disLoc = getScenery(1941, 4963, 0)
|
||||
var pipe1 = getScenery(1943, 4961, 0)
|
||||
var pipe2 = getScenery(1947, 4961, 0)
|
||||
var cogs1 = getScenery(1945, 4965, 0)
|
||||
var cogs2 = getScenery(1945, 4967, 0)
|
||||
var beltLoc1 = getScenery(1944, 4965, 0)
|
||||
var beltLoc2 = getScenery(1944, 4967, 0)
|
||||
var gearsLoc = getScenery(1945, 4966, 0)
|
||||
var stoveLoc = getScenery(1948, 4963, 0)
|
||||
|
||||
val mPot = 9098
|
||||
|
||||
var gaugeViewList = ArrayList<Player>()
|
||||
var blastFurnacePlayerList = ArrayList<Player>()
|
||||
var furnaceTemp = 0
|
||||
var pumpPipeBroken = false
|
||||
var potPipeBroken = false
|
||||
var stoveCoke = 0
|
||||
var stoveTemp = 0
|
||||
var beltRunning = false
|
||||
var makeBars = false
|
||||
var beltBroken = false
|
||||
var cogBroken = false
|
||||
var pumping = false
|
||||
var pedaling = false
|
||||
var barsHot = false
|
||||
var giveSmithXp = 0
|
||||
|
||||
/**This pulse object handles checks between*/
|
||||
var blastPulse = object : Pulse() {
|
||||
override fun pulse(): Boolean {
|
||||
gaugeViewList.forEach {
|
||||
var anim = furnaceTemp + 2452
|
||||
animateInterface(it, 30, 4, anim)
|
||||
}
|
||||
blastFurnacePlayerList.forEach {
|
||||
if(it.getAttribute("BlastTimer",0) > 0 && it.getSkills().getLevel(Skills.SMITHING) < 60){
|
||||
it.incrementAttribute("BlastTimer",-1)
|
||||
} else if(it.getAttribute("BlastTimer",0) <= 0 && it.getSkills().getLevel(Skills.SMITHING) < 60){
|
||||
it.removeAttribute("BlastTimer")
|
||||
sendDialogue(it,"Your time in the Blast Furnace has run out!")
|
||||
it.properties.teleportLocation = Location.create(2931, 10197, 0)
|
||||
} else if(it.getAttribute("BlastTimer",false) && it.getSkills().getLevel(Skills.SMITHING) >= 60){
|
||||
it.removeAttribute("BlastTimer")
|
||||
}
|
||||
if(giveSmithXp > 0){
|
||||
rewardXP(it,Skills.SMITHING,1.0)
|
||||
giveSmithXp--
|
||||
}
|
||||
}
|
||||
interfaceManager()
|
||||
runConveyor()
|
||||
stoveCokeTemperature()
|
||||
furnaceTemperature()
|
||||
operateFurnace()
|
||||
breakStuff()
|
||||
fixStuff()
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
/**This handles the coke stove temperature, if there is coke in the
|
||||
* coke oven the temperature will raise, otherwise the temperature
|
||||
* will lower, 0-33 is cold, 34-66 is warm, 67-100 is hot*/
|
||||
fun stoveCokeTemperature() {
|
||||
if (getWorldTicks() % 10 == 0 && stoveCoke > 0) {
|
||||
stoveCoke--
|
||||
}
|
||||
if (stoveCoke > 0) {
|
||||
if (stoveTemp < 100) {
|
||||
stoveTemp += 1
|
||||
}
|
||||
} else if (stoveTemp > 0) {
|
||||
stoveTemp--
|
||||
}
|
||||
if (stoveTemp > 66 && stoveLoc!!.id != 9087) {
|
||||
stoveLoc = getScenery(1948, 4963, 0)
|
||||
replaceScenery(stoveLoc!!, 9087, -1)
|
||||
} else if (stoveTemp in 34..66 && stoveLoc!!.id != 9086) {
|
||||
stoveLoc = getScenery(1948, 4963, 0)
|
||||
replaceScenery(stoveLoc!!, 9086, -1)
|
||||
} else if (stoveTemp < 32 && stoveLoc!!.id != 9085) {
|
||||
stoveLoc = getScenery(1948, 4963, 0)
|
||||
replaceScenery(stoveLoc!!, 9085, -1)
|
||||
}
|
||||
}
|
||||
|
||||
/**This handles the raising and lowering of the furnace temperature
|
||||
* depending on whether or not the coke stove is hot and if the
|
||||
* furnace pump is being operated. A hot coke stove will raise the
|
||||
* temperature the fastest, a warm coke stove will raise it slowly,
|
||||
* and a cold stove will raise it the slowest*/
|
||||
fun furnaceTemperature() {
|
||||
if (stoveTemp >= 67 && pumping && furnaceTemp < 100 && (!pumpPipeBroken || !pumpPipeBroken)) {
|
||||
furnaceTemp += 3
|
||||
} else if (stoveTemp >= 34 && pumping && furnaceTemp < 100 && (!pumpPipeBroken || !pumpPipeBroken)) {
|
||||
furnaceTemp += 2
|
||||
} else if (stoveTemp > 0 && pumping && furnaceTemp < 100 && (!pumpPipeBroken || !pumpPipeBroken)) {
|
||||
furnaceTemp += 1
|
||||
} else if (furnaceTemp > 0 && getWorldTicks() % 2 == 0) {
|
||||
furnaceTemp -= 2
|
||||
}
|
||||
}
|
||||
|
||||
/**Tells the furnace whether or not to smelt bars depending on if
|
||||
* the furnace temperature is in the right range. Also contains the
|
||||
* logic for smelting the players ore given the fact that they actually
|
||||
* have ore in their ore container and/or have coal in their coal container*/
|
||||
fun operateFurnace() {
|
||||
makeBars = furnaceTemp in 51..66
|
||||
blastFurnacePlayerList.forEach { player ->
|
||||
var playerCoal = player.blastCoal.getAmount(Items.COAL_453)
|
||||
var playerOre = player.blastOre.toArray().filterNotNull()
|
||||
var barsAmountFree = player.blastBars.freeSlots()
|
||||
var barsAmount = player.blastBars.itemCount()
|
||||
var oreAmount = player.blastOre.itemCount()
|
||||
var totalAmount = barsAmount + oreAmount
|
||||
if (barsHot) {
|
||||
player.varpManager.get(543).setVarbit(8, 2).send(player)
|
||||
}else if (makeBars && playerOre.isNotEmpty() && barsAmountFree > 0 && totalAmount < 56 && player.getAttribute("OreInPot",false) == true) {
|
||||
playerOre.forEach { oreID ->
|
||||
playerCoal = player.blastCoal.getAmount(Items.COAL_453)
|
||||
if (oreID.id == Items.RUNITE_ORE_451 && player.blastOre.getAmount(451) * 4 <= playerCoal) {
|
||||
player.varpManager.get(543).setVarbit(8, 1).send(player)
|
||||
barsHot = true
|
||||
player.blastBars.add(Item(Items.RUNITE_BAR_2363, 1))
|
||||
player.blastOre.remove(Item(Items.RUNITE_ORE_451, 1))
|
||||
rewardXP(player, Skills.SMITHING,50.0)
|
||||
player.blastCoal.remove(Item(453, 4))
|
||||
totalAmount = barsAmount + oreAmount
|
||||
giveSmithXp++
|
||||
}
|
||||
else if (oreID.id == Items.ADAMANTITE_ORE_449 && player.blastOre.getAmount(449) * 3 <= playerCoal) {
|
||||
player.varpManager.get(543).setVarbit(8, 1).send(player)
|
||||
barsHot = true
|
||||
player.blastBars.add(Item(Items.ADAMANTITE_BAR_2361, 1))
|
||||
player.blastOre.remove(Item(Items.ADAMANTITE_ORE_449, 1))
|
||||
rewardXP(player, Skills.SMITHING,37.5)
|
||||
player.blastCoal.remove(Item(453, 3))
|
||||
totalAmount = barsAmount + oreAmount
|
||||
giveSmithXp++
|
||||
}
|
||||
else if (oreID.id == Items.MITHRIL_ORE_447 && player.blastOre.getAmount(447) * 2 <= playerCoal) {
|
||||
player.varpManager.get(543).setVarbit(8, 1).send(player)
|
||||
barsHot = true
|
||||
player.blastBars.add(Item(Items.MITHRIL_BAR_2359, 1))
|
||||
player.blastOre.remove(Item(Items.MITHRIL_ORE_447, 1))
|
||||
rewardXP(player, Skills.SMITHING,30.0)
|
||||
player.blastCoal.remove(Item(453, 2))
|
||||
totalAmount = barsAmount + oreAmount
|
||||
giveSmithXp++
|
||||
}
|
||||
else if (oreID.id == Items.IRON_ORE_440 && player.blastOre.getAmount(447) <= playerCoal) {
|
||||
player.varpManager.get(543).setVarbit(8, 1).send(player)
|
||||
barsHot = true
|
||||
player.blastBars.add(Item(Items.STEEL_BAR_2353, 1))
|
||||
player.blastOre.remove(Item(Items.MITHRIL_ORE_447, 1))
|
||||
rewardXP(player, Skills.SMITHING,17.5)
|
||||
player.blastCoal.remove(Item(453, 1))
|
||||
totalAmount = barsAmount + oreAmount
|
||||
giveSmithXp++
|
||||
}
|
||||
else if (oreID.id == Items.IRON_ORE_440) {
|
||||
player.varpManager.get(543).setVarbit(8, 1).send(player)
|
||||
barsHot = true
|
||||
player.blastBars.add(Item(Items.IRON_BAR_2351, 1))
|
||||
player.blastOre.remove(Item(Items.IRON_ORE_440, 1))
|
||||
rewardXP(player, Skills.SMITHING,12.5)
|
||||
totalAmount = barsAmount + oreAmount
|
||||
giveSmithXp++
|
||||
}
|
||||
else if (oreID.id == Items.SILVER_ORE_442) {
|
||||
player.varpManager.get(543).setVarbit(8, 1).send(player)
|
||||
barsHot = true
|
||||
player.blastBars.add(Item(Items.SILVER_BAR_2355, 1))
|
||||
rewardXP(player, Skills.SMITHING,13.6)
|
||||
player.blastOre.remove(Item(Items.SILVER_ORE_442, 1))
|
||||
totalAmount = barsAmount + oreAmount
|
||||
giveSmithXp++
|
||||
}
|
||||
else if (oreID.id == Items.GOLD_ORE_444) {
|
||||
player.varpManager.get(543).setVarbit(8, 1).send(player)
|
||||
barsHot = true
|
||||
player.blastBars.add(Item(Items.GOLD_BAR_2357, 1))
|
||||
if((player.equipment[EquipmentContainer.SLOT_HANDS] != null && player.equipment[EquipmentContainer.SLOT_HANDS].id == GOLDSMITH_GAUNTLETS_776)){
|
||||
rewardXP(player, Skills.SMITHING,56.2)
|
||||
}else{
|
||||
rewardXP(player, Skills.SMITHING,22.5)
|
||||
}
|
||||
player.blastOre.remove(Item(Items.GOLD_ORE_444, 1))
|
||||
totalAmount = barsAmount + oreAmount
|
||||
giveSmithXp++
|
||||
}
|
||||
else if (oreID.id == Items.COPPER_ORE_436 && player.blastOre.containsAtLeastOneItem(438)) {
|
||||
player.varpManager.get(543).setVarbit(8, 1).send(player)
|
||||
barsHot = true
|
||||
player.blastOre.remove(Item(Items.TIN_ORE_438, 1))
|
||||
player.blastOre.remove(Item(Items.COPPER_ORE_436, 1))
|
||||
player.blastBars.add(Item(Items.BRONZE_BAR_2349, 1))
|
||||
rewardXP(player, Skills.SMITHING,6.2)
|
||||
totalAmount = barsAmount + oreAmount
|
||||
giveSmithXp++
|
||||
}
|
||||
else if(oreID.id == Items.TIN_ORE_438 && player.blastOre.containsAtLeastOneItem(436)){
|
||||
player.varpManager.get(543).setVarbit(8, 1).send(player)
|
||||
barsHot = true
|
||||
player.blastOre.remove(Item(Items.COPPER_ORE_436, 1))
|
||||
player.blastOre.remove(Item(Items.TIN_ORE_438, 1))
|
||||
player.blastBars.add(Item(Items.BRONZE_BAR_2349, 1))
|
||||
rewardXP(player, Skills.SMITHING,6.2)
|
||||
totalAmount = barsAmount + oreAmount
|
||||
giveSmithXp++
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!barsHot && playerOre.isNotEmpty()) {
|
||||
var coalToAdd = 0
|
||||
playerOre.forEach { oreID ->
|
||||
when(oreID.id){
|
||||
Items.RUNITE_ORE_451 -> coalToAdd = (player.blastOre.getAmount(451) * 4) - playerCoal
|
||||
Items.ADAMANTITE_ORE_449 -> coalToAdd = (player.blastOre.getAmount(449) * 3) - playerCoal
|
||||
Items.MITHRIL_ORE_447 -> coalToAdd = (player.blastOre.getAmount(447) * 2) - playerCoal
|
||||
Items.IRON_ORE_440 -> coalToAdd = player.blastOre.getAmount(440) - playerCoal
|
||||
}
|
||||
}
|
||||
if (coalToAdd < 0){
|
||||
player.varpManager.get(543).setVarbit(12, 0).send(player)
|
||||
} else player.varpManager.get(543).setVarbit(12, coalToAdd).send(player)
|
||||
}
|
||||
else if(playerOre.isEmpty()) {
|
||||
player.varpManager.get(543).setVarbit(12,0).send(player)
|
||||
}
|
||||
if(playerOre.isEmpty() && player.getAttribute("OreInPot",false)){
|
||||
player.removeAttribute("OreInPot")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**This handles the conveyor belt, if the pedals are running and the belt
|
||||
* isn't broken then the conveyor belt will run*/
|
||||
fun runConveyor() {
|
||||
if (pedaling && (!beltBroken && !cogBroken)) {
|
||||
animateScenery(belt1!!, 2435)
|
||||
animateScenery(belt2!!, 2435)
|
||||
animateScenery(belt3!!, 2435)
|
||||
animateScenery(beltLoc1!!, 2436)
|
||||
animateScenery(beltLoc2!!, 2436)
|
||||
animateScenery(cogs1!!, 2436)
|
||||
animateScenery(cogs2!!, 2436)
|
||||
animateScenery(gearsLoc!!, 2436)
|
||||
beltRunning = true
|
||||
} else {
|
||||
animateScenery(belt1!!, -1)
|
||||
animateScenery(belt2!!, -1)
|
||||
animateScenery(belt3!!, -1)
|
||||
animateScenery(beltLoc1!!, -1)
|
||||
animateScenery(beltLoc2!!, -1)
|
||||
animateScenery(cogs1!!, -1)
|
||||
animateScenery(cogs2!!, -1)
|
||||
animateScenery(gearsLoc!!, -1)
|
||||
beltRunning = false
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**Its just one of those days*/
|
||||
fun breakStuff() {
|
||||
if (pumping && furnaceTemp > 76) {
|
||||
if (RandomFunction.random(1, 100) > 20 && (!potPipeBroken || !pumpPipeBroken)) {
|
||||
if (RandomFunction.random(1, 100) > 50 && !potPipeBroken) {
|
||||
pipe1 = getScenery(1943, 4961, 0)
|
||||
potPipeBroken = true
|
||||
}
|
||||
if (RandomFunction.random(1, 100) <= 50 && !pumpPipeBroken) {
|
||||
pipe2 = getScenery(1947, 4961, 0)
|
||||
pumpPipeBroken = true
|
||||
}
|
||||
}
|
||||
}
|
||||
if (beltRunning && (!beltBroken || !cogBroken)) {
|
||||
if (RandomFunction.random(1, 100) <= 2) {
|
||||
beltLoc2 = getScenery(1944, 4967, 0)
|
||||
beltBroken = true
|
||||
} else if (RandomFunction.random(1, 100) <= 2) {
|
||||
cogs2 = getScenery(1945, 4967, 0)
|
||||
cogBroken = true
|
||||
}
|
||||
}
|
||||
if (beltBroken && beltLoc2!!.id != 9103) {
|
||||
beltLoc2 = getScenery(1944, 4967, 0)
|
||||
replaceScenery(beltLoc2!!, 9103, -1)
|
||||
}
|
||||
if (cogBroken && cogs2!!.id != 9105) {
|
||||
cogs2 = getScenery(1945, 4967, 0)
|
||||
replaceScenery(cogs2!!, 9105, -1)
|
||||
}
|
||||
if (potPipeBroken && pipe1!!.id != 9117) {
|
||||
pipe1 = getScenery(1943, 4961, 0)
|
||||
replaceScenery(pipe1!!, 9117, -1)
|
||||
}
|
||||
if (pumpPipeBroken && pipe2!!.id != 9121) {
|
||||
pipe2 = getScenery(1947, 4961, 0)
|
||||
replaceScenery(pipe2!!, 9121, -1)
|
||||
}
|
||||
}
|
||||
|
||||
/**This replaces the breakable objects IDs back to their unbroken state*/
|
||||
fun fixStuff() {
|
||||
if (!potPipeBroken && pipe1!!.id != 9116) {
|
||||
pipe1 = getScenery(1943, 4961, 0)
|
||||
replaceScenery(pipe1!!, 9116, -1)
|
||||
}
|
||||
if (!pumpPipeBroken && pipe2!!.id != 9120) {
|
||||
pipe2 = getScenery(1947, 4961, 0)
|
||||
replaceScenery(pipe2!!, 9120, -1)
|
||||
}
|
||||
if (!beltBroken && beltLoc2!!.id != 9102) {
|
||||
beltLoc2 = getScenery(1944, 4967, 0)
|
||||
replaceScenery(beltLoc2!!, 9102, -1)
|
||||
}
|
||||
if (!cogBroken && cogs2!!.id != 9104) {
|
||||
cogs2 = getScenery(1945, 4967, 0)
|
||||
replaceScenery(cogs2!!, 9104, -1)
|
||||
}
|
||||
}
|
||||
|
||||
/**Hi kids!
|
||||
* Do you like Varbits?
|
||||
* 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???*/
|
||||
|
||||
fun interfaceManager() {
|
||||
var playerBars = listOf<Item>()
|
||||
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
|
||||
blastFurnacePlayerList.forEach { player ->
|
||||
playerBars = player.blastBars.toArray().filterNotNull()
|
||||
var barAmount = player.blastBars.toArray().filterNotNull().count()
|
||||
var updateInterface = true
|
||||
if (playerBars.isNotEmpty() && updateInterface) {
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
if (barTotal > barAmount) {
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
package rs09.game.content.activity.blastfurnace
|
||||
|
||||
import api.*
|
||||
import core.game.node.item.Item
|
||||
import org.rs09.consts.Components
|
||||
import org.rs09.consts.Items
|
||||
import rs09.game.interaction.InterfaceListener
|
||||
|
||||
/**
|
||||
* Handles the blast furnace bar stock interface.
|
||||
* @author definitely phil who didn't get help from ceikry at all haha :)
|
||||
* @version 69.0
|
||||
*/
|
||||
class BlastFurnaceInterfaceListener : InterfaceListener() {
|
||||
|
||||
override fun defineListeners() {
|
||||
|
||||
on(Components.BLAST_FURNACE_BAR_STOCK_28){ player, _, _, buttonID, _, _ ->
|
||||
val bar = BFBars.forId(buttonID) ?: return@on false
|
||||
val isAll = buttonID == bar.allButtonId
|
||||
val playerAmt = player.varpManager.get(bar.varpIndex).getVarbitValue(bar.offset)
|
||||
if(playerAmt == 0) return@on true
|
||||
|
||||
var amtToWithdraw = if(isAll) playerAmt else 1
|
||||
|
||||
if(freeSlots(player) < amtToWithdraw){
|
||||
amtToWithdraw = freeSlots(player)
|
||||
}
|
||||
|
||||
val barItemId = when(bar){
|
||||
BFBars.BRONZE -> Items.BRONZE_BAR_2349
|
||||
BFBars.IRON -> Items.IRON_BAR_2351
|
||||
BFBars.STEEL -> Items.STEEL_BAR_2353
|
||||
BFBars.MITHRIL -> Items.MITHRIL_BAR_2359
|
||||
BFBars.ADAMANT -> Items.ADAMANTITE_BAR_2361
|
||||
BFBars.RUNITE -> Items.RUNITE_BAR_2363
|
||||
BFBars.SILVER -> Items.SILVER_BAR_2355
|
||||
BFBars.GOLD -> Items.GOLD_BAR_2357
|
||||
}
|
||||
|
||||
player.varpManager.get(bar.varpIndex).setVarbit(bar.offset, playerAmt - amtToWithdraw).send(player)
|
||||
|
||||
addItem(player, barItemId, amtToWithdraw)
|
||||
while(amtToWithdraw > 0){
|
||||
player.blastBars.remove(Item(barItemId))
|
||||
amtToWithdraw--
|
||||
}
|
||||
if(player.blastBars.isEmpty) player.varpManager.get(543).clear().send(player)
|
||||
return@on true
|
||||
}
|
||||
}
|
||||
|
||||
internal enum class BFBars(val buttonId: Int, val varpIndex: Int, val offset: Int, val allButtonId: Int = buttonId + 2){
|
||||
BRONZE(43, 545, 0, 44),
|
||||
IRON(40, 545, 8, 41),
|
||||
STEEL(36, 545, 16),
|
||||
MITHRIL(33, 545, 24),
|
||||
ADAMANT(30, 546, 0),
|
||||
RUNITE(27, 546, 8),
|
||||
SILVER(24, 546, 24),
|
||||
GOLD(21, 546, 16);
|
||||
|
||||
companion object {
|
||||
private val idMap = values().map { it.buttonId to it }.toMap()
|
||||
|
||||
fun forId(buttonId: Int): BFBars? {
|
||||
return idMap[buttonId] ?: idMap[buttonId - 2] ?: idMap[buttonId - 1]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+504
@@ -0,0 +1,504 @@
|
||||
package rs09.game.content.activity.blastfurnace
|
||||
|
||||
import api.Container
|
||||
import api.*
|
||||
import core.game.node.entity.skill.Skills
|
||||
import core.game.node.item.Item
|
||||
import core.game.system.task.Pulse
|
||||
import rs09.game.interaction.InteractionListener
|
||||
import core.game.world.map.Location
|
||||
import org.rs09.consts.Items
|
||||
import rs09.game.node.entity.npc.other.BFOreVariant
|
||||
import rs09.game.node.entity.npc.other.BlastFurnaceOre
|
||||
|
||||
/**"Most" of the listeners for blast furnace live in this funny little file, handles
|
||||
* 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.
|
||||
* That lives in OrdanDialogue.kt
|
||||
* @author phil lips*/
|
||||
|
||||
class BlastFurnaceListeners : InteractionListener() {
|
||||
|
||||
val disLoc = getScenery(1941, 4963, 0)
|
||||
val brokenPotPipe = 9117
|
||||
val brokenPumpPipe = 9121
|
||||
val pump = 9090
|
||||
val stove = intArrayOf(9085, 9086, 9087)
|
||||
val coke = 9088
|
||||
val pedals = 9097
|
||||
val conveyorLoad = 9100
|
||||
val dispenser = intArrayOf(9093, 9094, 9095, 9096)
|
||||
val brokenBelt = 9103
|
||||
val brokenCog = 9105
|
||||
val tGauge = 9089
|
||||
val playerOre = intArrayOf(
|
||||
Items.IRON_ORE_440,
|
||||
Items.COPPER_ORE_436,
|
||||
Items.TIN_ORE_438,
|
||||
Items.COAL_453,
|
||||
Items.MITHRIL_ORE_447,
|
||||
Items.ADAMANTITE_ORE_449,
|
||||
Items.SILVER_ORE_442,
|
||||
Items.GOLD_ORE_444,
|
||||
Items.RUNITE_ORE_451
|
||||
)
|
||||
val notedOre = intArrayOf(
|
||||
Items.IRON_ORE_441,
|
||||
Items.COPPER_ORE_437,
|
||||
Items.TIN_ORE_439,
|
||||
Items.COAL_454,
|
||||
Items.MITHRIL_ORE_448,
|
||||
Items.ADAMANTITE_ORE_450,
|
||||
Items.SILVER_ORE_443,
|
||||
Items.GOLD_ORE_445,
|
||||
Items.RUNITE_ORE_452
|
||||
)
|
||||
|
||||
override fun defineListeners() {
|
||||
|
||||
/**FINALLY AFK STRENGTH TRAINING*/
|
||||
|
||||
on(pump, SCENERY, "operate") { player, node ->
|
||||
if(player.getSkills().getLevel(Skills.STRENGTH) >= 30) {
|
||||
val pumpL = Location(1950, 4961, 0)
|
||||
val pumpF = Location(1949, 4961, 0)
|
||||
player.properties.teleportLocation = pumpL
|
||||
submitIndividualPulse(player, object : Pulse() {
|
||||
override fun pulse(): Boolean {
|
||||
face(player, pumpF,)
|
||||
animate(player, 2432)
|
||||
BlastFurnace.pumping = true
|
||||
if (!BlastFurnace.pumpPipeBroken || !BlastFurnace.potPipeBroken) rewardXP(
|
||||
player,
|
||||
Skills.STRENGTH,
|
||||
4.0
|
||||
)
|
||||
return false
|
||||
}
|
||||
|
||||
override fun stop() {
|
||||
BlastFurnace.pumping = false
|
||||
super.stop()
|
||||
}
|
||||
})
|
||||
}else{
|
||||
sendDialogue(player,"I need 30 Strength to do this!")
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
|
||||
/**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.*/
|
||||
|
||||
on(pedals, SCENERY, "pedal") { player, node ->
|
||||
if(player.getSkills().getLevel(Skills.AGILITY) >= 30) {
|
||||
val pedalL = Location(1947, 4966, 0)
|
||||
val pedalF = Location(1946, 4966, 0)
|
||||
player.properties.teleportLocation = pedalL
|
||||
submitIndividualPulse(player, object : Pulse() {
|
||||
override fun pulse(): Boolean {
|
||||
face(player, pedalF,)
|
||||
animate(player, 2433)
|
||||
BlastFurnace.pedaling = true
|
||||
if (BlastFurnace.beltRunning) rewardXP(player, Skills.AGILITY, 2.0)
|
||||
return false
|
||||
}
|
||||
override fun stop() {
|
||||
BlastFurnace.pedaling = false
|
||||
super.stop()
|
||||
}
|
||||
})
|
||||
}else{
|
||||
sendDialogue(player,"I need 30 Agility to do this!")
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
|
||||
/**Lets players use a spade to take coke from the pile of coke*/
|
||||
|
||||
on(coke, SCENERY, "collect") { player, node ->
|
||||
if (inInventory(player, Items.SPADE_952, 1)) {
|
||||
animate(player, 2441)
|
||||
removeItem(player, Items.SPADE_952, Container.INVENTORY)
|
||||
addItem(player, Items.SPADEFUL_OF_COKE_6448, 1)
|
||||
lockInteractions(player,1)
|
||||
} else {
|
||||
sendMessage(player, "You need a spade to do this!")
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
|
||||
/**This code is for handling the coke stove, lets players interact with it with the spadeful of coke
|
||||
* and rewards firemaking XP when shoving coke in there, it will not allow players to shovel more
|
||||
* coke in if it is already full.*/
|
||||
|
||||
on(stove, SCENERY,"refuel") { player, node ->
|
||||
if (inInventory(player, Items.SPADEFUL_OF_COKE_6448, 1) && BlastFurnace.stoveCoke < 30 && player.getSkills().getLevel(Skills.FIREMAKING) >= 30) {
|
||||
animate(player, 2442)
|
||||
lockInteractions(player,2)
|
||||
submitIndividualPulse(player, object : Pulse() {
|
||||
override fun pulse(): Boolean {
|
||||
removeItem(player, Items.SPADEFUL_OF_COKE_6448, Container.INVENTORY)
|
||||
addItem(player, Items.SPADE_952, 1)
|
||||
animate(player, 2443)
|
||||
return true
|
||||
}
|
||||
})
|
||||
rewardXP(player, Skills.FIREMAKING, 5.0)
|
||||
BlastFurnace.stoveCoke++
|
||||
}else if(inInventory(player, Items.SPADEFUL_OF_COKE_6448,1) && BlastFurnace.stoveCoke >= 30 && player.getSkills().getLevel(Skills.FIREMAKING) >= 30){
|
||||
sendDialogue(player,"The coke stove is already full!")
|
||||
} else if(player.getSkills().getLevel(Skills.FIREMAKING) < 30){
|
||||
sendDialogue(player,"I need 30 Firemaking to do this")
|
||||
} else {
|
||||
sendMessage(player,"You need some coke to do that!")
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
|
||||
/**This beautiiful block of bullshit 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
|
||||
* 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
|
||||
* 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 ->
|
||||
val rocksInInven = playerOre.filter {inInventory(player, it)}
|
||||
var oreToActuallyAdd = 0
|
||||
var coalToActuallyAdd = 0
|
||||
if(player.blastCoal.freeSlots() > 0 || player.blastOre.freeSlots() > 0) {
|
||||
player.dialogueInterpreter.sendOptions("Add all your ore to the furnace?", "Yes", "No")
|
||||
player.dialogueInterpreter.addAction { player, button ->
|
||||
if (button == 2 && rocksInInven.isNotEmpty()) {
|
||||
rocksInInven.forEach { oreID ->
|
||||
val oreAmount = amountInInventory(player, oreID)
|
||||
val copperInPot = player.blastOre.getAmount(436)
|
||||
val tinInPot = player.blastOre.getAmount(438)
|
||||
if(oreID == Items.COAL_453 && oreAmount <= player.blastCoal.freeSlots()){
|
||||
coalToActuallyAdd = oreAmount
|
||||
}else if(oreID == Items.COAL_453 && oreAmount > player.blastCoal.freeSlots() && player.blastCoal.freeSlots() > 0){
|
||||
coalToActuallyAdd = player.blastCoal.freeSlots()
|
||||
}
|
||||
if(oreID != Items.COAL_453 && oreAmount <= player.blastOre.freeSlots()){
|
||||
oreToActuallyAdd = oreAmount
|
||||
}else if(oreID != Items.COAL_453 && oreAmount > player.blastOre.freeSlots() && player.blastOre.freeSlots() > 0){
|
||||
oreToActuallyAdd = player.blastOre.freeSlots()
|
||||
}
|
||||
if(oreID == Items.COPPER_ORE_436 && (oreToActuallyAdd + copperInPot) > 14){
|
||||
while(oreToActuallyAdd + copperInPot > 14){
|
||||
oreToActuallyAdd--
|
||||
}
|
||||
}
|
||||
if(oreID == Items.TIN_ORE_438 && (oreToActuallyAdd + tinInPot) > 14){
|
||||
while(oreToActuallyAdd + tinInPot > 14){
|
||||
oreToActuallyAdd--
|
||||
}
|
||||
}
|
||||
when(oreID){
|
||||
Items.COAL_453 -> {
|
||||
if (coalToActuallyAdd > 0 && getStatLevel(player, Skills.SMITHING) >= 30) {
|
||||
player.blastCoal.add(Item(Items.COAL_453,coalToActuallyAdd))
|
||||
removeItem(player, Item(oreID, coalToActuallyAdd), Container.INVENTORY)
|
||||
BlastFurnaceOre(player, BFOreVariant.values()[playerOre.indexOf(oreID)],coalToActuallyAdd).init()
|
||||
}
|
||||
else if(getStatLevel(player, Skills.SMITHING) < 30){
|
||||
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!")
|
||||
}
|
||||
Items.RUNITE_ORE_451 -> {
|
||||
if (oreToActuallyAdd > 0 && getStatLevel(player, Skills.SMITHING) >= 85) {
|
||||
player.blastOre.add(Item(oreID,oreToActuallyAdd))
|
||||
removeItem(player, Item(oreID, oreToActuallyAdd), Container.INVENTORY)
|
||||
BlastFurnaceOre(player, BFOreVariant.values()[playerOre.indexOf(oreID)],oreToActuallyAdd).init()
|
||||
}
|
||||
else if(getStatLevel(player, Skills.SMITHING) < 85){
|
||||
sendDialogue(player, "My Smithing level is not high enough to smelt Runite!")
|
||||
}
|
||||
else sendDialogue(player, "It looks like the melting pot is already full of ore!")
|
||||
}
|
||||
Items.ADAMANTITE_ORE_449 -> {
|
||||
if (oreToActuallyAdd > 0 && getStatLevel(player, Skills.SMITHING) >= 70) {
|
||||
player.blastOre.add(Item(oreID,oreToActuallyAdd))
|
||||
removeItem(player, Item(oreID, oreToActuallyAdd), Container.INVENTORY)
|
||||
BlastFurnaceOre(player, BFOreVariant.values()[playerOre.indexOf(oreID)],oreToActuallyAdd).init()
|
||||
}
|
||||
else if(getStatLevel(player, Skills.SMITHING) < 70){
|
||||
sendDialogue(player, "My Smithing level is not high enough to smelt Adamantite!")
|
||||
}
|
||||
else sendDialogue(player, "It looks like the melting pot is already full of ore!")
|
||||
}
|
||||
Items.MITHRIL_ORE_447 -> {
|
||||
if (oreToActuallyAdd > 0 && getStatLevel(player, Skills.SMITHING) >= 50) {
|
||||
player.blastOre.add(Item(oreID,oreToActuallyAdd))
|
||||
removeItem(player, Item(oreID, oreToActuallyAdd), Container.INVENTORY)
|
||||
BlastFurnaceOre(player, BFOreVariant.values()[playerOre.indexOf(oreID)],oreToActuallyAdd).init()
|
||||
}
|
||||
else if(getStatLevel(player, Skills.SMITHING) < 50){
|
||||
sendDialogue(player, "My Smithing level is not high enough to smelt Mithril!")
|
||||
}
|
||||
else sendDialogue(player, "It looks like the melting pot is already full of ore!")
|
||||
}
|
||||
Items.IRON_ORE_440 -> {
|
||||
if (oreToActuallyAdd > 0 && getStatLevel(player, Skills.SMITHING) >= 15) {
|
||||
player.blastOre.add(Item(oreID,oreToActuallyAdd))
|
||||
removeItem(player, Item(oreID, oreToActuallyAdd), Container.INVENTORY)
|
||||
BlastFurnaceOre(player, BFOreVariant.values()[playerOre.indexOf(oreID)],oreToActuallyAdd).init()
|
||||
}
|
||||
else if(getStatLevel(player, Skills.SMITHING) < 15){
|
||||
sendDialogue(player, "My Smithing level is not high enough to smelt Iron!")
|
||||
}
|
||||
else sendDialogue(player, "It looks like the melting pot is already full of ore!")
|
||||
}
|
||||
Items.SILVER_ORE_442 -> {
|
||||
if (oreToActuallyAdd > 0 && getStatLevel(player, Skills.SMITHING) >= 20) {
|
||||
player.blastOre.add(Item(oreID,oreToActuallyAdd))
|
||||
removeItem(player, Item(oreID, oreToActuallyAdd), Container.INVENTORY)
|
||||
BlastFurnaceOre(player, BFOreVariant.values()[playerOre.indexOf(oreID)],oreToActuallyAdd).init()
|
||||
}
|
||||
else if(getStatLevel(player, Skills.SMITHING) < 20){
|
||||
sendDialogue(player, "My Smithing level is not high enough to smelt Silver!")
|
||||
}
|
||||
else sendDialogue(player, "It looks like the melting pot is already full of ore!")
|
||||
}
|
||||
Items.GOLD_ORE_444 -> {
|
||||
if (oreToActuallyAdd > 0 && getStatLevel(player, Skills.SMITHING) >= 40) {
|
||||
player.blastOre.add(Item(oreID,oreToActuallyAdd))
|
||||
removeItem(player, Item(oreID, oreToActuallyAdd), Container.INVENTORY)
|
||||
BlastFurnaceOre(player, BFOreVariant.values()[playerOre.indexOf(oreID)],oreToActuallyAdd).init()
|
||||
}
|
||||
else if(getStatLevel(player, Skills.SMITHING) < 40){
|
||||
sendDialogue(player, "My Smithing level is not high enough to smelt Gold!")
|
||||
}
|
||||
else sendDialogue(player, "It looks like the melting pot is already full of ore!")
|
||||
}
|
||||
Items.COPPER_ORE_436 -> {
|
||||
if (oreToActuallyAdd > 0) {
|
||||
player.blastOre.add(Item(oreID,oreToActuallyAdd))
|
||||
removeItem(player, Item(oreID, oreToActuallyAdd), Container.INVENTORY)
|
||||
BlastFurnaceOre(player, BFOreVariant.values()[playerOre.indexOf(oreID)],oreToActuallyAdd).init()
|
||||
}
|
||||
else sendDialogue(player, "It looks like the melting pot is already full of ore!")
|
||||
}
|
||||
Items.TIN_ORE_438 -> {
|
||||
if (oreToActuallyAdd > 0) {
|
||||
player.blastOre.add(Item(oreID,oreToActuallyAdd))
|
||||
removeItem(player, Item(oreID, oreToActuallyAdd), Container.INVENTORY)
|
||||
BlastFurnaceOre(player, BFOreVariant.values()[playerOre.indexOf(oreID)],oreToActuallyAdd).init()
|
||||
}
|
||||
else sendDialogue(player, "It looks like the melting pot is already full of ore!")
|
||||
}
|
||||
}
|
||||
}
|
||||
}else if (button == 2 && rocksInInven.isEmpty()){
|
||||
sendDialogue(player,"I should make sure that I have some ore before doing this.")
|
||||
}
|
||||
}
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
|
||||
/**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
|
||||
* and trying to use it on the conveyor belt then you know what you're trying to do.*/
|
||||
onUseWith(SCENERY,conveyorLoad,*playerOre){ player, _, oreType ->
|
||||
val amountInInventory = player.inventory.getAmount(oreType.id)
|
||||
val spaceForCoal = player.blastCoal.freeSlots()
|
||||
val spaceForOre = player.blastOre.freeSlots()
|
||||
val copperInPot = player.blastOre.getAmount(436)
|
||||
val tinInPot = player.blastOre.getAmount(438)
|
||||
var amountToAdd = 0
|
||||
if(oreType.id == Items.COAL_453 && amountInInventory <= spaceForCoal){
|
||||
amountToAdd = amountInInventory
|
||||
}else if(oreType.id == Items.COAL_453 && amountInInventory > spaceForCoal){
|
||||
amountToAdd = spaceForOre
|
||||
}
|
||||
if(oreType.id != Items.COAL_453 && amountInInventory <= spaceForOre){
|
||||
amountToAdd = amountInInventory
|
||||
}else if(oreType.id != Items.COAL_453 && amountInInventory > spaceForOre){
|
||||
amountToAdd = spaceForOre
|
||||
}
|
||||
if(oreType.id == Items.COPPER_ORE_436 && (amountToAdd + copperInPot) > 14){
|
||||
while(amountToAdd + copperInPot > 14){
|
||||
amountToAdd--
|
||||
}
|
||||
}
|
||||
if(oreType.id == Items.TIN_ORE_438 && (amountToAdd + tinInPot) > 14){
|
||||
while(amountToAdd + tinInPot > 14){
|
||||
amountToAdd--
|
||||
}
|
||||
}
|
||||
when(oreType.id){
|
||||
Items.TIN_ORE_438 ->{
|
||||
if (amountToAdd > 0) {
|
||||
player.blastOre.add(Item(oreType.id,amountToAdd))
|
||||
removeItem(player, Item(oreType.id, amountToAdd), Container.INVENTORY)
|
||||
BlastFurnaceOre(player, BFOreVariant.values()[playerOre.indexOf(oreType.id)],amountToAdd).init()
|
||||
}
|
||||
else sendDialogue(player, "It looks like the melting pot is already full of ore!")
|
||||
}
|
||||
Items.COPPER_ORE_436 ->{
|
||||
if (amountToAdd > 0) {
|
||||
player.blastOre.add(Item(oreType.id,amountToAdd))
|
||||
removeItem(player, Item(oreType.id, amountToAdd), Container.INVENTORY)
|
||||
BlastFurnaceOre(player, BFOreVariant.values()[playerOre.indexOf(oreType.id)],amountToAdd).init()
|
||||
}
|
||||
else sendDialogue(player, "It looks like the melting pot is already full of ore!")
|
||||
}
|
||||
Items.IRON_ORE_440 ->{
|
||||
if (amountToAdd > 0 && getStatLevel(player, Skills.SMITHING) >= 15) {
|
||||
player.blastOre.add(Item(oreType.id,amountToAdd))
|
||||
removeItem(player, Item(oreType.id, amountToAdd), Container.INVENTORY)
|
||||
BlastFurnaceOre(player, BFOreVariant.values()[playerOre.indexOf(oreType.id)],amountToAdd).init()
|
||||
}else if(getStatLevel(player,Skills.SMITHING) < 15){
|
||||
sendDialogue(player,"My Smithing level is not high enough to smelt Iron!")
|
||||
}
|
||||
else sendDialogue(player, "It looks like the melting pot is already full of ore!")
|
||||
}
|
||||
Items.MITHRIL_ORE_447 ->{
|
||||
if (amountToAdd > 0 && getStatLevel(player, Skills.SMITHING) >= 50) {
|
||||
player.blastOre.add(Item(oreType.id,amountToAdd))
|
||||
removeItem(player, Item(oreType.id, amountToAdd), Container.INVENTORY)
|
||||
BlastFurnaceOre(player, BFOreVariant.values()[playerOre.indexOf(oreType.id)],amountToAdd).init()
|
||||
}else if(getStatLevel(player,Skills.SMITHING) < 50){
|
||||
sendDialogue(player,"My Smithing level is not high enough to smelt Mithril!")
|
||||
}
|
||||
else sendDialogue(player, "It looks like the melting pot is already full of ore!")
|
||||
}
|
||||
Items.GOLD_ORE_444 ->{
|
||||
if (amountToAdd > 0 && getStatLevel(player, Skills.SMITHING) >= 40) {
|
||||
player.blastOre.add(Item(oreType.id,amountToAdd))
|
||||
removeItem(player, Item(oreType.id, amountToAdd), Container.INVENTORY)
|
||||
BlastFurnaceOre(player, BFOreVariant.values()[playerOre.indexOf(oreType.id)],amountToAdd).init()
|
||||
}else if(getStatLevel(player,Skills.SMITHING) < 40){
|
||||
sendDialogue(player,"My Smithing level is not high enough to smelt Gold!")
|
||||
}
|
||||
else sendDialogue(player, "It looks like the melting pot is already full of ore!")
|
||||
}
|
||||
Items.SILVER_ORE_442 ->{
|
||||
if (amountToAdd > 0 && getStatLevel(player, Skills.SMITHING) >= 20) {
|
||||
player.blastOre.add(Item(oreType.id,amountToAdd))
|
||||
removeItem(player, Item(oreType.id, amountToAdd), Container.INVENTORY)
|
||||
BlastFurnaceOre(player, BFOreVariant.values()[playerOre.indexOf(oreType.id)],amountToAdd).init()
|
||||
}else if(getStatLevel(player,Skills.SMITHING) < 20){
|
||||
sendDialogue(player,"My Smithing level is not high enough to smelt Silver!")
|
||||
}
|
||||
else sendDialogue(player, "It looks like the melting pot is already full of ore!")
|
||||
}
|
||||
Items.ADAMANTITE_ORE_449 ->{
|
||||
if (amountToAdd > 0 && getStatLevel(player, Skills.SMITHING) >= 70) {
|
||||
player.blastOre.add(Item(oreType.id,amountToAdd))
|
||||
removeItem(player, Item(oreType.id, amountToAdd), Container.INVENTORY)
|
||||
BlastFurnaceOre(player, BFOreVariant.values()[playerOre.indexOf(oreType.id)],amountToAdd).init()
|
||||
}else if(getStatLevel(player,Skills.SMITHING) < 70){
|
||||
sendDialogue(player,"My Smithing level is not high enough to smelt Adamantite!")
|
||||
}
|
||||
else sendDialogue(player, "It looks like the melting pot is already full of ore!")
|
||||
}
|
||||
Items.RUNITE_ORE_451 ->{
|
||||
if (amountToAdd > 0 && getStatLevel(player, Skills.SMITHING) >= 85) {
|
||||
player.blastOre.add(Item(oreType.id,amountToAdd))
|
||||
removeItem(player, Item(oreType.id, amountToAdd), Container.INVENTORY)
|
||||
BlastFurnaceOre(player, BFOreVariant.values()[playerOre.indexOf(oreType.id)],amountToAdd).init()
|
||||
}else if(getStatLevel(player,Skills.SMITHING) < 85){
|
||||
sendDialogue(player,"My Smithing level is not high enough to smelt Runite!")
|
||||
}
|
||||
else sendDialogue(player, "It looks like the melting pot is already full of ore!")
|
||||
}
|
||||
Items.COAL_453 ->{
|
||||
if (amountToAdd > 0 && getStatLevel(player, Skills.SMITHING) >= 30) {
|
||||
player.blastOre.add(Item(oreType.id,amountToAdd))
|
||||
removeItem(player, Item(oreType.id, amountToAdd), Container.INVENTORY)
|
||||
BlastFurnaceOre(player, BFOreVariant.values()[playerOre.indexOf(oreType.id)],amountToAdd).init()
|
||||
}else if(getStatLevel(player,Skills.SMITHING) < 30){
|
||||
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 ore!")
|
||||
}
|
||||
}
|
||||
return@onUseWith true
|
||||
}
|
||||
|
||||
/**This handles interacting with the temperature gauge on the furnace*/
|
||||
|
||||
on(tGauge, SCENERY, "read") { player, node ->
|
||||
player.interfaceManager.openComponent(30)
|
||||
return@on true
|
||||
}
|
||||
|
||||
/**This handles taking bars from the dispenser*/
|
||||
|
||||
on(dispenser,SCENERY,"search", "take"){ player, node ->
|
||||
if(player.varpManager.get(543).getVarbitValue(8) == 0 || player.varpManager.get(543).getVarbitValue(8) == 3) {
|
||||
player.interfaceManager.openComponent(28)
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
|
||||
/**Handles using a bucket of water on the bar dispenser*/
|
||||
|
||||
onUseWith(SCENERY,dispenser,Items.BUCKET_OF_WATER_1929){ player, used, with ->
|
||||
when {
|
||||
player.varpManager.get(543).getVarbitValue(8) == 2 -> {
|
||||
removeItem(player,Items.BUCKET_OF_WATER_1929,Container.INVENTORY)
|
||||
addItem(player,Items.BUCKET_1925)
|
||||
BlastFurnace.barsHot = false
|
||||
player.varpManager.get(543).setVarbit(8,3).send(player)
|
||||
}
|
||||
player.varpManager.get(543).getVarbitValue(8) == 0 -> {
|
||||
sendDialogue(player,"There's nothing to cool off!")
|
||||
}
|
||||
player.varpManager.get(543).getVarbitValue(8) == 1 -> {
|
||||
sendDialogue(player,"I should wait until the machine is finished")
|
||||
}
|
||||
player.varpManager.get(543).getVarbitValue(8) == 3 -> {
|
||||
sendDialogue(player,"These bars have already cooled off!")
|
||||
}
|
||||
}
|
||||
return@onUseWith true
|
||||
}
|
||||
|
||||
/**The sequel to Limp Bizkits hit single, "Fix shit"*/
|
||||
|
||||
on(brokenPotPipe,SCENERY,"repair"){ player, node ->
|
||||
if(inInventory(player,Items.HAMMER_2347,1) && player.getSkills().getLevel(Skills.CRAFTING) >= 30){
|
||||
rewardXP(player,Skills.CRAFTING, 50.0)
|
||||
BlastFurnace.potPipeBroken = false
|
||||
}else{
|
||||
sendDialogue(player,"I need 30 Craft in order to do this")
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
|
||||
on(brokenPumpPipe,SCENERY, "repair"){ player, node ->
|
||||
if(inInventory(player,Items.HAMMER_2347,1) && player.getSkills().getLevel(Skills.CRAFTING) >= 30){
|
||||
rewardXP(player,Skills.CRAFTING, 50.0)
|
||||
BlastFurnace.pumpPipeBroken = false
|
||||
}else{
|
||||
sendDialogue(player,"I need 30 Craft in order to do this")
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
|
||||
on(brokenBelt,SCENERY,"repair"){ player, node ->
|
||||
if(inInventory(player,Items.HAMMER_2347,1) && player.getSkills().getLevel(Skills.CRAFTING) >= 30){
|
||||
rewardXP(player,Skills.CRAFTING, 50.0)
|
||||
BlastFurnace.beltBroken = false
|
||||
}else{
|
||||
sendDialogue(player,"I need 30 Craft in order to do this")
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
|
||||
on(brokenCog,SCENERY,"repair"){ player, node ->
|
||||
if(inInventory(player,Items.HAMMER_2347,1) && player.getSkills().getLevel(Skills.CRAFTING) >= 30){
|
||||
rewardXP(player,Skills.CRAFTING, 50.0)
|
||||
BlastFurnace.cogBroken = false
|
||||
}else{
|
||||
sendDialogue(player,"I need 30 Craft in order to do this")
|
||||
}
|
||||
return@on true
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package rs09.game.content.activity.blastfurnace
|
||||
|
||||
import api.*
|
||||
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.ZoneBorders
|
||||
import core.game.world.map.zone.ZoneBuilder
|
||||
import core.game.world.map.zone.ZoneMonitor
|
||||
import core.plugin.Initializable
|
||||
import core.plugin.Plugin
|
||||
|
||||
/**Code for defining the Blast Furnace zone, Blast Furnace will only
|
||||
* operate and run its logic if there are actual players in this zone
|
||||
* @author phil lips*/
|
||||
|
||||
@Initializable
|
||||
class BlastFurnaceZone : MapZone("Blast Furnace Zone",true), Plugin<Any> {
|
||||
|
||||
var pulseStarted = false
|
||||
|
||||
override fun newInstance(arg: Any?): Plugin<Any> {
|
||||
ZoneBuilder.configure(this)
|
||||
return this
|
||||
}
|
||||
|
||||
override fun fireEvent(identifier: String?, vararg args: Any?): Any {
|
||||
return Unit
|
||||
}
|
||||
|
||||
override fun configure() {
|
||||
super.register(ZoneBorders(1935,4956,1956,4974))
|
||||
}
|
||||
|
||||
override fun enter(e: Entity?): Boolean {
|
||||
if (!pulseStarted){
|
||||
submitWorldPulse(BlastFurnace.blastPulse)
|
||||
pulseStarted = true
|
||||
}
|
||||
if (e != null && e.isPlayer) {
|
||||
BlastFurnace.blastFurnacePlayerList.add(e.asPlayer())
|
||||
}
|
||||
return super.enter(e)
|
||||
}
|
||||
|
||||
override fun leave(e: Entity?, logout: Boolean): Boolean {
|
||||
if (e != null && e.isPlayer) {
|
||||
BlastFurnace.blastFurnacePlayerList.remove(e.asPlayer())
|
||||
}
|
||||
return super.leave(e, logout)
|
||||
}
|
||||
|
||||
}
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package rs09.game.content.activity.blastfurnace
|
||||
|
||||
import api.*
|
||||
import rs09.game.interaction.InterfaceListener
|
||||
|
||||
/**Handles adding and removing players to the temp gauge viewing list.
|
||||
* Only updates the gauge if people are actually looking at it
|
||||
* @author phil lips*/
|
||||
|
||||
class PhunnyGaugeTempInterfaceListener : InterfaceListener(){
|
||||
|
||||
override fun defineListeners() {
|
||||
onOpen(30) {player, component ->
|
||||
BlastFurnace.gaugeViewList.add(player)
|
||||
return@onOpen true
|
||||
}
|
||||
|
||||
onClose(30) {player, component ->
|
||||
BlastFurnace.gaugeViewList.remove(player)
|
||||
return@onClose true
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package rs09.game.content.zone.keldagrim
|
||||
|
||||
import core.game.content.dialogue.DialoguePlugin
|
||||
import core.game.node.entity.npc.NPC
|
||||
import core.game.node.entity.player.Player
|
||||
import core.plugin.Initializable
|
||||
import api.*
|
||||
import rs09.tools.END_DIALOGUE
|
||||
|
||||
const val JORZIK = 2565
|
||||
|
||||
/**Just some silly little dialogue for Jorzik hehe
|
||||
* @author phil lips*/
|
||||
|
||||
@Initializable
|
||||
class JorzikDialogue(player: Player? = null) : DialoguePlugin(player) {
|
||||
|
||||
override fun open(vararg args: Any?): Boolean {
|
||||
npc = args[0] as NPC
|
||||
npc("Do you want to trade?")
|
||||
stage = 0
|
||||
return true
|
||||
}
|
||||
|
||||
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
|
||||
when(stage){
|
||||
0 -> options("What are you selling?","No, thanks").also { stage = 10 }
|
||||
10 -> when(buttonId){
|
||||
1 -> sendPlayerDialogue(player,"What are you selling?").also { stage = 15 }
|
||||
2 -> sendPlayerDialogue(player,"No, thanks.").also {stage = 50}
|
||||
}
|
||||
15 -> sendNPCDialogue(player, JORZIK,"The finest smiths from all over Gielinor come here to work, and I buy the fruit of their craft. Armour made from the strongest metals!").also { stage = 20 }
|
||||
20 -> options("Lets have a look, then.","No, thanks").also { stage = 30 }
|
||||
30 -> when(buttonId){
|
||||
1 -> sendPlayerDialogue(player,"Let's have a look, then.").also { stage = 40 }
|
||||
2 -> sendPlayerDialogue(player,"No, thanks.").also {stage = 50}
|
||||
}
|
||||
40 -> end().also { npc.openShop(player) }
|
||||
50 ->sendNPCDialogue(player, JORZIK,"You just don't appreciate the beauty of fine metalwork.").also { stage = END_DIALOGUE }
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun newInstance(player: Player?): DialoguePlugin {
|
||||
return JorzikDialogue(player)
|
||||
}
|
||||
|
||||
override fun getIds(): IntArray {
|
||||
return intArrayOf(JORZIK)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,13 +1,18 @@
|
||||
package rs09.game.content.zone.keldagrim
|
||||
|
||||
import api.*
|
||||
import core.cache.def.impl.SceneryDefinition
|
||||
import core.game.content.dialogue.DialoguePlugin
|
||||
import core.game.interaction.OptionHandler
|
||||
import core.game.node.Node
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.entity.skill.Skills
|
||||
import core.game.node.item.Item
|
||||
import core.game.node.scenery.Scenery
|
||||
import core.game.world.map.Location
|
||||
import core.plugin.Initializable
|
||||
import core.plugin.Plugin
|
||||
import rs09.game.content.dialogue.DialogueFile
|
||||
|
||||
/**
|
||||
* File that contains several plugins relating to Keldagrim,
|
||||
@@ -23,6 +28,7 @@ const val GETrapdoorDialogueID = 22381232
|
||||
*/
|
||||
@Initializable
|
||||
class KeldagrimOptionHandlers : OptionHandler() {
|
||||
|
||||
override fun handle(player: Player?, node: Node?, option: String?): Boolean {
|
||||
player ?: return false
|
||||
node ?: return false
|
||||
@@ -36,12 +42,12 @@ class KeldagrimOptionHandlers : OptionHandler() {
|
||||
}
|
||||
"climb-up" -> {
|
||||
when(node.id){
|
||||
9138 -> player.properties.teleportLocation = Location.create(2931, 10196, 0)
|
||||
9138 -> player.properties.teleportLocation = Location.create(2930, 10197, 0)
|
||||
}
|
||||
}
|
||||
"climb-down" -> {
|
||||
when(node.id){
|
||||
9084 -> player.properties.teleportLocation = Location.create(1940, 4958, 0)
|
||||
9084 -> player.dialogueInterpreter.open(BlastFurnaceDoorDialogue(),Scenery(9084, location(2929,10196,0)))
|
||||
}
|
||||
}
|
||||
"open" -> {
|
||||
@@ -105,3 +111,40 @@ class GETrapdoorDialogue(player: Player? = null) : DialoguePlugin(player){
|
||||
return intArrayOf(GETrapdoorDialogueID)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
class BlastFurnaceDoorDialogue : DialogueFile(){
|
||||
var init = true
|
||||
override fun handle(componentID: Int, buttonID: Int) {
|
||||
if (init) {
|
||||
stage = if (player!!.getSkills().getLevel(Skills.SMITHING) >= 60) {
|
||||
100
|
||||
}else{
|
||||
5
|
||||
}
|
||||
init = false
|
||||
}
|
||||
when(stage){
|
||||
5 -> sendDialogue(player!!,"You must be Smithing Level 60 or higher in order to enter the Blast Furnace").also { stage = 10 }
|
||||
10 -> sendDialogue(player!!,"However, you may enter if you pay the entrance fee").also { stage = 20 }
|
||||
20 -> options("Yes","No").also { stage = 30 }
|
||||
30 -> when(buttonID){
|
||||
1 -> {
|
||||
if(player!!.equipment.contains(6465,1) && player!!.inventory.contains(995, 1250)){
|
||||
removeItem(player!!, Item(995, 1250), Container.INVENTORY)
|
||||
player!!.setAttribute("BlastTimer",1000)
|
||||
player?.properties?.teleportLocation = Location.create(1940, 4958, 0).also { end() }
|
||||
}
|
||||
else if (player!!.inventory.contains(995, 2500)) {
|
||||
removeItem(player!!, Item(995, 2500), Container.INVENTORY)
|
||||
player!!.setAttribute("BlastTimer",1000)
|
||||
player?.properties?.teleportLocation = Location.create(1940, 4958, 0).also { end() }
|
||||
} else sendDialogue(player!!, "You don't have enough gold to pay the fee!").also { stage = 40 }
|
||||
}
|
||||
20 -> sendDialogue(player!!,"Then get out of here!").also { stage = 40 }
|
||||
}
|
||||
40 -> end()
|
||||
100 -> player?.properties?.teleportLocation = Location.create(1940, 4958, 0).also { stage = 40 }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
package rs09.game.content.zone.keldagrim
|
||||
|
||||
import core.game.content.dialogue.DialoguePlugin
|
||||
import core.game.node.entity.npc.NPC
|
||||
import core.game.node.entity.player.Player
|
||||
import core.plugin.Initializable
|
||||
import api.*
|
||||
import core.game.node.item.Item
|
||||
import org.rs09.consts.Items
|
||||
import org.rs09.consts.NPCs
|
||||
import rs09.game.interaction.InteractionListener
|
||||
import rs09.tools.END_DIALOGUE
|
||||
|
||||
/**It's just some simple Ordan dialogue
|
||||
* don't look at the unnoting code if you care
|
||||
* about your braincells
|
||||
* @author phil lips*/
|
||||
|
||||
const val ORDAN = 2564
|
||||
|
||||
@Initializable
|
||||
class OrdanDialogue(player: Player? = null) : DialoguePlugin(player) {
|
||||
|
||||
override fun open(vararg args: Any?): Boolean {
|
||||
npc = args[0] as NPC
|
||||
sendPlayerDialogue(player,"Can you un-note any of my items?")
|
||||
stage = 0
|
||||
return true
|
||||
}
|
||||
|
||||
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
|
||||
when(stage){
|
||||
0 -> sendNPCDialogue(player, ORDAN,"I can un-note Tin, Copper, Iron, Coal, and Mithril.").also { stage++ }
|
||||
1 -> sendNPCDialogue(player, ORDAN,"I can even un-note Adamantite and Runite, but you're gonna need deep pocktes for that.").also { stage = END_DIALOGUE }
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
override fun newInstance(player: Player?): DialoguePlugin {
|
||||
return OrdanDialogue(player)
|
||||
}
|
||||
|
||||
override fun getIds(): IntArray {
|
||||
return intArrayOf(ORDAN)
|
||||
}
|
||||
|
||||
/**This is for unnoting ores from Ordan, yeah I know being able to unnote Addy and Rune isn't authentic
|
||||
* but QOL wins out in this one, however unnoting Addy and Runite is expensive as fuck and is essentially
|
||||
* a big fat smelly gold sink, perhaps it will add some value to GP uh ha ha
|
||||
* just comment those options out if you don't want em
|
||||
* aka "WOW I CAN'T BELIEVE IT'S ALL CONDITIONALS*/
|
||||
|
||||
class OrdanUnnoteListener : InteractionListener() {
|
||||
val notedOre = intArrayOf(
|
||||
Items.IRON_ORE_441,
|
||||
Items.COPPER_ORE_437,
|
||||
Items.TIN_ORE_439,
|
||||
Items.COAL_454,
|
||||
Items.MITHRIL_ORE_448,
|
||||
Items.ADAMANTITE_ORE_450,
|
||||
Items.SILVER_ORE_443,
|
||||
Items.GOLD_ORE_445,
|
||||
Items.RUNITE_ORE_452
|
||||
)
|
||||
val UNNOTE_PRICES = hashMapOf(
|
||||
Items.IRON_ORE_441 to 8,
|
||||
Items.COPPER_ORE_437 to 10,
|
||||
Items.TIN_ORE_439 to 10,
|
||||
Items.COAL_454 to 22,
|
||||
Items.MITHRIL_ORE_448 to 81,
|
||||
Items.ADAMANTITE_ORE_450 to 330,
|
||||
Items.SILVER_ORE_443 to 37,
|
||||
Items.GOLD_ORE_445 to 75,
|
||||
Items.RUNITE_ORE_452 to 1000
|
||||
)
|
||||
override fun defineListeners() {
|
||||
onUseWith(NPC, NPCs.ORDAN_2564,*notedOre){ player, _, noteType ->
|
||||
val noteAmount = amountInInventory(player, noteType.id)
|
||||
val noteName = noteType.name
|
||||
var unNoteAmount = 0
|
||||
var inventorySlots = freeSlots(player)
|
||||
var actualAmount = 0
|
||||
var proceed = false
|
||||
var wait = false
|
||||
player.dialogueInterpreter.sendOptions("$noteName un-note?","1","5","10","X")
|
||||
player.dialogueInterpreter.addAction { player, button ->
|
||||
when(button) {
|
||||
2 -> unNoteAmount = 1
|
||||
3 -> unNoteAmount = 5
|
||||
4 -> unNoteAmount = 10
|
||||
5 ->{sendInputDialogue(player, true, "Enter amount:") { value ->
|
||||
unNoteAmount = value as Int
|
||||
actualAmount = if(unNoteAmount > inventorySlots){
|
||||
inventorySlots
|
||||
}else{
|
||||
unNoteAmount
|
||||
}
|
||||
if(actualAmount > noteAmount){
|
||||
actualAmount = noteAmount
|
||||
}
|
||||
/**Yes this is a second when statement that does the exact same thing
|
||||
* as the other one, and no im not removing this because if I do then
|
||||
* custom input amounts don't work and im not spending more than
|
||||
* a day making it work with just one when statement.*/
|
||||
val totalPrice = UNNOTE_PRICES[noteType.id]!! * (actualAmount)
|
||||
if(amountInInventory(player,Items.COINS_995) >= totalPrice && actualAmount > 0 ){
|
||||
removeItem(player, Item(995,totalPrice),Container.INVENTORY)
|
||||
removeItem(player, Item(noteType.id,actualAmount),Container.INVENTORY)
|
||||
addItem(player,noteType.id - 1,actualAmount)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
actualAmount = if(unNoteAmount > inventorySlots){
|
||||
inventorySlots
|
||||
}else{
|
||||
unNoteAmount
|
||||
}
|
||||
if(actualAmount > noteAmount){
|
||||
actualAmount = noteAmount
|
||||
}
|
||||
val totalPrice = UNNOTE_PRICES[noteType.id]!! * (actualAmount)
|
||||
if(amountInInventory(player,Items.COINS_995) >= totalPrice && actualAmount > 0 ){
|
||||
removeItem(player, Item(995,totalPrice),Container.INVENTORY)
|
||||
removeItem(player, Item(noteType.id,actualAmount),Container.INVENTORY)
|
||||
addItem(player,noteType.id - 1,actualAmount)
|
||||
}
|
||||
}
|
||||
return@onUseWith true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import core.game.component.Component
|
||||
import core.game.content.dialogue.FacialExpression
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.entity.player.link.TeleportManager
|
||||
import core.game.node.entity.player.link.diary.DiaryType
|
||||
import core.game.system.task.Pulse
|
||||
import core.game.world.map.Location
|
||||
import core.game.world.map.RegionManager
|
||||
@@ -134,7 +135,22 @@ class FairyRingInterface : InterfaceListener(){
|
||||
}
|
||||
}
|
||||
closeInterface(player)
|
||||
teleport(player, tile!!, TeleportManager.TeleportType.FAIRY_RING)
|
||||
if(ring == FairyRing.ALS && !player.achievementDiaryManager.hasCompletedTask(DiaryType.SEERS_VILLAGE,2,4)){
|
||||
player.achievementDiaryManager.finishTask(player,DiaryType.SEERS_VILLAGE,2,4)
|
||||
teleport(player, tile!!, TeleportManager.TeleportType.FAIRY_RING)
|
||||
}
|
||||
else if(ring == FairyRing.DKS && !player.achievementDiaryManager.hasCompletedTask(DiaryType.FREMENNIK,1,7)){
|
||||
player.achievementDiaryManager.finishTask(player,DiaryType.FREMENNIK,1,7)
|
||||
teleport(player, tile!!, TeleportManager.TeleportType.FAIRY_RING)
|
||||
}
|
||||
else if(ring == FairyRing.AIQ && !player.achievementDiaryManager.hasCompletedTask(DiaryType.FALADOR,2,4)){
|
||||
player.achievementDiaryManager.finishTask(player,DiaryType.FALADOR,2,4)
|
||||
teleport(player, tile!!, TeleportManager.TeleportType.FAIRY_RING)
|
||||
}
|
||||
else if(ring == FairyRing.DKR && !player.achievementDiaryManager.hasCompletedTask(DiaryType.VARROCK,1,19)){
|
||||
player.achievementDiaryManager.finishTask(player,DiaryType.VARROCK,1,19)
|
||||
teleport(player, tile!!, TeleportManager.TeleportType.FAIRY_RING)
|
||||
}else teleport(player, tile!!, TeleportManager.TeleportType.FAIRY_RING)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package rs09.game.interaction.item.withnpc
|
||||
|
||||
import api.inBorders
|
||||
import api.openDialogue
|
||||
import api.sendNPCDialogue
|
||||
import core.game.node.entity.player.link.diary.DiaryType
|
||||
import core.game.node.item.Item
|
||||
import org.rs09.consts.Items
|
||||
import rs09.game.content.dialogue.DialogueFile
|
||||
import rs09.game.interaction.InteractionListener
|
||||
|
||||
class CiderOnForester : InteractionListener() {
|
||||
@@ -11,10 +14,43 @@ class CiderOnForester : InteractionListener() {
|
||||
|
||||
onUseWith(NPC, Items.CIDER_5763, *ids){player, used, with ->
|
||||
if(inBorders(player, 2689, 3488, 2700, 3498)){
|
||||
openDialogue(player, with.id, with.asNpc(), used.asItem())
|
||||
player.dialogueInterpreter.open(CiderOnForesterDialogue(),with)
|
||||
return@onUseWith true
|
||||
}
|
||||
return@onUseWith false
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class CiderOnForesterDialogue : DialogueFile() {
|
||||
var init = true
|
||||
override fun handle(componentID: Int, buttonID: Int) {
|
||||
|
||||
if(init) stage = 0; init = false
|
||||
|
||||
when(stage){
|
||||
0 -> sendNPCDialogue(player!!, this.npc!!.id,"Ah, a glass of cider, Don't mind if I do!").also { stage = 1 }
|
||||
1 -> {
|
||||
sendNPCDialogue(player!!,this.npc!!.id,"Thanks!")
|
||||
player!!.inventory.remove(Item(Items.CIDER_5763,1))
|
||||
stage = 3
|
||||
}
|
||||
3 -> {
|
||||
if(player!!.getAttribute("seersCiderPub",-1) == 4){
|
||||
player!!.achievementDiaryManager?.finishTask(player,DiaryType.SEERS_VILLAGE,0,6)
|
||||
player!!.removeAttribute("seersCiderPub")
|
||||
end()
|
||||
}
|
||||
else if(player!!.getAttribute("seersCiderPub",-1) !in 0..3 && !player!!.achievementDiaryManager.hasCompletedTask(DiaryType.SEERS_VILLAGE,0,6)){
|
||||
player!!.setAttribute("seersCiderPub",0)
|
||||
end()
|
||||
}else if(player!!.getAttribute("seersCiderPub",-1) in 0..3){
|
||||
player!!.incrementAttribute("seersCiderPub",1)
|
||||
end()
|
||||
}else end()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+31
-2
@@ -1,15 +1,44 @@
|
||||
package rs09.game.interaction.item.withnpc
|
||||
|
||||
import api.openDialogue
|
||||
import api.sendNPCDialogue
|
||||
import api.sendPlayerDialogue
|
||||
import core.game.content.dialogue.FacialExpression
|
||||
import core.game.node.entity.player.link.diary.DiaryType
|
||||
import core.game.node.item.Item
|
||||
import org.rs09.consts.Items
|
||||
import org.rs09.consts.NPCs
|
||||
import rs09.game.content.dialogue.DialogueFile
|
||||
import rs09.game.interaction.InteractionListener
|
||||
|
||||
class PoisonChaliceOnKingArthur : InteractionListener() {
|
||||
override fun defineListeners() {
|
||||
onUseWith(NPC, Items.POISON_CHALICE_197, NPCs.KING_ARTHUR_251){player, used, with ->
|
||||
openDialogue(player, with.id, with.asNpc(), used.asItem())
|
||||
player.dialogueInterpreter.open(PoisonChaliceOnKingArthurDialogue(),with)
|
||||
return@onUseWith true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class PoisonChaliceOnKingArthurDialogue : DialogueFile(){
|
||||
var init = true
|
||||
override fun handle(componentID: Int, buttonID: Int) {
|
||||
if (init) stage = 0 ; init = false
|
||||
|
||||
when(stage){
|
||||
0 -> sendNPCDialogue(player!!,this.npc!!.id,"You have chosen poorly",FacialExpression.SAD).also { stage++ }
|
||||
1 -> sendPlayerDialogue(player!!,"Excuse me?",FacialExpression.ANNOYED).also { stage++ }
|
||||
2 -> sendNPCDialogue(player!!,this.npc!!.id,"Sorry, I meant to say 'thank you'. Most refreshing.").also { stage++ }
|
||||
3 -> sendPlayerDialogue(player!!,"Are you sure that stuff is safe to drink?",FacialExpression.DISGUSTED_HEAD_SHAKE).also { stage++ }
|
||||
4 -> sendNPCDialogue(player!!,this.npc!!.id,"Oh yes, Stankers' creations may be dangerous for those with weak constitutions, but, personally. I find them rather invigorating.").also { stage++ }
|
||||
5 ->{ if (!player!!.achievementDiaryManager.hasCompletedTask(DiaryType.SEERS_VILLAGE,0,3)){
|
||||
player!!.achievementDiaryManager.finishTask(player!!,DiaryType.SEERS_VILLAGE,0,3)
|
||||
player!!.inventory.remove(Item(197,1))
|
||||
end()
|
||||
}else {
|
||||
player!!.inventory.remove(Item(197,1))
|
||||
end()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,10 +3,15 @@ package rs09.game.node.entity.npc.other
|
||||
import api.*
|
||||
import core.game.node.entity.npc.AbstractNPC
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.system.task.Pulse
|
||||
import core.game.world.map.Location
|
||||
import core.game.world.map.path.Pathfinder
|
||||
import core.game.world.update.flag.context.Animation
|
||||
import core.plugin.Initializable
|
||||
import org.rs09.consts.NPCs
|
||||
import rs09.game.content.activity.blastfurnace.BlastFurnace
|
||||
|
||||
/**On god this is like 95% ceikry and 5% me adding a setAttribute to the clear code
|
||||
* @author funny alium man*/
|
||||
|
||||
@Initializable
|
||||
class BlastFurnaceOre : AbstractNPC {
|
||||
@@ -14,22 +19,23 @@ class BlastFurnaceOre : AbstractNPC {
|
||||
constructor() : super(NPCs.COAL_2562, null, true) {}
|
||||
private constructor(id: Int, location: Location) : super(id, location) {}
|
||||
|
||||
constructor(owner: Player, variant: BFOreVariant) : super(
|
||||
constructor(owner: Player, variant: BFOreVariant, amount: Int) : super(
|
||||
when(variant){
|
||||
BFOreVariant.COPPER -> NPCs.COPPER_ORE_2555
|
||||
BFOreVariant.TIN -> NPCs.TIN_ORE_2554
|
||||
BFOreVariant.COAL -> NPCs.COAL_2562
|
||||
BFOreVariant.MITHRIL -> NPCs.MITHRIL_ORE_2557
|
||||
BFOreVariant.ADAMANT -> NPCs.ADAMANTITE_ORE_2558
|
||||
BFOreVariant.SILVER -> NPCs.SILVER_ORE_2560
|
||||
BFOreVariant.GOLD -> NPCs.GOLD_ORE_2561
|
||||
BFOreVariant.PERFECT_GOLD -> NPCs.PERFECT_GOLD_ORE_2563
|
||||
BFOreVariant.RUNITE -> NPCs.RUNITE_ORE_2559
|
||||
}, Location.create(1942, 4966, 0)) {this.owner = owner; isRespawn = false}
|
||||
BFOreVariant.IRON -> NPCs.IRON_ORE_2556
|
||||
BFOreVariant.COPPER -> NPCs.COPPER_ORE_2555
|
||||
BFOreVariant.TIN -> NPCs.TIN_ORE_2554
|
||||
BFOreVariant.COAL -> NPCs.COAL_2562
|
||||
BFOreVariant.MITHRIL -> NPCs.MITHRIL_ORE_2557
|
||||
BFOreVariant.ADAMANT -> NPCs.ADAMANTITE_ORE_2558
|
||||
BFOreVariant.SILVER -> NPCs.SILVER_ORE_2560
|
||||
BFOreVariant.GOLD -> NPCs.GOLD_ORE_2561
|
||||
BFOreVariant.RUNITE -> NPCs.RUNITE_ORE_2559
|
||||
}, Location.create(1942, 4966, 0)) {this.owner = owner; isRespawn = false; }
|
||||
|
||||
var owner: Player? = null
|
||||
var delay = 2
|
||||
var counter = 2
|
||||
var counter = 3
|
||||
|
||||
|
||||
override fun construct(id: Int, location: Location, vararg objects: Any): AbstractNPC {
|
||||
return BlastFurnaceOre(id, location)
|
||||
@@ -37,33 +43,44 @@ class BlastFurnaceOre : AbstractNPC {
|
||||
|
||||
override fun getIds(): IntArray {
|
||||
return intArrayOf(
|
||||
NPCs.COPPER_ORE_2555,
|
||||
NPCs.TIN_ORE_2554,
|
||||
NPCs.COAL_2562,
|
||||
NPCs.MITHRIL_ORE_2557,
|
||||
NPCs.ADAMANTITE_ORE_2558,
|
||||
NPCs.SILVER_ORE_2560,
|
||||
NPCs.GOLD_ORE_2561,
|
||||
NPCs.PERFECT_GOLD_ORE_2563,
|
||||
NPCs.RUNITE_ORE_2559)
|
||||
NPCs.IRON_ORE_2556,
|
||||
NPCs.COPPER_ORE_2555,
|
||||
NPCs.TIN_ORE_2554,
|
||||
NPCs.COAL_2562,
|
||||
NPCs.MITHRIL_ORE_2557,
|
||||
NPCs.ADAMANTITE_ORE_2558,
|
||||
NPCs.SILVER_ORE_2560,
|
||||
NPCs.GOLD_ORE_2561,
|
||||
NPCs.PERFECT_GOLD_ORE_2563,
|
||||
NPCs.RUNITE_ORE_2559)
|
||||
}
|
||||
|
||||
override fun handleTickActions() {
|
||||
delay--
|
||||
if(delay <= 0 && getWorldTicks() % 2 == 0) { //run every other tick
|
||||
if(counter > 0){
|
||||
properties.teleportLocation = location.transform(0, -1, 0)
|
||||
counter--
|
||||
} else {
|
||||
//increment ore count, update interface, whatever you need to do here.
|
||||
clear()
|
||||
if (BlastFurnace.beltRunning) {
|
||||
delay--
|
||||
if (delay <= 0 && getWorldTicks() % 2 == 0) { //run every other tick
|
||||
if (counter > 0) {
|
||||
properties.teleportLocation = location.transform(0, -1, 0)
|
||||
counter--
|
||||
if (counter == 0) {
|
||||
val animation = Animation(2434)
|
||||
animate(animation)
|
||||
owner?.setAttribute("OreInPot",true)
|
||||
submitIndividualPulse(this, object : Pulse(animationDuration(animation)) {
|
||||
override fun pulse(): Boolean {
|
||||
clear()
|
||||
return true
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
enum class BFOreVariant {
|
||||
IRON,
|
||||
COPPER,
|
||||
TIN,
|
||||
COAL,
|
||||
@@ -71,6 +88,5 @@ enum class BFOreVariant {
|
||||
ADAMANT,
|
||||
SILVER,
|
||||
GOLD,
|
||||
PERFECT_GOLD,
|
||||
RUNITE
|
||||
}
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
package rs09.game.node.entity.player.diary.seers
|
||||
|
||||
import core.game.node.entity.Entity
|
||||
import core.game.node.entity.player.Player
|
||||
import core.plugin.Initializable
|
||||
import core.game.world.map.zone.MapZone
|
||||
import core.tools.Vector3d
|
||||
import core.game.node.entity.player.link.diary.DiaryType
|
||||
import core.game.world.map.Location
|
||||
import core.game.world.map.zone.ZoneBorders
|
||||
import core.game.world.map.zone.ZoneBuilder
|
||||
import core.plugin.Plugin
|
||||
import rs09.game.content.activity.blastfurnace.BlastFurnace
|
||||
|
||||
@Initializable
|
||||
class MysteriousStatueZone : MapZone("mysterious-statue", true), Plugin<Any?> {
|
||||
|
||||
val northWest = Location.create(2739, 3492, 0)
|
||||
val northEast = Location.create(2742, 3492, 0)
|
||||
val southEast = Location.create(2742, 3489, 0)
|
||||
val southWest = Location.create(2739, 3489, 0)
|
||||
|
||||
|
||||
override fun newInstance(arg: Any?): MysteriousStatueZone {
|
||||
ZoneBuilder.configure(this)
|
||||
return this
|
||||
}
|
||||
|
||||
override fun configure() {
|
||||
super.register(ZoneBorders(2739,3492,2742,3489))
|
||||
}
|
||||
|
||||
override fun enter(e: Entity?): Boolean {
|
||||
return super.enter(e)
|
||||
}
|
||||
|
||||
override fun fireEvent(identifier: String?, vararg args: Any?): Any {
|
||||
return Unit
|
||||
}
|
||||
|
||||
override fun locationUpdate(e: Entity?, last: Location?) {
|
||||
if (e is Player && !e.isArtificial) {
|
||||
val player = e.asPlayer()
|
||||
if(!player.achievementDiaryManager.hasCompletedTask(DiaryType.SEERS_VILLAGE,0,1 ) && player.getAttribute("seersStatueProgress",-1) !in 0..3 ){
|
||||
player.setAttribute("seersStatueProgress",0)
|
||||
println("statue started")
|
||||
}else{
|
||||
when(player.location){
|
||||
northWest ->{
|
||||
if(player.getAttribute("seersStatueProgress",-1) == 0){
|
||||
player.setAttribute("seersStatueProgress",1)
|
||||
println("location 1 of 4 finished")
|
||||
println(player.getAttribute("seersStatueProgress",-1))
|
||||
}else if(player.getAttribute("seersStatueProgress",-1) in 2..3){
|
||||
player.setAttribute("seersStatueProgress",0)
|
||||
println("location progress reset")
|
||||
}
|
||||
}
|
||||
northEast ->{
|
||||
if(player.getAttribute("seersStatueProgress",0) == 1){
|
||||
player.setAttribute("seersStatueProgress",2)
|
||||
println("location 2 of 4 finished")
|
||||
}else if(player.getAttribute("seersStatueProgress",0) != 1){
|
||||
player.setAttribute("seersStatueProgress",0)
|
||||
println("location progress reset")
|
||||
}
|
||||
}
|
||||
southEast ->{
|
||||
if(player.getAttribute("seersStatueProgress",0) == 2){
|
||||
player.setAttribute("seersStatueProgress",3)
|
||||
println("location 3 of 4 finished")
|
||||
}else if(player.getAttribute("seersStatueProgress",0) != 2){
|
||||
player.setAttribute("seersStatueProgress",0)
|
||||
println("location progress reset")
|
||||
}
|
||||
}
|
||||
southWest ->{
|
||||
if(player.getAttribute("seersStatueProgress",0) == 3){
|
||||
player.setAttribute("seersStatueProgress",4)
|
||||
println("location 4 of 4 finished")
|
||||
}else if(player.getAttribute("seersStatueProgress",0) != 3){
|
||||
player.setAttribute("seersStatueProgress",0)
|
||||
println("location progress reset")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if(player.getAttribute("seersStatueProgress",0) == 4){
|
||||
player.achievementDiaryManager.finishTask(player,DiaryType.SEERS_VILLAGE,0,1)
|
||||
player.setAttribute("seersStatueComplete",true)
|
||||
player.removeAttribute("seersStatueProgress")
|
||||
}
|
||||
}
|
||||
super.locationUpdate(e, last)
|
||||
}
|
||||
|
||||
override fun leave(e: Entity?, logout: Boolean): Boolean {
|
||||
if(e is Player && !e.isArtificial){
|
||||
val player = e.asPlayer()
|
||||
if(!player.getAttribute("seersStatueComplete",false) && player.getAttribute("seersStatueProgress",-0) in 0..3){
|
||||
player.removeAttribute("seersStatueProgress")
|
||||
super.leave(e, logout)
|
||||
}else return super.leave(e, logout)
|
||||
}
|
||||
return super.leave(e, logout)
|
||||
}
|
||||
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
package rs09.game.node.entity.player.diary.seers
|
||||
|
||||
import core.game.node.entity.Entity
|
||||
import core.game.node.entity.player.Player
|
||||
import core.game.node.entity.player.link.diary.DiaryType
|
||||
import core.game.node.entity.player.link.prayer.PrayerType
|
||||
import core.game.world.map.zone.MapZone
|
||||
import core.game.world.map.zone.ZoneBorders
|
||||
import core.game.world.map.zone.ZoneBuilder
|
||||
import core.plugin.Initializable
|
||||
import core.plugin.Plugin
|
||||
|
||||
@Initializable
|
||||
class SeersCourthouseZone : MapZone("seers-courthouse", true), Plugin<Any?>{
|
||||
|
||||
override fun newInstance(arg: Any?): SeersCourthouseZone {
|
||||
ZoneBuilder.configure(this)
|
||||
return this
|
||||
}
|
||||
|
||||
override fun configure() {
|
||||
super.register(ZoneBorders(2735,3471,2736,3471))
|
||||
}
|
||||
|
||||
override fun enter(e: Entity?): Boolean {
|
||||
if(e is Player && !e.isArtificial){
|
||||
if(!e.achievementDiaryManager.hasCompletedTask(DiaryType.SEERS_VILLAGE,2,3) && e.prayer.active.contains(PrayerType.PIETY)){
|
||||
e.achievementDiaryManager.finishTask(e,DiaryType.SEERS_VILLAGE,2,3)
|
||||
}
|
||||
}
|
||||
return super.enter(e)
|
||||
}
|
||||
|
||||
override fun fireEvent(identifier: String?, vararg args: Any?): Any {
|
||||
return Unit
|
||||
}
|
||||
|
||||
override fun leave(e: Entity?, logout: Boolean): Boolean {
|
||||
return super.leave(e, logout)
|
||||
}
|
||||
}
|
||||
+22
-10
@@ -343,7 +343,11 @@ class PlayerSaveParser(val player: Player) {
|
||||
val coreData = saveFile!!["core_data"] as JSONObject
|
||||
val inventory = coreData["inventory"] as JSONArray
|
||||
val bank = coreData["bank"] as JSONArray
|
||||
val bankSecondary = coreData.getOrDefault("bankSecondary", JSONArray()) as JSONArray
|
||||
val equipment = coreData["equipment"] as JSONArray
|
||||
val bBars = coreData["blastBars"] as? JSONArray
|
||||
val bOre = coreData["blastOre"] as? JSONArray
|
||||
val bCoal = coreData["blastCoal"] as? JSONArray
|
||||
val location = coreData["location"] as String
|
||||
val bankTabData = coreData["bankTabs"]
|
||||
if (bankTabData != null) {
|
||||
@@ -353,12 +357,28 @@ class PlayerSaveParser(val player: Player) {
|
||||
val tab = i as JSONObject
|
||||
val index = tab["index"].toString().toInt()
|
||||
val startSlot = tab["startSlot"].toString().toInt()
|
||||
player.bank.tabStartSlot[index] = startSlot
|
||||
player.bankPrimary.tabStartSlot[index] = startSlot
|
||||
}
|
||||
}
|
||||
val bankTabSecondaryData = coreData["bankTabsSecondary"]
|
||||
if (bankTabSecondaryData != null) {
|
||||
val tabData = bankTabSecondaryData as JSONArray
|
||||
for (i in tabData) {
|
||||
i ?: continue
|
||||
val tab = i as JSONObject
|
||||
val index = tab["index"].toString().toInt()
|
||||
val startSlot = tab["startSlot"].toString().toInt()
|
||||
player.bankSecondary.tabStartSlot[index] = startSlot
|
||||
}
|
||||
}
|
||||
player.useSecondaryBank = coreData.getOrDefault("useSecondaryBank", false) as Boolean
|
||||
player.inventory.parse(inventory)
|
||||
player.bank.parse(bank)
|
||||
player.bankPrimary.parse(bank)
|
||||
player.bankSecondary.parse(bankSecondary)
|
||||
player.equipment.parse(equipment)
|
||||
bBars?.let{player.blastBars.parse(it)}
|
||||
bOre?.let{player.blastOre.parse(bOre)}
|
||||
bCoal?.let{player.blastCoal.parse(bCoal)}
|
||||
player.location = rs09.JSONUtils.parseLocation(location)
|
||||
}
|
||||
|
||||
@@ -368,14 +388,6 @@ class PlayerSaveParser(val player: Player) {
|
||||
player.skills.parse(skillData)
|
||||
player.skills.experienceGained = saveFile!!["totalEXP"].toString().toDouble()
|
||||
player.skills.experienceMutiplier = saveFile!!["exp_multiplier"].toString().toDouble()
|
||||
if (World.settings?.default_xp_rate != 5.0) {
|
||||
player.skills.experienceMutiplier = World.settings?.default_xp_rate!!
|
||||
}
|
||||
val divisor: Double
|
||||
if(player.skills.experienceMutiplier >= 10 && !player.attributes.containsKey("permadeath")){ //exclude permadeath HCIMs from XP squish
|
||||
divisor = player.skills.experienceMutiplier / 5.0
|
||||
player.skills.correct(divisor)
|
||||
}
|
||||
if (saveFile!!.containsKey("milestone")) {
|
||||
val milestone: JSONObject = saveFile!!["milestone"] as JSONObject
|
||||
player.skills.combatMilestone = (milestone.get("combatMilestone")).toString().toInt()
|
||||
|
||||
@@ -785,18 +785,41 @@ class PlayerSaver (val player: Player){
|
||||
val inventory = saveContainer(player.inventory)
|
||||
coreData.put("inventory",inventory)
|
||||
|
||||
val bank = saveContainer(player.bank)
|
||||
val bank = saveContainer(player.bankPrimary)
|
||||
coreData.put("bank",bank)
|
||||
|
||||
val bankSecondary = saveContainer(player.bankSecondary)
|
||||
coreData.put("bankSecondary",bankSecondary)
|
||||
|
||||
val bBars = saveContainer(player.blastBars)
|
||||
coreData.put("blastBars",bBars)
|
||||
|
||||
val bOre = saveContainer(player.blastOre)
|
||||
coreData.put("blastOre",bOre)
|
||||
|
||||
val bCoal = saveContainer(player.blastCoal)
|
||||
coreData.put("blastCoal",bCoal)
|
||||
|
||||
val bankTabs = JSONArray()
|
||||
for(i in player.bank.tabStartSlot.indices){
|
||||
for(i in player.bankPrimary.tabStartSlot.indices){
|
||||
val tab = JSONObject()
|
||||
tab.put("index",i.toString())
|
||||
tab.put("startSlot",player.bank.tabStartSlot[i].toString())
|
||||
tab.put("startSlot",player.bankPrimary.tabStartSlot[i].toString())
|
||||
bankTabs.add(tab)
|
||||
}
|
||||
coreData.put("bankTabs",bankTabs)
|
||||
|
||||
val bankTabsSecondary = JSONArray()
|
||||
for(i in player.bankSecondary.tabStartSlot.indices){
|
||||
val tab = JSONObject()
|
||||
tab.put("index",i.toString())
|
||||
tab.put("startSlot",player.bankSecondary.tabStartSlot[i].toString())
|
||||
bankTabsSecondary.add(tab)
|
||||
}
|
||||
coreData.put("bankTabsSecondary",bankTabsSecondary)
|
||||
|
||||
coreData.put("useSecondaryBank",player.useSecondaryBank)
|
||||
|
||||
val equipment = saveContainer(player.equipment)
|
||||
coreData.put("equipment",equipment)
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package rs09.game.node.entity.skill.farming
|
||||
|
||||
import api.*
|
||||
import core.game.interaction.NodeUsageEvent
|
||||
import core.game.node.entity.player.link.diary.DiaryType
|
||||
import core.game.node.entity.skill.Skills
|
||||
import core.game.node.item.Item
|
||||
import core.game.system.task.Pulse
|
||||
@@ -209,6 +210,9 @@ object UseWithPatchHandler{
|
||||
player.animator.animate(Animation(2291))
|
||||
player.pulseManager.run(object : Pulse(3) {
|
||||
override fun pulse(): Boolean {
|
||||
if(plantable == Plantable.JUTE_SEED && patch == FarmingPatch.MCGRUBOR_HOPS && !player.achievementDiaryManager.hasCompletedTask(DiaryType.SEERS_VILLAGE,0,7)){
|
||||
player.achievementDiaryManager.finishTask(player,DiaryType.SEERS_VILLAGE,0,7)
|
||||
}
|
||||
p.plant(plantable)
|
||||
player.skills.addExperience(Skills.FARMING, plantable.plantingXP)
|
||||
p.setNewHarvestAmount()
|
||||
|
||||
Reference in New Issue
Block a user