Repository reorganisation

Unified kotlin and java into just src/main
Unified the rs09 and core packages
Took all content out of the core package, and placed it into the new content package
Reorganised all source code relating to content to be easier to find and explore
This commit is contained in:
Ceikry
2023-01-26 13:59:28 +00:00
committed by Ryan
parent e4b799c44a
commit a100affda2
3156 changed files with 24205 additions and 30585 deletions
@@ -0,0 +1,73 @@
package content.minigame.allfiredup
import core.game.node.entity.player.Player
import core.tools.SystemLogger
import core.game.world.map.Location
/**
* Various data for beacons, such as varp and offset, required FM level, etc
* @author Ceikry
*/
enum class AFUBeacon(val title: String, val fmLevel: Int, val varpId: Int, val offset: Int, val location: Location, val experience: Double, val keeper: Int = 0) {
RIVER_SALVE("",43,1283,0,Location.create(3396, 3464, 0),216.2,8065),
RAG_AND_BONE("",43,1283,3,Location.create(3343, 3510, 0),235.8,8066),
JOLLY_BOAR("",48,1283,6,Location.create(3278, 3525, 0), 193.8,8067),
NORTH_VARROCK_CASTLE("",53,1283,9,Location.create(3236, 3527, 0),178.5,8068),
GRAND_EXCHANGE("",59,1283,12,Location.create(3170, 3536, 0),194.3,8069),
EDGEVILLE("",62,1283,15,Location.create(3087, 3516, 0),86.7,8070),
MONASTERY("",68,1283,18,Location.create(3034, 3518, 0),224.4,8071),
GOBLIN_VILLAGE("",72,1283,21,Location.create(2968, 3516, 0),194.8,8072),
BURTHORPE("",76,1283,24,Location.create(2940, 3565, 0),195.3,8073),
DEATH_PLATEAU("",79,1288,0,Location.create(2944, 3622, 0),249.9,8074),
TROLLHEIM("",83,1288,3,Location.create(2939, 3680, 0),201.0,8075),
GWD("",87,1288,6,Location.create(2937, 3773, 0),255.0,8076),
TEMPLE("",89,1288,9,Location.create(2946, 3836, 0),198.9),
PLATEAU("",92,1288,12,Location.create(2964, 3931, 0),147.9);
companion object {
fun forLocation(location: Location): content.minigame.allfiredup.AFUBeacon {
for (beacon in values()) {
if (beacon.location.equals(location)) return beacon
}
return content.minigame.allfiredup.AFUBeacon.RIVER_SALVE.also { SystemLogger.logWarn(this::class.java, "Unhandled Beacon Location ${location.toString()}") }
}
fun resetAllBeacons(player: Player){
for(beacon in values()){
player.varpManager.get(beacon.varpId).setVarbit(beacon.offset,0).send(player)
}
}
}
fun light(player: Player){
player.varpManager.get(varpId).setVarbit(offset,2).send(player)
}
fun diminish(player: Player){
player.varpManager.get(varpId).setVarbit(offset,3).send(player)
}
fun extinguish(player: Player){
player.varpManager.get(varpId).setVarbit(offset,0).send(player)
}
fun lightGnomish(player: Player){
player.varpManager.get(varpId).setVarbit(offset,4).send(player)
}
fun fillWithLogs(player: Player){
player.varpManager.get(varpId).setVarbit(offset,1).send(player)
}
fun getState(player: Player): content.minigame.allfiredup.BeaconState {
return content.minigame.allfiredup.BeaconState.values()[player.varpManager.get(varpId).getVarbit(offset) ?: 0]
}
}
enum class BeaconState{
EMPTY,
FILLED,
LIT,
DYING,
WARNING
}
@@ -0,0 +1,216 @@
package content.minigame.allfiredup
import core.game.node.entity.npc.NPC
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.update.flag.context.Animation
import org.rs09.consts.Items
import core.game.interaction.InteractionListener
import core.game.interaction.IntType
import core.game.world.GameWorld
private val VALID_LOGS = intArrayOf(Items.LOGS_1511, Items.OAK_LOGS_1521,Items.WILLOW_LOGS_1519,Items.MAPLE_LOGS_1517,Items.YEW_LOGS_1515,Items.MAGIC_LOGS_1513)
private val FILL_ANIM = Animation(9136)
private val LIGHT_ANIM = Animation(7307)
/**
* Handles interactions for beacons
* @author Ceikry
*/
class AFUBeaconListeners : InteractionListener {
override fun defineListeners() {
on(IntType.SCENERY,"add-logs","light"){ player, node ->
val beacon = content.minigame.allfiredup.AFUBeacon.forLocation(node.location)
val questComplete = player.questRepository.isComplete("All Fired Up")
val questStage = player.questRepository.getStage("All Fired Up")
if ((beacon != content.minigame.allfiredup.AFUBeacon.RIVER_SALVE && beacon != content.minigame.allfiredup.AFUBeacon.RAG_AND_BONE && !questComplete)
|| (beacon == content.minigame.allfiredup.AFUBeacon.RIVER_SALVE && questStage < 20 && !questComplete)
|| (beacon == content.minigame.allfiredup.AFUBeacon.RAG_AND_BONE && questStage < 50 && !questComplete)) {
player.dialogueInterpreter.sendDialogues(player, core.game.dialogue.FacialExpression.THINKING, "I probably shouldn't mess with this.")
return@on true
}
player.debug(beacon.getState(player).name)
when (beacon.getState(player)) {
content.minigame.allfiredup.BeaconState.EMPTY -> fillBeacon(player, beacon, questComplete)
content.minigame.allfiredup.BeaconState.DYING -> restoreBeacon(player, beacon, questComplete)
content.minigame.allfiredup.BeaconState.FILLED -> lightBeacon(player, beacon, questComplete)
content.minigame.allfiredup.BeaconState.LIT, content.minigame.allfiredup.BeaconState.WARNING -> {
player.debug("INVALID BEACON STATE")
}
}
return@on true
}
}
fun fillBeacon(player: Player, beacon: content.minigame.allfiredup.AFUBeacon, questComplete: Boolean){
when(beacon){
content.minigame.allfiredup.AFUBeacon.MONASTERY -> {
if(player.skills.getLevel(Skills.PRAYER) < 31){
player.dialogueInterpreter.sendDialogues(NPC(beacon.keeper).getShownNPC(player), core.game.dialogue.FacialExpression.ANGRY,"You must join the monastery to light this beacon!")
return
}
}
content.minigame.allfiredup.AFUBeacon.GWD -> {
if(!AFURepairClimbHandler.isRepaired(player, beacon)){
player.dialogueInterpreter.sendDialogue("You must repair the windbreak before you","can light this beacon.")
return
}
}
content.minigame.allfiredup.AFUBeacon.GOBLIN_VILLAGE -> {
if(!player.questRepository.isComplete("Lost Tribe")){
player.dialogueInterpreter.sendDialogues(NPC(beacon.keeper).getShownNPC(player), core.game.dialogue.FacialExpression.THINKING,"We no trust you outsider. You no light our beacon.","(Complete Lost Tribe to use this beacon.)")
return
}
}
}
if(player.skills.getLevel(Skills.FIREMAKING) < beacon.fmLevel){
player.dialogueInterpreter.sendDialogue("You need ${beacon.fmLevel} Firemaking to light this beacon.")
return
}
val logs = getLogs(player,20)
if (logs.id != 0 && player.inventory.remove(logs)) {
player.lock()
var session: AFUSession? = null
if(questComplete){
session = player.getAttribute("afu-session", null)
if(session == null) {
session = AFUSession(player)
session.init()
}
}
GameWorld.Pulser.submit(object : Pulse() {
var counter = 0
override fun pulse(): Boolean {
when (counter++) {
0 -> player.animator.animate(FILL_ANIM)
1 -> {
beacon.fillWithLogs(player)
if(questComplete){
session?.setLogs(beacon.ordinal,logs)
}
player.varpManager.flagSave(beacon.varpId);
}
2 -> player.unlock().also {player.animator.animate(Animation.RESET); return true }
}
return false
}
})
} else {
player.dialogueInterpreter.sendDialogue("You need some logs to do this.")
}
}
fun lightBeacon(player: Player, beacon: content.minigame.allfiredup.AFUBeacon, questComplete: Boolean){
var session: AFUSession? = null
if(questComplete){
session = player.getAttribute("afu-session",null)
if(session == null) return
}
if(player.inventory.contains(Items.TINDERBOX_590,1)){
player.lock()
GameWorld.Pulser.submit(object: Pulse(){
var counter = 0
override fun pulse(): Boolean {
when(counter++){
0 -> player.animator.animate(LIGHT_ANIM)
1 -> {
beacon.light(player)
if(questComplete){
session?.startTimer(beacon.ordinal)
if(session?.getLitBeacons() == 6 && !player.hasFireRing()){
player.sendMessage("Congratulations on lighting 6 beacons at once! King Roald has something for you.")
player.setAttribute("/save:afu-mini:ring",true)
}
if(session?.getLitBeacons() == 10 && !player.hasFlameGloves()){
player.sendMessage("Congratulations on lighting 10 beacons at once! King Roald has something for you.")
player.setAttribute("/save:afu-mini:gloves",true)
}
if(session?.getLitBeacons() == 14 && !player.hasInfernoAdze()){
player.sendMessage("Congratulations on lighting all 14 beacons! King Roald has something special for you.")
player.setAttribute("/save:afu-mini:adze",true)
}
var experience = beacon.experience
experience += session?.getBonusExperience() ?: 0.0
player.skills.addExperience(Skills.FIREMAKING,experience)
} else {
player.questRepository.getQuest("All Fired Up").setStage(player, player.questRepository.getStage("All Fired Up") + 10)
}
}
2 -> player.unlock().also { return true }
}
return false
}
})
} else {
player.dialogueInterpreter.sendDialogue("You need a tinderbox to light this.")
}
}
fun restoreBeacon(player: Player, beacon: content.minigame.allfiredup.AFUBeacon, questComplete: Boolean){
var session: AFUSession? = null
if(questComplete){
session = player.getAttribute("afu-session",null)
if(session == null) return
}
val logs = getLogs(player, 5)
if (logs.id != 0 && player.inventory.remove(logs)) {
player.lock()
GameWorld.Pulser.submit(object: Pulse(){
var counter = 0
override fun pulse(): Boolean {
when(counter++){
0 -> player.animator.animate(FILL_ANIM)
1 -> beacon.light(player).also {
if(questComplete){
session?.refreshTimer(beacon,logs.id)
} else {
player.questRepository.getQuest("All Fired Up").setStage(player, 80)
}
}
2 -> player.unlock().also { return true }
}
return false
}
})
} else {
player.dialogueInterpreter.sendDialogue("You need some logs to do this.")
}
}
fun getLogs(player: Player, amount: Int): Item{
var logId = 0
for (log in VALID_LOGS) if (player.inventory.getAmount(log) >= amount) {logId = log; break}
return Item(logId,amount)
}
fun Player.hasFireRing(): Boolean{
return inventory.containsItem(Item(Items.RING_OF_FIRE_13659)) || bank.containsItem(Item(Items.RING_OF_FIRE_13659)) || equipment.containsItem(Item(Items.RING_OF_FIRE_13659))
}
fun Player.hasFlameGloves(): Boolean{
return inventory.containsItem(Item(Items.FLAME_GLOVES_13660)) || bank.containsItem(Item(Items.FLAME_GLOVES_13660)) || equipment.containsItem(Item(Items.FLAME_GLOVES_13660))
}
fun Player.hasInfernoAdze(): Boolean{
return inventory.containsItem(Item(Items.INFERNO_ADZE_13661)) || bank.containsItem(Item(Items.INFERNO_ADZE_13661)) || equipment.containsItem(Item(Items.INFERNO_ADZE_13661))
}
}
@@ -0,0 +1,141 @@
package content.minigame.allfiredup
import core.game.node.entity.impl.ForceMovement
import core.game.node.entity.player.Player
import core.game.node.entity.skill.Skills
import content.global.skill.construction.NailType
import core.game.node.item.Item
import core.game.world.map.Direction
import core.game.world.map.Location
import core.game.world.update.flag.context.Animation
import org.rs09.consts.Items
import core.game.interaction.InteractionListener
import core.game.interaction.IntType
import java.util.*
/**
* Handles repairing and climbing of the 3 beacon shortcuts needed to access them
* @author Ceikry
*/
class AFURepairClimbHandler : InteractionListener {
val repairIDs = intArrayOf(38480,38470,38494)
val climbIDs = intArrayOf(38469,38471,38486,38481)
override fun defineListeners() {
on(repairIDs, IntType.SCENERY, "repair"){ player, _ ->
var rco: RepairClimbObject = RepairClimbObject.GWD
for(ent in RepairClimbObject.values()) if(ent.destinationDown?.withinDistance(player.location,2) == true || ent.destinationUp?.withinDistance(player.location,2) == true) rco = ent
repair(player,rco)
return@on true
}
on(climbIDs, IntType.SCENERY, "climb"){ player, node ->
var rco: RepairClimbObject = RepairClimbObject.GWD
for(ent in RepairClimbObject.values()) if(ent.destinationDown?.withinDistance(player.location,2) == true || ent.destinationUp?.withinDistance(player.location,2) == true) rco = ent
climb(player,rco,node.location)
return@on true
}
}
private fun repair(player: Player,rco: RepairClimbObject){
val skill = rco.levelRequirement?.first ?: 0
val level = rco.levelRequirement?.second ?: 0
if(player.skills.getLevel(skill) < level){
player.dialogueInterpreter.sendDialogue("You need level $level ${Skills.SKILL_NAME[skill]} for this.")
return
}
var requiresNeedle = false
val requiredItems = when(rco){
RepairClimbObject.DEATH_PLATEAU -> {
arrayOf(Item(Items.PLANK_960,2))
}
RepairClimbObject.BURTHORPE -> {
arrayOf(Item(Items.IRON_BAR_2351,2))
}
RepairClimbObject.GWD -> {
requiresNeedle = true
arrayOf(Item(Items.JUTE_FIBRE_5931,3))
}
RepairClimbObject.TEMPLE -> {
arrayOf(Item(Items.IRON_BAR_2351,2))
}
}
if(requiresNeedle){
if(player.inventory.containsItem(Item(Items.NEEDLE_1733)) && player.inventory.containItems(*requiredItems.map { it.id }.toIntArray())) {
player.inventory.remove(*requiredItems)
if (Random().nextBoolean()) player.inventory.remove(Item(Items.NEEDLE_1733))
} else {
player.dialogueInterpreter.sendDialogue("You need a needle and ${requiredItems.map { "${it.amount} ${it.name.toLowerCase()}s" }.toString().replace("[","").replace("]","")} for this.")
return
}
} else {
if(player.inventory.containsItem(Item(Items.HAMMER_2347)) && player.inventory.containItems(*requiredItems.map { it.id }.toIntArray())) {
val nails = NailType.get(player,4)
if(nails == null && rco == RepairClimbObject.DEATH_PLATEAU){
player.dialogueInterpreter.sendDialogue("You need 4 nails for this.")
return
} else if (rco == RepairClimbObject.DEATH_PLATEAU){
player.inventory.remove(Item(nails.itemId,4))
}
player.inventory.remove(*requiredItems)
} else {
player.dialogueInterpreter.sendDialogue("You need a hammer and ${requiredItems.map { "${it.amount} ${it.name.toLowerCase()}s" }.toString().replace("[","").replace("]","")} for this.")
return
}
}
player.varpManager.get(rco.varp).setVarbit(rco.offset,1).send(player)
player.varpManager.flagSave(rco.varp)
}
private fun climb(player: Player, rco: RepairClimbObject, location: Location){
ForceMovement.run(player,location,rco.getOtherLocation(player),rco.getAnimation(player),rco.getAnimation(player),rco.getDirection(player),20).endAnimation = Animation(-1)
}
private enum class RepairClimbObject(val varp: Int, val offset: Int, val destinationUp: Location?, val destinationDown: Location?, val levelRequirement: Pair<Int,Int>?){
DEATH_PLATEAU(1282,15,Location.create(2949, 3623, 0),Location.create(2954, 3623, 0), Pair(Skills.CONSTRUCTION,42)),
BURTHORPE(1282,14,Location.create(2941, 3563, 0),Location.create(2934, 3563, 0),Pair(Skills.SMITHING,56)),
GWD(1283,27,null,null,Pair(Skills.CRAFTING,60)),
TEMPLE(1287,29,Location.create(2949, 3835, 0),Location.create(2956, 3835, 0),Pair(Skills.SMITHING,64));
fun getOtherLocation(player: Player): Location?{
if(player.location == destinationDown) return destinationUp
else return destinationDown
}
fun getAnimation(player: Player): Animation {
if(getOtherLocation(player) == destinationDown) return Animation(1148)
else return Animation(740)
}
fun getDirection(player: Player): Direction {
if(this == BURTHORPE){
return Direction.EAST
} else return Direction.WEST
}
fun isRepaired(player: Player): Boolean{
return player.varpManager.get(varp).getVarbit(offset) == 1
}
}
companion object {
fun isRepaired(player: Player, beacon: content.minigame.allfiredup.AFUBeacon): Boolean{
if(beacon == content.minigame.allfiredup.AFUBeacon.DEATH_PLATEAU) return RepairClimbObject.DEATH_PLATEAU.isRepaired(player)
if(beacon == content.minigame.allfiredup.AFUBeacon.BURTHORPE) return RepairClimbObject.BURTHORPE.isRepaired(player)
if(beacon == content.minigame.allfiredup.AFUBeacon.GWD) return RepairClimbObject.GWD.isRepaired(player)
if(beacon == content.minigame.allfiredup.AFUBeacon.TEMPLE) return RepairClimbObject.TEMPLE.isRepaired(player)
else return true
}
}
}
@@ -0,0 +1,121 @@
package content.minigame.allfiredup
import core.api.LogoutListener
import core.game.node.entity.player.Player
import core.game.node.item.Item
import core.game.system.task.Pulse
import core.game.world.GameWorld
import org.rs09.consts.Items
import core.tools.colorize
/**
* Handles keeping track of lit beacons and their burn time remaining
* @author Ceikry
*/
class AFUSession(val player: Player? = null) : LogoutListener {
private val beaconTimers = Array(14){i -> BeaconTimer(0, content.minigame.allfiredup.AFUBeacon.values()[i]) }
private val logInventories = Array(14){Item(0,0)}
private val beaconWatched = Array(14){false}
private var isActive = false
fun init() {
isActive = true
GameWorld.Pulser.submit(object: Pulse(){
override fun pulse(): Boolean {
player!!.setAttribute("afu-pulse",this)
beaconTimers.forEach {timer ->
timer.ticks--
if(timer.ticks == 300) timer.beacon.diminish(player).also {
if(beaconWatched[timer.beacon.ordinal]){
beaconWatched[timer.beacon.ordinal] = false
timer.ticks += (getTicks(logInventories[timer.beacon.ordinal].id) * 5)
timer.beacon.light(player)
player.sendMessage(colorize("%RThe ${timer.beacon.name.toLowerCase().replace("_"," ")} watcher has used your backup logs."))
} else {
player.sendMessage(colorize("%RThe ${timer.beacon.name.toLowerCase().replace("_", " ")} beacon is dying!"))
}
}
if(timer.ticks == 0) timer.beacon.extinguish(player).also { player.sendMessage(colorize("%RThe ${timer.beacon.name.toLowerCase().replace("_"," ")} beacon has gone out!")) }
}
return !isActive
}
})
player!!.setAttribute("afu-session",this)
}
fun getLitBeacons(): Int{
return beaconTimers.count { it.ticks > 0 }
}
fun end(){
isActive = false
}
fun setLogs(beaconIndex: Int, logs: Item){
logInventories[beaconIndex] = logs
}
fun startTimer(beaconIndex: Int){
val ticks = getTicks(logInventories[beaconIndex].id) * 20
logInventories[beaconIndex] = Item(0,0)
beaconTimers[beaconIndex].ticks = ticks
}
fun refreshTimer(beacon: content.minigame.allfiredup.AFUBeacon, logID: Int){
val ticks = getTicks(logID) * 5
beaconTimers.forEach {
if(it.beacon.ordinal == beacon.ordinal) it.ticks += ticks
}
}
fun setWatcher(index: Int, logs: Item){
beaconWatched[index] = true
logInventories[index] = logs
}
fun isWatched(index: Int): Boolean{
return beaconWatched[index]
}
fun getTicks(logID: Int): Int{
val ticks = when(logID){
Items.LOGS_1511 -> 65
Items.OAK_LOGS_1521 -> 68
Items.WILLOW_LOGS_1519 -> 73
Items.MAPLE_LOGS_1517 -> 79
Items.YEW_LOGS_1515 -> 83
Items.MAGIC_LOGS_1513 -> 90
else -> 0
}
return ticks
}
fun getBonusExperience(): Double{
return when(getLitBeacons()){
1 -> 608.4
2 -> 1622.4
3 -> 1987.4
4 -> 2149.6
5 -> 2149.6
6 -> 2514.6
7 -> 2555.2
8 -> 2758.0
9 -> 2839.1
10 -> 3041.9
11 -> 3123.0
12 -> 3244.7
13 -> 3366.4
14 -> 4867.4
else -> 0.0
}
}
override fun logout(player: Player) {
content.minigame.allfiredup.AFUBeacon.resetAllBeacons(player)
val session: AFUSession? = player.getAttribute("afu-session",null)
session?.end()
player.removeAttribute("afu-session")
}
internal class BeaconTimer(var ticks: Int, val beacon: content.minigame.allfiredup.AFUBeacon)
}
@@ -0,0 +1,91 @@
package content.minigame.allfiredup
import core.game.dialogue.DialoguePlugin
import core.game.node.entity.npc.NPC
import core.game.node.entity.player.Player
import core.game.node.entity.skill.Skills
import core.game.node.item.Item
import core.plugin.Initializable
import org.rs09.consts.Items
private val VALID_LOGS = arrayOf(Items.LOGS_1511, Items.OAK_LOGS_1521, Items.WILLOW_LOGS_1519, Items.MAPLE_LOGS_1517, Items.YEW_LOGS_1515, Items.MAGIC_LOGS_1513)
@Initializable
//TODO: Add requirements for beacon keepers to watch beacons, most of the requirements were not possible to implement at the time of writing this.
class BeaconTenderDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(player) {
var index = 0
override fun newInstance(player: Player?): core.game.dialogue.DialoguePlugin {
return BeaconTenderDialogue(player)
}
override fun open(vararg args: Any?): Boolean {
index = getIndexOf((args[0] as NPC).originalId)
if(index == content.minigame.allfiredup.AFUBeacon.GWD.ordinal && player.skills.getLevel(Skills.SUMMONING) < 81){
npc("Awwf uurrrhur","(You need 81 Summoning to communicate with Nanuq.)")
stage = 1000
return true
}
if(index == content.minigame.allfiredup.AFUBeacon.MONASTERY.ordinal && player.skills.getLevel(Skills.PRAYER) < 53){
npc("I will aid you when your devotion is","strong enough.","(You need 53 Prayer for him to watch the beacon.)")
stage = 1000
return true
}
npc = (args[0] as NPC).getShownNPC(player)
npc("Hello, adventurer.")
return true
}
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
val beacon = content.minigame.allfiredup.AFUBeacon.values()[index]
val logs = getLogs(player,5)
val session: AFUSession? = player.getAttribute("afu-session",null)
when(stage){
0 -> player("Hello!").also { stage++ }
1 -> if(beacon.getState(player) == content.minigame.allfiredup.BeaconState.LIT && session?.isWatched(index) == false){
options("Can you watch this beacon for me?","Nevermind.").also { stage = 10 }
} else {
npc("Carry on, adventurer.").also { stage = 1000 }
}
10 -> when(buttonId){
1 -> player("Can you watch this beacon for me?").also { stage++ }
2 -> player("Nevermind.").also { stage = 1000 }
}
11 -> npc("Certainly, adventurer. Do you have logs for me?").also { stage++ }
12 -> if(logs.id != 0){
player("Yes, I do!").also { stage++ }
} else {
player("No, I don't.").also { stage = 1000 }
}
13 -> npc("Great, hand them over.").also { stage++ }
14 -> player("Here you go!").also {
player.inventory.remove(logs)
session?.setWatcher(index,logs)
stage = 1000
}
1000 -> end()
}
return true
}
fun getIndexOf(id: Int): Int{
if(id == 8065) return 0
if(id == 8066) return 1
for(index in ids.indices){
if(ids[index] == id) return index + 2
}
return -1
}
fun getLogs(player: Player, amount: Int): Item {
var logId = 0
for (log in VALID_LOGS) if (player.inventory.getAmount(log) >= amount) {logId = log; break}
return Item(logId,amount)
}
override fun getIds(): IntArray {
return intArrayOf(8067,8068,8069,8070,8071,8072,8073,8074,8075,8076)
}
}
@@ -0,0 +1,47 @@
package content.minigame.allfiredup
import core.game.node.item.Item
import org.rs09.consts.Items
import core.game.dialogue.DialogueFile
import core.tools.END_DIALOGUE
import core.tools.START_DIALOGUE
class KingRoaldAFUMiniDialogue : DialogueFile() {
override fun handle(componentID: Int, buttonID: Int) {
when(stage){
START_DIALOGUE -> npc("Did what?").also { stage++ }
1 -> {
if (player!!.getAttribute("afu-mini:adze", false)) {
player("I lit all 14 beacons at once!")
} else if (player!!.getAttribute("afu-mini:gloves", false)) {
player("I lit 10 beacons at once!")
} else if (player!!.getAttribute("afu-mini:ring", false)) {
player("I lit 6 beacons at once!")
}
stage++
}
2 -> {
npc("Oh, wonderful! Here is your reward then.")
if (player!!.getAttribute(
"afu-mini:adze",
false
)
) if (player!!.inventory.add(Item(Items.INFERNO_ADZE_13661))) player!!.removeAttribute("afu-mini:adze")
if (player!!.getAttribute(
"afu-mini:gloves",
false
)
) if (player!!.inventory.add(Item(Items.FLAME_GLOVES_13660))) player!!.removeAttribute("afu-mini:gloves")
if (player!!.getAttribute(
"afu-mini:ring",
false
)
) if (player!!.inventory.add(Item(Items.RING_OF_FIRE_13659))) player!!.removeAttribute("afu-mini:ring")
stage = END_DIALOGUE
}
END_DIALOGUE -> end()
}
}
}