Code cleanup

Reorganised imports
Removed redundant qualifiers
This commit is contained in:
bushtail
2023-08-19 15:07:23 +00:00
committed by Ryan
parent 0eca9521bc
commit 1b4e0aafaa
346 changed files with 2871 additions and 2886 deletions
@@ -27,11 +27,11 @@ enum class AFUBeacon(val title: String, val fmLevel: Int, val varbit: Int, val l
PLATEAU("",92,5159,Location.create(2964, 3931, 0),147.9);
companion object {
fun forLocation(location: Location): content.minigame.allfiredup.AFUBeacon {
fun forLocation(location: Location): AFUBeacon {
for (beacon in values()) {
if (beacon.location.equals(location)) return beacon
}
return content.minigame.allfiredup.AFUBeacon.RIVER_SALVE.also { log(this::class.java, Log.WARN, "Unhandled Beacon Location ${location.toString()}") }
return AFUBeacon.RIVER_SALVE.also { log(this::class.java, Log.WARN, "Unhandled Beacon Location ${location.toString()}") }
}
fun resetAllBeacons(player: Player){
@@ -61,7 +61,7 @@ enum class AFUBeacon(val title: String, val fmLevel: Int, val varbit: Int, val l
setVarbit(player, varbit, 1, true)
}
fun getState(player: Player): content.minigame.allfiredup.BeaconState {
fun getState(player: Player): BeaconState {
return BeaconState.values()[getVarbit(player, varbit)]
}
}
@@ -23,26 +23,26 @@ class AFUBeaconListeners : InteractionListener {
override fun defineListeners() {
on(IntType.SCENERY,"add-logs","light"){ player, node ->
val beacon = content.minigame.allfiredup.AFUBeacon.forLocation(node.location)
val beacon = 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)) {
if ((beacon != AFUBeacon.RIVER_SALVE && beacon != AFUBeacon.RAG_AND_BONE && !questComplete)
|| (beacon == AFUBeacon.RIVER_SALVE && questStage < 20 && !questComplete)
|| (beacon == 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)
BeaconState.EMPTY -> fillBeacon(player, beacon, questComplete)
content.minigame.allfiredup.BeaconState.DYING -> restoreBeacon(player, beacon, questComplete)
BeaconState.DYING -> restoreBeacon(player, beacon, questComplete)
content.minigame.allfiredup.BeaconState.FILLED -> lightBeacon(player, beacon, questComplete)
BeaconState.FILLED -> lightBeacon(player, beacon, questComplete)
content.minigame.allfiredup.BeaconState.LIT, content.minigame.allfiredup.BeaconState.WARNING -> {
BeaconState.LIT, BeaconState.WARNING -> {
player.debug("INVALID BEACON STATE")
}
}
@@ -50,24 +50,24 @@ class AFUBeaconListeners : InteractionListener {
}
}
fun fillBeacon(player: Player, beacon: content.minigame.allfiredup.AFUBeacon, questComplete: Boolean){
fun fillBeacon(player: Player, beacon: AFUBeacon, questComplete: Boolean){
when(beacon){
content.minigame.allfiredup.AFUBeacon.MONASTERY -> {
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 -> {
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 -> {
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
@@ -117,7 +117,7 @@ class AFUBeaconListeners : InteractionListener {
}
}
fun lightBeacon(player: Player, beacon: content.minigame.allfiredup.AFUBeacon, questComplete: Boolean){
fun lightBeacon(player: Player, beacon: AFUBeacon, questComplete: Boolean){
var session: AFUSession? = null
if(questComplete){
session = player.getAttribute("afu-session",null)
@@ -164,7 +164,7 @@ class AFUBeaconListeners : InteractionListener {
}
}
fun restoreBeacon(player: Player, beacon: content.minigame.allfiredup.AFUBeacon, questComplete: Boolean){
fun restoreBeacon(player: Player, beacon: AFUBeacon, questComplete: Boolean){
var session: AFUSession? = null
if(questComplete){
session = player.getAttribute("afu-session",null)
@@ -129,11 +129,11 @@ class AFURepairClimbHandler : InteractionListener {
}
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)
fun isRepaired(player: Player, beacon: AFUBeacon): Boolean{
if(beacon == AFUBeacon.DEATH_PLATEAU) return RepairClimbObject.DEATH_PLATEAU.isRepaired(player)
if(beacon == AFUBeacon.BURTHORPE) return RepairClimbObject.BURTHORPE.isRepaired(player)
if(beacon == AFUBeacon.GWD) return RepairClimbObject.GWD.isRepaired(player)
if(beacon == AFUBeacon.TEMPLE) return RepairClimbObject.TEMPLE.isRepaired(player)
else return true
}
}
@@ -13,7 +13,7 @@ import core.tools.colorize
* @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 beaconTimers = Array(14){i -> BeaconTimer(0, AFUBeacon.values()[i]) }
private val logInventories = Array(14){Item(0,0)}
private val beaconWatched = Array(14){false}
private var isActive = false
@@ -61,7 +61,7 @@ class AFUSession(val player: Player? = null) : LogoutListener {
beaconTimers[beaconIndex].ticks = ticks
}
fun refreshTimer(beacon: content.minigame.allfiredup.AFUBeacon, logID: Int){
fun refreshTimer(beacon: AFUBeacon, logID: Int){
val ticks = getTicks(logID) * 5
beaconTimers.forEach {
if(it.beacon.ordinal == beacon.ordinal) it.ticks += ticks
@@ -111,11 +111,11 @@ class AFUSession(val player: Player? = null) : LogoutListener {
}
override fun logout(player: Player) {
content.minigame.allfiredup.AFUBeacon.resetAllBeacons(player)
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)
internal class BeaconTimer(var ticks: Int, val beacon: AFUBeacon)
}
@@ -14,22 +14,22 @@ private val VALID_LOGS = arrayOf(Items.LOGS_1511, Items.OAK_LOGS_1521, Items.WIL
@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) {
class BeaconTenderDialogue(player: Player? = null) : DialoguePlugin(player) {
var index = 0
override fun newInstance(player: Player?): core.game.dialogue.DialoguePlugin {
override fun newInstance(player: Player?): DialoguePlugin {
return BeaconTenderDialogue(player)
}
override fun open(vararg args: Any?): Boolean {
npc = (args[0] as NPC).getShownNPC(player)
index = getIndexOf((args[0] as NPC).originalId)
if(index == content.minigame.allfiredup.AFUBeacon.GWD.ordinal && player.skills.getLevel(Skills.SUMMONING) < 81){
if(index == 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){
if(index == 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 assist you.)")
stage = 1000
return true
@@ -39,12 +39,12 @@ class BeaconTenderDialogue(player: Player? = null) : core.game.dialogue.Dialogue
}
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
val beacon = content.minigame.allfiredup.AFUBeacon.values()[index]
val beacon = 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){
1 -> if(beacon.getState(player) == 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 }
@@ -14,14 +14,14 @@ import java.time.temporal.ChronoUnit
import java.util.*
@Initializable
class CaptainCainDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(player) {
class CaptainCainDialogue(player: Player? = null) : DialoguePlugin(player) {
val sdf = SimpleDateFormat("ddMMyyyy")
override fun newInstance(player: Player?): core.game.dialogue.DialoguePlugin {
override fun newInstance(player: Player?): DialoguePlugin {
return CaptainCainDialogue(player)
}
override fun open(vararg args: Any?): Boolean {
npcl(core.game.dialogue.FacialExpression.FRIENDLY, "Hello, there, adventurer. Say, you wouldn't happen to be interested in purchasing a Fighter Torso would you?")
npcl(FacialExpression.FRIENDLY, "Hello, there, adventurer. Say, you wouldn't happen to be interested in purchasing a Fighter Torso would you?")
stage = 0
return true
}
@@ -31,26 +31,26 @@ class CaptainCainDialogue(player: Player? = null) : core.game.dialogue.DialogueP
val now = Date().toInstant()
val days = ChronoUnit.DAYS.between(start,now)
when(stage){
0 -> npcl(core.game.dialogue.FacialExpression.ANNOYED,"I'm having to offer this service because it's been $days days since Ryan promised to give us barbarian assault.").also { stage++ }
0 -> npcl(FacialExpression.ANNOYED,"I'm having to offer this service because it's been $days days since Ryan promised to give us barbarian assault.").also { stage++ }
1 -> options("Yes, please.","No, thanks.").also { stage++ }
2 -> when(buttonId){
1 -> playerl(core.game.dialogue.FacialExpression.FRIENDLY, "Yes, please.").also { stage = 10 }
2 -> playerl(core.game.dialogue.FacialExpression.HALF_THINKING, "No, thanks.").also { stage = END_DIALOGUE }
1 -> playerl(FacialExpression.FRIENDLY, "Yes, please.").also { stage = 10 }
2 -> playerl(FacialExpression.HALF_THINKING, "No, thanks.").also { stage = END_DIALOGUE }
}
10 -> npcl(core.game.dialogue.FacialExpression.FRIENDLY, "Alright, then, that'll be 7,500,000 gold please.").also { stage++ }
10 -> npcl(FacialExpression.FRIENDLY, "Alright, then, that'll be 7,500,000 gold please.").also { stage++ }
11 -> options("Here you go!","Nevermind.").also { stage++ }
12 -> when(buttonId){
1 -> if(inInventory(player, 995, 7500000))
playerl(core.game.dialogue.FacialExpression.FRIENDLY, "Here you go!").also { stage = 20 }
playerl(FacialExpression.FRIENDLY, "Here you go!").also { stage = 20 }
else
playerl(core.game.dialogue.FacialExpression.HALF_GUILTY, "Actually, I don't have that much.").also { stage = END_DIALOGUE }
playerl(FacialExpression.HALF_GUILTY, "Actually, I don't have that much.").also { stage = END_DIALOGUE }
2 -> playerl(core.game.dialogue.FacialExpression.FRIENDLY, "On second thought, nevermind.").also { stage = END_DIALOGUE }
2 -> playerl(FacialExpression.FRIENDLY, "On second thought, nevermind.").also { stage = END_DIALOGUE }
}
20 -> {
npcl(core.game.dialogue.FacialExpression.FRIENDLY, "Thank you much, kind sir. And here's your torso.")
npcl(FacialExpression.FRIENDLY, "Thank you much, kind sir. And here's your torso.")
if(removeItem(player, Item(995,7500000), Container.INVENTORY)) {
addItem(player, Items.FIGHTER_TORSO_10551, 1)
}
@@ -93,7 +93,7 @@ object RewardChest {
player.interfaceManager.open(Component(Components.TRAIL_REWARD_364))
BossKillCounter.addtoBarrowsCount(player)
for(item in rewards){
announceIfRare(player, item);
announceIfRare(player, item)
if(!player.inventory.add(item)){
GroundItemManager.create(item,player)
}
@@ -185,7 +185,7 @@ object BlastFurnace {
if(bar.product.id == Items.GOLD_BAR_2357 &&
player.equipment[EquipmentContainer.SLOT_HANDS] != null &&
player.equipment[EquipmentContainer.SLOT_HANDS].id == GOLDSMITH_GAUNTLETS_776) {
experience *= 2.5;
experience *= 2.5
}
rewardXP(player, Skills.SMITHING, experience)
totalAmount = barsAmount + oreAmount
@@ -19,13 +19,13 @@ import core.tools.START_DIALOGUE
* @author vddCore
*/
@Initializable
class MaximillianSackvilleDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(player) {
class MaximillianSackvilleDialogue(player: Player? = null) : DialoguePlugin(player) {
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when (stage) {
START_DIALOGUE -> when {
hasIronmanRestriction(player, IronmanMode.ULTIMATE) -> {
npcl(
core.game.dialogue.FacialExpression.NEUTRAL,
FacialExpression.NEUTRAL,
"My apologies, dear ${if (player.isMale) "sir" else "madam"}, " +
"our services are not available for Ultimate ${if (player.isMale) "Ironmen" else "Ironwomen"}."
).also { stage = END_DIALOGUE }
@@ -33,7 +33,7 @@ class MaximillianSackvilleDialogue(player: Player? = null) : core.game.dialogue.
else -> {
npcl(
core.game.dialogue.FacialExpression.NEUTRAL,
FacialExpression.NEUTRAL,
"Good day, how may I help you?"
).also {
if (hasAwaitingGrandExchangeCollections(player)) {
@@ -46,44 +46,44 @@ class MaximillianSackvilleDialogue(player: Player? = null) : core.game.dialogue.
}
1 -> npcl(
core.game.dialogue.FacialExpression.NEUTRAL,
FacialExpression.NEUTRAL,
"Before we go any further, I should inform you that you " +
"have items ready for collection from the Grand Exchange."
).also { stage++ }
2 -> playerl(
core.game.dialogue.FacialExpression.ASKING,
FacialExpression.ASKING,
"Who are you?"
).also { stage++ }
3 -> npcl(
core.game.dialogue.FacialExpression.NEUTRAL,
FacialExpression.NEUTRAL,
"How inconsiderate of me, dear ${if (player.isMale) "sir" else "madam"}. " +
"My name is Maximillian Sackville and I conduct operations here on behalf " +
"of The Bank of Gielinor."
).also { stage++ }
4 -> showTopics(
Topic(core.game.dialogue.FacialExpression.NEUTRAL, "I'd like to access my bank account.", 10),
Topic(FacialExpression.NEUTRAL, "I'd like to access my bank account.", 10),
IfTopic(
core.game.dialogue.FacialExpression.NEUTRAL,
FacialExpression.NEUTRAL,
"I'd like to switch to my ${getBankAccountName(player, true)} bank account.",
11,
hasActivatedSecondaryBankAccount(player)
),
Topic(core.game.dialogue.FacialExpression.NEUTRAL, "I'd like to check my PIN settings.", 12),
Topic(core.game.dialogue.FacialExpression.NEUTRAL, "I'd like to collect items.", 13),
Topic(core.game.dialogue.FacialExpression.ASKING, "Aren't you afraid of working in the Wilderness?", 5)
Topic(FacialExpression.NEUTRAL, "I'd like to check my PIN settings.", 12),
Topic(FacialExpression.NEUTRAL, "I'd like to collect items.", 13),
Topic(FacialExpression.ASKING, "Aren't you afraid of working in the Wilderness?", 5)
)
5 -> npcl(
core.game.dialogue.FacialExpression.NEUTRAL,
FacialExpression.NEUTRAL,
"While the Wilderness is quite a dangerous place, The Bank of Gielinor offers " +
"us - roving bankers - extraordinary benefits for our hard work in hazardous environments."
).also { stage++ }
6 -> npcl(
core.game.dialogue.FacialExpression.NEUTRAL,
FacialExpression.NEUTRAL,
"This allows us to provide our services to customers regardless of their current " +
"whereabouts. Our desire to serve is stronger than our fear of the Wilderness."
).also { stage = END_DIALOGUE }
@@ -97,7 +97,7 @@ class MaximillianSackvilleDialogue(player: Player? = null) : core.game.dialogue.
toggleBankAccount(player)
npcl(
core.game.dialogue.FacialExpression.NEUTRAL,
FacialExpression.NEUTRAL,
"Naturally. You can now access your ${getBankAccountName(player)} bank account."
).also { stage = END_DIALOGUE }
}
@@ -14,9 +14,9 @@ object CastleWarsOverlay {
@JvmStatic
fun sendGameUpdate(player: Player) {
// Todo - Figure out underground mine/etc
setVarbit(player, 143, 0); // Flag status - safe = 0, taken = 1, dropped = 2
setVarbit(player, 145, 5); // Saradomin's score
setVarbit(player, 153, 0); // Flag status - safe = 0, taken = 1, dropped = 2
setVarbit(player, 155, 7); // Zamorak's score
setVarbit(player, 143, 0) // Flag status - safe = 0, taken = 1, dropped = 2
setVarbit(player, 145, 5) // Saradomin's score
setVarbit(player, 153, 0) // Flag status - safe = 0, taken = 1, dropped = 2
setVarbit(player, 155, 7) // Zamorak's score
}
}
@@ -11,12 +11,12 @@ import core.plugin.Initializable
*/
@Initializable
class AfrahDialogue : core.game.dialogue.DialoguePlugin {
class AfrahDialogue : DialoguePlugin {
private val conversations = arrayOf (0, 4, 10, 11, 15, 17, 20, 22, 23, 24, 29, 32)
override fun open(vararg args: Any): Boolean {
player(core.game.dialogue.FacialExpression.ASKING, "Hi!")
player(FacialExpression.ASKING, "Hi!")
stage = conversations.random()
npc = args[0] as NPC
return true
@@ -32,135 +32,135 @@ class AfrahDialogue : core.game.dialogue.DialoguePlugin {
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when (stage) {
0 -> {
npc(core.game.dialogue.FacialExpression.ASKING, "Ooh. This is exciting!")
npc(FacialExpression.ASKING, "Ooh. This is exciting!")
stage++
}
1 -> {
player(core.game.dialogue.FacialExpression.ASKING, "Yup!")
player(FacialExpression.ASKING, "Yup!")
stage = 99
}
2 -> {
npc(core.game.dialogue.FacialExpression.ASKING, "I wouldn't want to be the poor guy that has to", "clean up after the duels.")
npc(FacialExpression.ASKING, "I wouldn't want to be the poor guy that has to", "clean up after the duels.")
stage++
}
3 -> {
player(core.game.dialogue.FacialExpression.ASKING, "Me neither.")
player(FacialExpression.ASKING, "Me neither.")
stage = 99
}
4 -> {
npc(core.game.dialogue.FacialExpression.ASKING, "My son just won his first duel!")
npc(FacialExpression.ASKING, "My son just won his first duel!")
stage++
}
5 -> {
player(core.game.dialogue.FacialExpression.ASKING, "Congratulations!")
player(FacialExpression.ASKING, "Congratulations!")
stage++
}
6 -> {
npc(core.game.dialogue.FacialExpression.ASKING, "He ripped his opponent in half!")
npc(FacialExpression.ASKING, "He ripped his opponent in half!")
stage++
}
7 -> {
player(core.game.dialogue.FacialExpression.ASKING, "That's gotta hurt!")
player(FacialExpression.ASKING, "That's gotta hurt!")
stage++
}
8 -> {
npc(core.game.dialogue.FacialExpression.ASKING, "He's only 10 as well!")
npc(FacialExpression.ASKING, "He's only 10 as well!")
stage++
}
9 -> {
player(core.game.dialogue.FacialExpression.ASKING, "You gotta start 'em young!")
player(FacialExpression.ASKING, "You gotta start 'em young!")
stage = 99
}
10 -> {
npc(core.game.dialogue.FacialExpression.ASKING, "Hmph.")
npc(FacialExpression.ASKING, "Hmph.")
stage = 99
}
11 -> {
npc(core.game.dialogue.FacialExpression.ASKING, "My favourite fighter is Mubariz!")
npc(FacialExpression.ASKING, "My favourite fighter is Mubariz!")
stage++
}
12 -> {
player(core.game.dialogue.FacialExpression.ASKING, "The guy at the information kiosk?")
player(FacialExpression.ASKING, "The guy at the information kiosk?")
stage++
}
13 -> {
npc(core.game.dialogue.FacialExpression.ASKING, "Yeah! He rocks!")
npc(FacialExpression.ASKING, "Yeah! He rocks!")
stage++
}
14 -> {
player(core.game.dialogue.FacialExpression.ASKING, "Takes all sorts, I guess.")
player(FacialExpression.ASKING, "Takes all sorts, I guess.")
stage = 99
}
15 -> {
npc(core.game.dialogue.FacialExpression.ASKING, "Hi! I'm here to watch the duels!")
npc(FacialExpression.ASKING, "Hi! I'm here to watch the duels!")
stage++
}
16 -> {
player(core.game.dialogue.FacialExpression.ASKING, "Me too!")
player(FacialExpression.ASKING, "Me too!")
stage = 99
}
17 -> {
npc(core.game.dialogue.FacialExpression.ASKING, "Did you know they think this place dates","back to the second age?!")
npc(FacialExpression.ASKING, "Did you know they think this place dates","back to the second age?!")
stage++
}
18 -> {
player(core.game.dialogue.FacialExpression.ASKING, "Really?")
player(FacialExpression.ASKING, "Really?")
stage++
}
19 -> {
npc(core.game.dialogue.FacialExpression.ASKING, "Yeah. The guy at the information kiosk was telling me.")
npc(FacialExpression.ASKING, "Yeah. The guy at the information kiosk was telling me.")
stage = 99
}
20 -> {
npc(core.game.dialogue.FacialExpression.ANGRY, "Can't you see I'm watching the duels?")
npc(FacialExpression.ANGRY, "Can't you see I'm watching the duels?")
stage++
}
21 -> {
player(core.game.dialogue.FacialExpression.SAD, "I'm sorry!")
player(FacialExpression.SAD, "I'm sorry!")
stage = 99
}
22 -> {
npc(core.game.dialogue.FacialExpression.ASKING, "Well. This beats doing the shopping!")
npc(FacialExpression.ASKING, "Well. This beats doing the shopping!")
stage = 99
}
23 -> {
npc(core.game.dialogue.FacialExpression.ASKING, "Hi!")
npc(FacialExpression.ASKING, "Hi!")
stage = 99
}
24 -> {
npc(core.game.dialogue.FacialExpression.ASKING, "Knock knock!")
npc(FacialExpression.ASKING, "Knock knock!")
stage++
}
25 -> {
player(core.game.dialogue.FacialExpression.ASKING, "Who's there?")
player(FacialExpression.ASKING, "Who's there?")
stage++
}
26 -> {
npc(core.game.dialogue.FacialExpression.ASKING, "Boo!")
npc(FacialExpression.ASKING, "Boo!")
stage++
}
27 -> {
player(core.game.dialogue.FacialExpression.ASKING, "Boo who?")
player(FacialExpression.ASKING, "Boo who?")
stage++
}
28 -> {
npc(core.game.dialogue.FacialExpression.LAUGH, "Don't cry, it's just me!")
npc(FacialExpression.LAUGH, "Don't cry, it's just me!")
stage = 99
}
29 -> {
npc(core.game.dialogue.FacialExpression.ASKING, "Why did the skeleton burp?")
npc(FacialExpression.ASKING, "Why did the skeleton burp?")
stage++
}
30 -> {
player(core.game.dialogue.FacialExpression.ASKING, "I don't know?")
player(FacialExpression.ASKING, "I don't know?")
stage++
}
31 -> {
npc(core.game.dialogue.FacialExpression.ASKING, "'Cause it didn't have the guts to fart!")
npc(FacialExpression.ASKING, "'Cause it didn't have the guts to fart!")
stage = 99
}
32 -> {
npc(core.game.dialogue.FacialExpression.ASKING, "Waaaaassssssuuuuupp?!.")
npc(FacialExpression.ASKING, "Waaaaassssssuuuuupp?!.")
stage = 99
}
99 -> end()
@@ -168,7 +168,7 @@ class AfrahDialogue : core.game.dialogue.DialoguePlugin {
return true
}
override fun newInstance(player: Player): core.game.dialogue.DialoguePlugin {
override fun newInstance(player: Player): DialoguePlugin {
return AfrahDialogue(player)
}
}
@@ -26,8 +26,8 @@ class FogInteractionHandler : PluginInteraction(30204, 30203){
override fun pulse(): Boolean {
player.faceLocation(obj.location)
when(obj.id) {
30204 -> core.game.global.action.ClimbActionHandler.climbLadder(player, obj, "climb-down")
30203 -> core.game.global.action.ClimbActionHandler.climbLadder(player,obj,"climb-up")
30204 -> ClimbActionHandler.climbLadder(player, obj, "climb-down")
30203 -> ClimbActionHandler.climbLadder(player,obj,"climb-up")
}
return true
}
@@ -50,7 +50,7 @@ class GnomeCrunchyInterface : ComponentPlugin() {
for(item in crunchy.requiredItems){
if(!player.inventory.containsItem(item)){
hasAll = false
break;
break
}
}
@@ -86,7 +86,7 @@ class EnchantSpell : MagicSpell {
}
}
if (pizazz != 0) {
content.minigame.mta.impl.EnchantingZone.ZONE.incrementPoints(entity, content.minigame.mta.MTAType.ENCHANTERS.ordinal, pizazz)
content.minigame.mta.impl.EnchantingZone.ZONE.incrementPoints(entity, MTAType.ENCHANTERS.ordinal, pizazz)
}
}
return true
@@ -18,7 +18,7 @@ class MTAListeners : InteractionListener {
return@on true
}
setDest(IntType.NPC, intArrayOf(NPCs.MAZE_GUARDIAN_3102), "talk-to") { player, node ->
return@setDest node.location.transform(Direction.getDirection(player.location, node.location), -1);
return@setDest node.location.transform(Direction.getDirection(player.location, node.location), -1)
}
}
}
@@ -61,12 +61,12 @@ object PestControlHelper {
return false
}
fun getMyPestControlSession1(p: PestControlTestBot): content.minigame.pestcontrol.PestControlSession? {
return p.getExtension(content.minigame.pestcontrol.PestControlSession::class.java)
fun getMyPestControlSession1(p: PestControlTestBot): PestControlSession? {
return p.getExtension(PestControlSession::class.java)
}
fun getMyPestControlSession2(p: PestControlTestBot2): content.minigame.pestcontrol.PestControlSession? {
return p.getExtension(content.minigame.pestcontrol.PestControlSession::class.java)
fun getMyPestControlSession2(p: PestControlTestBot2): PestControlSession? {
return p.getExtension(PestControlSession::class.java)
}
}
@@ -32,7 +32,7 @@ class CombatState(val bot: PestControlTestBot) {
removeList.add(port)
} else {
portal = port
break;
break
}
}
sesh.aportals.removeAll(removeList)
@@ -31,7 +31,7 @@ class CombatStateIntermediate(val bot: PestControlTestBot2) {
removeList.add(port)
} else {
portal = port
break;
break
}
}
sesh.aportals.removeAll(removeList)
@@ -34,7 +34,7 @@ class PestControlTestBot2(l: Location) : PvMBots(legitimizeLocation(l)) {
init {
val random100 = Random().nextInt(100)
if (random100 < 30) {
setAttribute("pc_role","defend_squire");
setAttribute("pc_role","defend_squire")
} else
{
setAttribute("pc_role","attack_portals")
@@ -160,8 +160,8 @@ class PestControlTestBot2(l: Location) : PvMBots(legitimizeLocation(l)) {
this.walkToPosSmart(myBoat.outsideBoatBorder.randomLoc)
movetimer += RandomFunction.normalPlusWeightRandDist(400, 200)
}
movetimer = RandomFunction.normalPlusWeightRandDist(100, 50);
return;
movetimer = RandomFunction.normalPlusWeightRandDist(100, 50)
return
}
val test = getClosestNodeWithEntry(15, myBoat.ladderId)
test ?: randomWalk(1,1)
@@ -34,7 +34,7 @@ class PestControlTestBot(l: Location) : PvMBots(legitimizeLocation(l)){
init {
val random100 = Random().nextInt(100)
if (random100 < 30) {
setAttribute("pc_role","defend_squire");
setAttribute("pc_role","defend_squire")
} else
{
setAttribute("pc_role","attack_portals")
@@ -156,8 +156,8 @@ class PestControlTestBot(l: Location) : PvMBots(legitimizeLocation(l)){
this.walkToPosSmart(myBoat.outsideBoatBorder.randomLoc)
movetimer += RandomFunction.normalPlusWeightRandDist(400, 200)
}
movetimer = RandomFunction.normalPlusWeightRandDist(100, 50);
return;
movetimer = RandomFunction.normalPlusWeightRandDist(100, 50)
return
}
val test = getClosestNodeWithEntry(15, myBoat.ladderId)
test ?: randomWalk(1,1)
@@ -9,52 +9,52 @@ import org.rs09.consts.NPCs
import core.tools.END_DIALOGUE
@Initializable
class GuardianMummyDialogue(player: Player? = null) : core.game.dialogue.DialoguePlugin(player) {
class GuardianMummyDialogue(player: Player? = null) : DialoguePlugin(player) {
override fun open(vararg args: Any?): Boolean {
npcl(core.game.dialogue.FacialExpression.OLD_NOT_INTERESTED, "*sigh* Not another one.")
npcl(FacialExpression.OLD_NOT_INTERESTED, "*sigh* Not another one.")
return true
}
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when(stage){
0 -> playerl(core.game.dialogue.FacialExpression.HALF_ASKING, "Another what?").also { stage++ }
1 -> npcl(core.game.dialogue.FacialExpression.OLD_NOT_INTERESTED, "Another 'archaeologist'. I'm not going to let you plunder my master's tomb you know.").also { stage++ }
2 -> playerl(core.game.dialogue.FacialExpression.NEUTRAL, "That's a shame. Have you got anything else I could do while I'm here?").also { stage++ }
3 -> npcl(core.game.dialogue.FacialExpression.OLD_NOT_INTERESTED, "If it will keep you out of mischief I suppose I could set something up for you... I have a few rooms full of some things you humans might consider valuable, do you want to give it a go?").also { stage++ }
0 -> playerl(FacialExpression.HALF_ASKING, "Another what?").also { stage++ }
1 -> npcl(FacialExpression.OLD_NOT_INTERESTED, "Another 'archaeologist'. I'm not going to let you plunder my master's tomb you know.").also { stage++ }
2 -> playerl(FacialExpression.NEUTRAL, "That's a shame. Have you got anything else I could do while I'm here?").also { stage++ }
3 -> npcl(FacialExpression.OLD_NOT_INTERESTED, "If it will keep you out of mischief I suppose I could set something up for you... I have a few rooms full of some things you humans might consider valuable, do you want to give it a go?").also { stage++ }
4 -> player.dialogueInterpreter.sendOptions("Play Pyramid Plunder?", "That sounds like fun; what do I do?", "Not right now.", "I know what I'm doing, so let's get on with it.").also { stage++ }
5 -> when(buttonId)
{
1 -> playerl(core.game.dialogue.FacialExpression.FRIENDLY, "That sounds like fun; what do I do?").also { stage = 10 }
2 -> playerl(core.game.dialogue.FacialExpression.NEUTRAL, "Not right now.").also { stage = END_DIALOGUE }
3 -> playerl(core.game.dialogue.FacialExpression.ANNOYED, "I know what I'm doing, so let's get on with it.").also { stage = 100 }
1 -> playerl(FacialExpression.FRIENDLY, "That sounds like fun; what do I do?").also { stage = 10 }
2 -> playerl(FacialExpression.NEUTRAL, "Not right now.").also { stage = END_DIALOGUE }
3 -> playerl(FacialExpression.ANNOYED, "I know what I'm doing, so let's get on with it.").also { stage = 100 }
}
10 -> npcl(core.game.dialogue.FacialExpression.OLD_NOT_INTERESTED, "You have five minutes to explore the treasure rooms and collect as many artefacts as you can. The artefacts are in the urns, chests and sarcophagi found in each room.").also { stage++ }
11 -> npcl(core.game.dialogue.FacialExpression.OLD_NOT_INTERESTED, "There are eight treasure rooms, each subsequent room requires higher thieving skills to both enter the room and thieve from the urns and other containers.").also { stage++ }
12 -> npcl(core.game.dialogue.FacialExpression.OLD_NOT_INTERESTED, "The rewards also become more lucrative the further into the tomb you go. You will also have to deactivate a trap in order to enter the main part of each room.").also { stage++ }
13 -> npcl(core.game.dialogue.FacialExpression.OLD_NOT_INTERESTED, "When you want to move onto the next room you need to find the correct door first.").also { stage++ }
14 -> npcl(core.game.dialogue.FacialExpression.OLD_NOT_INTERESTED, "There are four possible exits... you must open the door before finding out whether it is the exit or not. Opening the doors require picking their locks. Having a lockpick will make this easier.").also { stage++ }
10 -> npcl(FacialExpression.OLD_NOT_INTERESTED, "You have five minutes to explore the treasure rooms and collect as many artefacts as you can. The artefacts are in the urns, chests and sarcophagi found in each room.").also { stage++ }
11 -> npcl(FacialExpression.OLD_NOT_INTERESTED, "There are eight treasure rooms, each subsequent room requires higher thieving skills to both enter the room and thieve from the urns and other containers.").also { stage++ }
12 -> npcl(FacialExpression.OLD_NOT_INTERESTED, "The rewards also become more lucrative the further into the tomb you go. You will also have to deactivate a trap in order to enter the main part of each room.").also { stage++ }
13 -> npcl(FacialExpression.OLD_NOT_INTERESTED, "When you want to move onto the next room you need to find the correct door first.").also { stage++ }
14 -> npcl(FacialExpression.OLD_NOT_INTERESTED, "There are four possible exits... you must open the door before finding out whether it is the exit or not. Opening the doors require picking their locks. Having a lockpick will make this easier.").also { stage++ }
15 -> player.dialogueInterpreter.sendOptions("Do you have any more questions?", "How do I leave the game?", "How do I get the artefacts?", "What do I do with the artefacts I collect?", "I'm ready to give it a go now.").also { stage++ }
16 -> when(buttonId)
{
1 -> playerl(core.game.dialogue.FacialExpression.FRIENDLY, "How do I leave the game?").also { stage = 20 }
2 -> playerl(core.game.dialogue.FacialExpression.FRIENDLY, "How do I get the artefacts?").also { stage = 30 }
3 -> playerl(core.game.dialogue.FacialExpression.FRIENDLY, "What do I do with the artefacts?").also { stage = 40 }
4 -> playerl(core.game.dialogue.FacialExpression.FRIENDLY, "I'm ready to give it a go now.").also { stage = 100 }
1 -> playerl(FacialExpression.FRIENDLY, "How do I leave the game?").also { stage = 20 }
2 -> playerl(FacialExpression.FRIENDLY, "How do I get the artefacts?").also { stage = 30 }
3 -> playerl(FacialExpression.FRIENDLY, "What do I do with the artefacts?").also { stage = 40 }
4 -> playerl(FacialExpression.FRIENDLY, "I'm ready to give it a go now.").also { stage = 100 }
}
20 -> npcl(core.game.dialogue.FacialExpression.OLD_NOT_INTERESTED, "If at any point you decide you need to leave just use a glowing door. The game will end and you will be taken out of the pyramid").also { stage = 15 }
20 -> npcl(FacialExpression.OLD_NOT_INTERESTED, "If at any point you decide you need to leave just use a glowing door. The game will end and you will be taken out of the pyramid").also { stage = 15 }
30 -> npcl(core.game.dialogue.FacialExpression.OLD_NOT_INTERESTED, "The artefacts are in the urns, chests and sarcophagi. Urns contain snakes that guard them. The sarcophagi take some strength to open. They take a while to open.").also { stage++ }
31 -> npcl(core.game.dialogue.FacialExpression.OLD_NOT_INTERESTED, "Of course, Mummies have been known to take a nap in the sarcophagi, so beware. The golden chests generally contain better artefacts, but are also trapped with scarabs!").also { stage = 15 }
30 -> npcl(FacialExpression.OLD_NOT_INTERESTED, "The artefacts are in the urns, chests and sarcophagi. Urns contain snakes that guard them. The sarcophagi take some strength to open. They take a while to open.").also { stage++ }
31 -> npcl(FacialExpression.OLD_NOT_INTERESTED, "Of course, Mummies have been known to take a nap in the sarcophagi, so beware. The golden chests generally contain better artefacts, but are also trapped with scarabs!").also { stage = 15 }
40 -> npcl(core.game.dialogue.FacialExpression.OLD_NOT_INTERESTED, "There are a number of different artefacts, of three main types. The least valuable are the pottery statuettes and scarabs, and the ivory combs.").also { stage++ }
41 -> npcl(core.game.dialogue.FacialExpression.OLD_NOT_INTERESTED, "Next are the stone scarabs, statuettes and seals, and finally the gold versions of those artefacts. They are not old, but are well made.").also { stage++ }
42 -> playerl(core.game.dialogue.FacialExpression.HALF_ASKING, "What do I do with artefacts once I've collected them?").also { stage++ }
43 -> npcl(core.game.dialogue.FacialExpression.OLD_NOT_INTERESTED, "That Simon Simpleton, I mean Templeton, will probably give you some money for them. He couldn't spot a real artefact if it came up to him and bit him in the face.").also { stage++ }
44 -> npcl(core.game.dialogue.FacialExpression.OLD_NOT_INTERESTED, "He usually slinks about near the pyramid north-east of Sophanem. I expect he's trying to get some poor fools to steal things from that pyramid as well.").also { stage = 15 }
40 -> npcl(FacialExpression.OLD_NOT_INTERESTED, "There are a number of different artefacts, of three main types. The least valuable are the pottery statuettes and scarabs, and the ivory combs.").also { stage++ }
41 -> npcl(FacialExpression.OLD_NOT_INTERESTED, "Next are the stone scarabs, statuettes and seals, and finally the gold versions of those artefacts. They are not old, but are well made.").also { stage++ }
42 -> playerl(FacialExpression.HALF_ASKING, "What do I do with artefacts once I've collected them?").also { stage++ }
43 -> npcl(FacialExpression.OLD_NOT_INTERESTED, "That Simon Simpleton, I mean Templeton, will probably give you some money for them. He couldn't spot a real artefact if it came up to him and bit him in the face.").also { stage++ }
44 -> npcl(FacialExpression.OLD_NOT_INTERESTED, "He usually slinks about near the pyramid north-east of Sophanem. I expect he's trying to get some poor fools to steal things from that pyramid as well.").also { stage = 15 }
100 -> npcl(core.game.dialogue.FacialExpression.OLD_NOT_INTERESTED, "Alright, fine.").also { stage++ }
100 -> npcl(FacialExpression.OLD_NOT_INTERESTED, "Alright, fine.").also { stage++ }
101 -> {
end()
PyramidPlunderMinigame.join(player)
@@ -68,7 +68,7 @@ class GuardianMummyDialogue(player: Player? = null) : core.game.dialogue.Dialogu
return intArrayOf(NPCs.GUARDIAN_MUMMY_4476)
}
override fun newInstance(player: Player?): core.game.dialogue.DialoguePlugin {
override fun newInstance(player: Player?): DialoguePlugin {
return GuardianMummyDialogue(player)
}
}
@@ -172,7 +172,7 @@ object PlunderUtils {
fun getDoor(player: Player) : Int
{
if (getRoom(player) == null)
return -1;
return -1
val room = getRoom(player)!!.room
return PlunderData.doors[room - 1]
}
@@ -210,7 +210,7 @@ class PyramidPlunderMinigame : InteractionListener, TickListener, LogoutListener
rewardXP(player, Skills.STRENGTH, PlunderUtils.getSarcophagusXp(player))
if(RandomFunction.roll(25))
{
val mummy = content.minigame.pyramidplunder.PyramidPlunderMummyNPC(player.location, player)
val mummy = PyramidPlunderMummyNPC(player.location, player)
mummy.isRespawn = false
mummy.init()
mummy.attack(player)
@@ -235,7 +235,7 @@ class PyramidPlunderMinigame : InteractionListener, TickListener, LogoutListener
runTask(player){
if(RandomFunction.roll(25))
{
val swarm = content.minigame.pyramidplunder.PyramidPlunderSwarmNPC(player.location, player)
val swarm = PyramidPlunderSwarmNPC(player.location, player)
swarm.isRespawn = false
swarm.init()
swarm.attack(player)
@@ -452,7 +452,7 @@ class GardenObjectsPlugin : InteractionListener {
@Throws(Throwable::class)
override fun newInstance(arg: Any?): Plugin<Any?> {
UseWithHandler.addHandler(233, UseWithHandler.ITEM_TYPE, this)
addHandler(233, ITEM_TYPE, this)
return this
}
@@ -215,7 +215,7 @@ class Vinesweeper : InteractionListener, InterfaceListener, MapArea {
// TODO: more precise formula
val points_per_xp = if (level < 40) { 2.0*(40.0 - level.toDouble())/10.0 } else { 1.0 }
val points = player.getAttribute("vinesweeper:points", 0)
val xp = points / points_per_xp;
val xp = points / points_per_xp
player.skills.addExperience(Skills.FARMING, xp)
player.setAttribute("/save:vinesweeper:points", 0)
sendUpdatedPoints(player)
@@ -360,7 +360,7 @@ class Vinesweeper : InteractionListener, InterfaceListener, MapArea {
val VINESWEEPER_BORDERS = ZoneBorders(1600,4672,1663,4735)
fun sendUpdatedPoints(player: Player) {
val points = player.getAttribute("vinesweeper:points", 0);
val points = player.getAttribute("vinesweeper:points", 0)
setVarbit(player, 4449, points)
}
@@ -431,7 +431,7 @@ class Vinesweeper : InteractionListener, InterfaceListener, MapArea {
val oldPoints = player.getAttribute("vinesweeper:points", 0)
player.setAttribute("/save:vinesweeper:points", Math.max(oldPoints-10, 0))
sendUpdatedPoints(player)
player.sendMessage("Oh dear! It looks like you dug up a potato seed by mistake.");
player.sendMessage("Oh dear! It looks like you dug up a potato seed by mistake.")
scheduleNPCs(player, loc, false, false)
val scenery = getScenery(loc)
if(scenery != null) {
@@ -534,7 +534,8 @@ class Vinesweeper : InteractionListener, InterfaceListener, MapArea {
@Initializable
class VinesweeperNPC : AbstractNPC {
var seedDestinations: ArrayList<Vinesweeper.SeedDestination> = ArrayList();
var seedDestinations: ArrayList<Vinesweeper.SeedDestination> = ArrayList()
constructor() : super(RABBITS[0], null, true) {}
private constructor(id: Int, location: Location) : super(id, location) {}
override fun construct(id: Int, location: Location, vararg objects: Any?): AbstractNPC {