Implemented Troll Stronghold quest

This commit is contained in:
Oven Bread
2023-09-10 16:01:09 +00:00
committed by Ryan
parent c269949986
commit b80c98acd6
17 changed files with 1060 additions and 63 deletions
+28 -1
View File
@@ -11632,12 +11632,14 @@
{
"examine": "One of the troll generals.",
"slayer_task": "83",
"melee_animation": "1259",
"range_animation": "0",
"attack_speed": "5",
"respawn_delay": "60",
"defence_animation": "0",
"weakness": "7",
"magic_animation": "0",
"death_animation": "287",
"name": "Troll general",
"defence_level": "65",
"safespot": null,
@@ -11651,12 +11653,14 @@
{
"examine": "One of the troll generals.",
"slayer_task": "83",
"melee_animation": "1259",
"range_animation": "0",
"attack_speed": "5",
"respawn_delay": "60",
"defence_animation": "0",
"weakness": "7",
"magic_animation": "0",
"death_animation": "287",
"name": "Troll general",
"defence_level": "65",
"safespot": null,
@@ -11670,12 +11674,14 @@
{
"examine": "One of the troll generals.",
"slayer_task": "83",
"melee_animation": "1259",
"range_animation": "0",
"attack_speed": "5",
"respawn_delay": "60",
"defence_animation": "0",
"weakness": "7",
"magic_animation": "0",
"death_animation": "287",
"name": "Troll general",
"defence_level": "65",
"safespot": null,
@@ -11689,11 +11695,13 @@
{
"examine": "He's watching the arena.",
"slayer_task": "83",
"melee_animation": "1259",
"range_animation": "0",
"respawn_delay": "60",
"defence_animation": "0",
"weakness": "7",
"magic_animation": "0",
"death_animation": "287",
"name": "Troll spectator",
"defence_level": "47",
"safespot": null,
@@ -11706,11 +11714,13 @@
{
"examine": "He's watching the arena.",
"slayer_task": "83",
"melee_animation": "1259",
"range_animation": "0",
"respawn_delay": "60",
"defence_animation": "0",
"weakness": "7",
"magic_animation": "0",
"death_animation": "287",
"name": "Troll spectator",
"defence_level": "47",
"safespot": null,
@@ -11723,11 +11733,13 @@
{
"examine": "He's watching the arena.",
"slayer_task": "83",
"melee_animation": "1259",
"range_animation": "0",
"respawn_delay": "60",
"defence_animation": "0",
"weakness": "7",
"magic_animation": "0",
"death_animation": "287",
"name": "Troll spectator",
"defence_level": "47",
"safespot": null,
@@ -11740,11 +11752,13 @@
{
"examine": "He's watching the arena.",
"slayer_task": "83",
"melee_animation": "1259",
"range_animation": "0",
"respawn_delay": "60",
"defence_animation": "0",
"weakness": "7",
"magic_animation": "0",
"death_animation": "287",
"name": "Troll spectator",
"defence_level": "47",
"safespot": null,
@@ -11757,11 +11771,13 @@
{
"examine": "He's watching the arena.",
"slayer_task": "83",
"melee_animation": "1259",
"range_animation": "0",
"respawn_delay": "60",
"defence_animation": "0",
"weakness": "7",
"magic_animation": "0",
"death_animation": "287",
"name": "Troll spectator",
"defence_level": "47",
"safespot": null,
@@ -11774,11 +11790,13 @@
{
"examine": "He's watching the arena.",
"slayer_task": "83",
"melee_animation": "1259",
"range_animation": "0",
"respawn_delay": "60",
"defence_animation": "0",
"weakness": "7",
"magic_animation": "0",
"death_animation": "287",
"name": "Troll spectator",
"defence_level": "47",
"safespot": null,
@@ -11791,11 +11809,13 @@
{
"examine": "He's watching the arena.",
"slayer_task": "83",
"melee_animation": "1259",
"range_animation": "0",
"respawn_delay": "60",
"defence_animation": "0",
"weakness": "7",
"magic_animation": "0",
"death_animation": "287",
"name": "Troll spectator",
"defence_level": "47",
"safespot": null,
@@ -11814,6 +11834,7 @@
"defence_animation": "0",
"weakness": "7",
"magic_animation": "0",
"death_animation": "287",
"name": "Dad",
"defence_level": "50",
"safespot": null,
@@ -11828,15 +11849,19 @@
"examine": "He's guarding the cells.",
"slayer_task": "83",
"range_animation": "0",
"melee_animation": "1158",
"respawn_delay": "60",
"defence_animation": "0",
"weakness": "7",
"magic_animation": "0",
"death_animation": "287",
"name": "Twig",
"defence_level": "25",
"safespot": null,
"lifepoints": "90",
"strength_level": "90",
"id": "1126",
"aggressive": "true",
"bonuses": "20,20,20,0,0,0,0,10,200,200,0,20,0,0,0",
"range_level": "1",
"attack_level": "40"
@@ -11845,16 +11870,19 @@
"examine": "He's guarding the cells.",
"slayer_task": "83",
"range_animation": "0",
"melee_animation": "1158",
"respawn_delay": "60",
"defence_animation": "0",
"weakness": "7",
"magic_animation": "0",
"death_animation": "287",
"name": "Berry",
"defence_level": "40",
"safespot": null,
"lifepoints": "90",
"strength_level": "90",
"id": "1127",
"aggressive": "true",
"bonuses": "20,20,20,0,0,0,0,10,200,200,0,20,0,0,0",
"range_level": "1",
"attack_level": "40"
@@ -11862,7 +11890,6 @@
{
"examine": "He's guarding the cells.",
"slayer_task": "83",
"melee_animation": "5821",
"range_animation": "0",
"defence_animation": "0",
"weakness": "7",
+56 -28
View File
@@ -2741,23 +2741,39 @@
},
{
"npc_id": "1099",
"loc_data": "{2857,3589,0,0,0}-{2857,3589,0,0,0}"
"loc_data": "{2857,3589,0,0,0}"
},
{
"npc_id": "1100",
"loc_data": "{2859,3589,0,0,0}-{2859,3589,0,0,0}"
"loc_data": "{2859,3589,0,0,0}"
},
{
"npc_id": "1101",
"loc_data": "{2851,3598,0,0,0}-{2854,3600,0,0,0}"
"loc_data": "{2854,3600,0,0,1}"
},
{
"npc_id": "1102",
"loc_data": "{2859,3600,0,0,1}"
},
{
"npc_id": "1103",
"loc_data": "{2863,3600,0,0,1}"
},
{
"npc_id": "1104",
"loc_data": "{2867,3600,0,0,1}"
},
{
"npc_id": "1105",
"loc_data": "{2870,3600,0,0,1}-{2851,3598,0,0,1}"
},
{
"npc_id": "1106",
"loc_data": "{2864,3594,0,1,1}-{2881,3592,0,1,5}-{2857,3587,0,1,7}-{2855,3596,0,1,4}-{2827,10078,1,1,6}-{2925,3626,0,1,0}-{2843,3682,0,1,1}-{2769,10149,0,1,0}-{2777,10142,0,1,0}"
"loc_data": "{2864,3594,0,1,1}-{2881,3592,0,1,5}-{2857,3587,0,1,7}-{2855,3596,0,1,4}-{2827,10078,1,1,6}-{2916,3631,0,1,0}-{2843,3682,0,1,1}-{2769,10149,0,1,0}-{2777,10142,0,1,0}"
},
{
"npc_id": "1107",
"loc_data": "{2874,3595,0,1,3}-{2875,3596,0,1,1}-{2873,3598,0,1,1}-{2836,10088,1,1,5}-{2845,3674,0,1,4}-{2781,10143,0,1,0}"
"loc_data": "{2874,3595,0,1,3}-{2875,3596,0,1,1}-{2873,3598,0,1,1}-{2836,10088,1,1,5}-{2845,3674,0,1,4}-{2781,10143,0,1,0}-{2917,3634,0,1,0}"
},
{
"npc_id": "1108",
@@ -2765,7 +2781,7 @@
},
{
"npc_id": "1109",
"loc_data": "{2875,3588,0,1,1}-{2883,3586,0,1,6}-{2825,10087,1,1,3}-{2836,10080,1,1,6}-{2784,10040,2,1,3}-{2920,3627,0,1,0}-{2923,10029,0,1,7}-{2851,3667,0,1,3}-{2784,10134,0,1,0}"
"loc_data": "{2875,3588,0,1,1}-{2883,3586,0,1,6}-{2825,10087,1,1,3}-{2836,10080,1,1,6}-{2784,10040,2,1,3}-{2909,3641,0,1,0}-{2923,10029,0,1,7}-{2851,3667,0,1,3}-{2784,10134,0,1,0}"
},
{
"npc_id": "1110",
@@ -2781,79 +2797,83 @@
},
{
"npc_id": "1113",
"loc_data": "{2831,10083,0,0,0}"
"loc_data": "{2829,10083,0,1,0}"
},
{
"npc_id": "1114",
"loc_data": "{2826,10078,0,0,0}"
"loc_data": "{2827,10077,0,1,0}"
},
{
"npc_id": "1115",
"loc_data": "{2832,10088,2,0,0}"
"loc_data": "{2831,10086,2,0,0}"
},
{
"npc_id": "1116",
"loc_data": "{2824,10073,2,0,0}"
"loc_data": "{2822,10073,2,0,0}"
},
{
"npc_id": "1117",
"loc_data": "{2829,10101,2,0,0}"
"loc_data": "{2829,10100,2,0,0}"
},
{
"npc_id": "1118",
"loc_data": "{2920,3613,0,0,0}"
"loc_data": "{2906,3623,0,0,6}"
},
{
"npc_id": "1119",
"loc_data": "{2930,3614,0,0,0}"
"loc_data": "{2920,3622,0,0,3}"
},
{
"npc_id": "1120",
"loc_data": "{2927,3608,0,0,0}"
"loc_data": "{2923,3616,0,0,3}"
},
{
"npc_id": "1121",
"loc_data": "{2930,3600,0,0,0}"
"loc_data": "{2923,3612,0,0,3}"
},
{
"npc_id": "1122",
"loc_data": "{2918,3604,0,0,0}"
"loc_data": "{2916,3601,0,0,0}"
},
{
"npc_id": "1123",
"loc_data": "{2914,3603,0,0,0}"
"loc_data": "{2902,3604,0,0,1}"
},
{
"npc_id": "1124",
"loc_data": "{2925,3600,0,0,0}"
"loc_data": "{2922,3606,0,0,3}"
},
{
"npc_id": "1125",
"loc_data": "{2916,3610,0,0,0}"
"loc_data": "{2911,3612,0,0,3}"
},
{
"npc_id": "1128",
"loc_data": "{2833,10080,0,0,0}"
"loc_data": "{2832,10079,0,0,4}"
},
{
"npc_id": "1129",
"loc_data": "{2833,10084,0,0,0}"
"loc_data": "{2832,10083,0,0,4}"
},
{
"npc_id": "1130",
"loc_data": "{2902,3696,0,0,1}"
},
{
"npc_id": "1131",
"loc_data": "{2905,3694,0,0,1}"
"loc_data": "{2898,3698,0,0,1}"
},
{
"npc_id": "1132",
"loc_data": "{2901,3697,0,0,1}"
"loc_data": "{2893,3700,0,0,1}"
},
{
"npc_id": "1133",
"loc_data": "{2895,3699,0,0,1}"
"loc_data": "{2889,3699,0,0,1}"
},
{
"npc_id": "1134",
"loc_data": "{2891,3699,0,0,1}"
"loc_data": "{2886,3698,0,0,1}"
},
{
"npc_id": "1135",
@@ -2869,15 +2889,19 @@
},
{
"npc_id": "1138",
"loc_data": "{2826,10083,1,1,0}-{2837,10083,2,1,1}-{2909,3639,0,1,3}-{2923,10031,0,1,3}"
"loc_data": "{2826,10083,1,1,0}-{2837,10083,2,1,1}-{2904,3642,0,1,3}-{2923,10031,0,1,3}"
},
{
"npc_id": "1139",
"loc_data": "{2854,3689,0,0,6}"
},
{
"npc_id": "1140",
"loc_data": "{2856,10054,1,0,0}-{2860,10057,1,0,0}-{2898,3688,0,0,0}-{2819,3586,0,1,4}"
"loc_data": "{2856,10054,1,0,0}-{2860,10057,1,0,0}-{2819,3586,0,1,4}-{2892,3685,0,1,0}-{2900,3671,0,1,0}"
},
{
"npc_id": "1141",
"loc_data": "{2857,10059,1,0,0}-{2857,10057,1,0,0}"
"loc_data": "{2857,10059,1,0,0}-{2857,10057,1,0,0}-{2893,3678,0,1,0}"
},
{
"npc_id": "1142",
@@ -3039,6 +3063,10 @@
"npc_id": "1213",
"loc_data": "{2914,3418,0,0,6}"
},
{
"npc_id": "1214",
"loc_data": "{2891,3676,0,0,1}"
},
{
"npc_id": "1215",
"loc_data": "{2612,3287,0,0,0}-{2613,3287,0,0,0}"
+2
View File
@@ -22,6 +22,8 @@ public enum Lamps {
L_ACHIEVEMENT_2(new Item(11186), 1000, 30),
L_ACHIEVEMENT_3(new Item(11187), 1500, 35),
MYSTERIOUS_LAMP(new Item(13227), 10000, 30),
FALLY_ACHIEVEMENT_1(new Item(14580), 1000, 30),
FALLY_ACHIEVEMENT_2(new Item(14581), 5000, 40),
FALLY_ACHIEVEMENT_3(new Item(14582), 10000, 50),
@@ -1,10 +1,19 @@
package content.region.asgarnia.burthorpe.dialogue
import content.region.asgarnia.burthorpe.quest.deathplateau.DeathPlateau
import content.region.asgarnia.burthorpe.quest.deathplateau.DenulthDialogueFile
import content.region.asgarnia.burthorpe.quest.trollstronghold.TrollStronghold
import core.api.isQuestComplete
import core.api.isQuestInProgress
import core.api.openDialogue
import core.api.setQuestStage
import core.game.dialogue.DialoguePlugin
import core.game.dialogue.FacialExpression
import core.game.dialogue.Topic
import core.game.node.entity.player.Player
import core.plugin.Initializable
import core.tools.END_DIALOGUE
import core.tools.START_DIALOGUE
import org.rs09.consts.NPCs
/**
@@ -14,6 +23,75 @@ import org.rs09.consts.NPCs
@Initializable
class DenulthDialogue(player: Player? = null) : DialoguePlugin(player) {
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
// When Troll Stronghold is complete
if (isQuestComplete(player!!, TrollStronghold.questName)) {
when(stage) {
START_DIALOGUE -> playerl(FacialExpression.FRIENDLY, "Hello!").also { stage++ }
1 -> npcl(FacialExpression.HAPPY, "Welcome back friend!").also { stage++ }
2 -> showTopics(
Topic("How goes your fight with the trolls?", 10),
Topic("I thought the White Knights controlled Asgarnia?", 20),
Topic(FacialExpression.HAPPY, "See you about Denulth!", 30)
)
10 -> npcl(FacialExpression.FRIENDLY, "We are busy preparing for an attack by night. Godric knows of a secret entrance to the stronghold. Once we destroy the stronghold Burthorpe will be safe! Friend, we are indebted to you!").also { stage++ }
11 -> playerl(FacialExpression.FRIENDLY, "Good luck!").also { stage = END_DIALOGUE }
20 -> npcl(FacialExpression.ANGRY, "You are right citizen. The White Knights have taken advantage of the old and weak king, they control most of Asgarnia, including Falador. However they do not control Burthorpe!").also { stage++ }
21 -> npcl(FacialExpression.EVIL_LAUGH, "We are the prince's elite troops! We keep Burthorpe secure!").also { stage++ }
22 -> npcl(FacialExpression.ANGRY, "The White Knights have overlooked us until now! They are pouring money into their war against the Black Knights, They are looking for an excuse to stop our funding and I'm afraid they may have found it!").also { stage++ }
23 -> npcl(FacialExpression.HALF_WORRIED, "If we can not destroy the troll camp on Death Plateau then the Imperial Guard will be disbanded and Burthorpe will come under control of the White Knights. We cannot let this happen!").also { stage++ }
24 -> npcl(FacialExpression.ASKING, "Is there anything else you'd like to know?").also { stage = 2 }
30 -> npcl(FacialExpression.FRIENDLY, "Saradomin be with you, friend!").also { stage = END_DIALOGUE }
}
return true
}
// Troll Stronghold in progress
if (isQuestInProgress(player!!, TrollStronghold.questName, 1, 99)) {
openDialogue(player!!, content.region.asgarnia.burthorpe.quest.trollstronghold.DenulthDialogueFile(), npc)
return true
}
// When Death Plateau is completed, start Troll Stronghold
if (isQuestComplete(player!!, DeathPlateau.questName)) {
when(stage) {
START_DIALOGUE -> playerl(FacialExpression.FRIENDLY, "Hello!").also { stage++ }
1 -> npcl(FacialExpression.HAPPY, "Welcome back friend!").also { stage++ }
2 -> showTopics(
Topic("How goes your fight with the trolls?", 10),
Topic("I thought the White Knights controlled Asgarnia?", 20),
Topic(FacialExpression.HAPPY, "See you about Denulth!", 30)
)
10 -> npcl(FacialExpression.HALF_WORRIED, "I'm afraid I have bad news. We made our attack as planned, but we met unexpected resistance.").also { stage++ }
11 -> playerl(FacialExpression.HALF_ASKING, "What happened?").also { stage++ }
12 -> npcl(FacialExpression.WORRIED, "We were ambushed by trolls coming from the north. They captured Dunstan's son, Godric, who we enlisted at your request; we tried to follow but we were repelled at the foot of their stronghold.").also { stage++ }
13 -> showTopics(
Topic(FacialExpression.SAD, "I'm sorry to hear that.", END_DIALOGUE),
Topic("Is there anything I can do to help?", 14)
)
14 -> npcl(FacialExpression.HALF_WORRIED, "The way to the stronghold is treacherous, friend. Even if you manage to climb your way up, there will be many trolls defending the stronghold.").also{ stage++ }
15 -> showTopics(
Topic("I'll get Godric back!", 16),
Topic("I'm sorry, there's nothing I can do.'", END_DIALOGUE)
)
16 -> npcl(FacialExpression.HAPPY, "God speed friend! I would send some of my men with you, but none of them are brave enough to follow.").also {
stage = END_DIALOGUE
setQuestStage(player!!, TrollStronghold.questName, 1)
}
20 -> npcl(FacialExpression.ANGRY, "You are right citizen. The White Knights have taken advantage of the old and weak king, they control most of Asgarnia, including Falador. However they do not control Burthorpe!").also { stage++ }
21 -> npcl(FacialExpression.EVIL_LAUGH, "We are the prince's elite troops! We keep Burthorpe secure!").also { stage++ }
22 -> npcl(FacialExpression.ANGRY, "The White Knights have overlooked us until now! They are pouring money into their war against the Black Knights, They are looking for an excuse to stop our funding and I'm afraid they may have found it!").also { stage++ }
23 -> npcl(FacialExpression.HALF_WORRIED, "If we can not destroy the troll camp on Death Plateau then the Imperial Guard will be disbanded and Burthorpe will come under control of the White Knights. We cannot let this happen!").also { stage++ }
24 -> npcl(FacialExpression.ASKING, "Is there anything else you'd like to know?").also { stage = 2 }
30 -> npcl(FacialExpression.FRIENDLY, "Saradomin be with you, friend!").also { stage = END_DIALOGUE }
}
return true
}
// Fallback to default. Always the start of Death Plateau
openDialogue(player!!, DenulthDialogueFile(), npc)
return true
@@ -1,9 +1,8 @@
package content.region.asgarnia.burthorpe.dialogue
import content.region.asgarnia.burthorpe.quest.deathplateau.DeathPlateau
import content.region.asgarnia.burthorpe.quest.deathplateau.DunstanDialogueFile
import core.api.isQuestInProgress
import core.api.openDialogue
import content.region.asgarnia.burthorpe.quest.trollstronghold.TrollStronghold
import core.api.*
import core.game.dialogue.DialoguePlugin
import core.game.dialogue.FacialExpression
import core.game.dialogue.Topic
@@ -24,19 +23,71 @@ import org.rs09.consts.NPCs
class DunstanDialogue(player: Player? = null) : DialoguePlugin(player) {
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
if (isQuestInProgress(player!!, DeathPlateau.questName, 21, 24)) {
// Call the dialogue file for Dunstan from the deathplateau quest folder.
openDialogue(player!!, DunstanDialogueFile(), npc)
return true
}
// Default
// When Troll Stronghold is complete
if (isQuestComplete(player!!, TrollStronghold.questName)) {
when (stage) {
START_DIALOGUE -> playerl(FacialExpression.FRIENDLY, "Hi!").also { stage++ }
1 -> npcl(FacialExpression.FRIENDLY, "Hi! Did you want something??").also { stage++ }
1 -> npcl(FacialExpression.FRIENDLY, "Hi! What can I do for you?").also { stage++ }
2 -> showTopics(
Topic(FacialExpression.THINKING, "Is it OK if I use your anvil?", 10),
Topic(FacialExpression.FRIENDLY, "Nothing, thanks.", END_DIALOGUE),
Topic(FacialExpression.FRIENDLY, "How is your son getting on?", 15),
// Sleds topic when Troll Romance is implemented.
)
10 -> npcl(FacialExpression.FRIENDLY, "So you're a smithy are you?").also { stage++ }
11 -> playerl(FacialExpression.FRIENDLY, "I dabble.").also { stage++ }
12 -> npcl(FacialExpression.FRIENDLY, "A fellow smith is welcome to use my anvil!").also { stage++ }
13 -> playerl(FacialExpression.FRIENDLY, "Thanks!").also { stage++ }
14 -> npcl(FacialExpression.FRIENDLY, "Anything else before I get on with my work?").also { stage = 2 }
15 -> npcl(FacialExpression.FRIENDLY, "He is getting on fine! He has just been promoted to Sergeant! I'm really proud of him!").also { stage++ }
16 -> playerl(FacialExpression.FRIENDLY, "I'm happy for you!").also { stage++ }
17 -> npcl(FacialExpression.FRIENDLY, "Anything else before I get on with my work?").also { stage = 2 }
}
return true
}
// Troll Stronghold in progress
if (isQuestInProgress(player!!, TrollStronghold.questName, 1, 99)) {
openDialogue(player!!, content.region.asgarnia.burthorpe.quest.trollstronghold.DunstanDialogueFile(), npc)
return true
}
// When Death Plateau is complete
if (isQuestComplete(player!!, DeathPlateau.questName)) {
when (stage) {
START_DIALOGUE -> playerl(FacialExpression.FRIENDLY, "Hi!").also { stage++ }
1 -> npcl(FacialExpression.FRIENDLY, "Hi! What can I do for you?").also { stage++ }
2 -> showTopics(
Topic(FacialExpression.THINKING, "Is it OK if I use your anvil?", 10),
Topic(FacialExpression.FRIENDLY, "Nothing, thanks.", END_DIALOGUE),
Topic(FacialExpression.FRIENDLY, "How is your son getting on?", 15),
)
10 -> npcl(FacialExpression.FRIENDLY, "So you're a smithy are you?").also { stage++ }
11 -> playerl(FacialExpression.FRIENDLY, "I dabble.").also { stage++ }
12 -> npcl(FacialExpression.FRIENDLY, "A fellow smith is welcome to use my anvil!").also { stage++ }
13 -> playerl(FacialExpression.FRIENDLY, "Thanks!").also { stage++ }
14 -> npcl(FacialExpression.FRIENDLY, "Anything else before I get on with my work?").also { stage = 2 }
15 -> npcl(FacialExpression.SAD, "He was captured by those cursed trolls! I don't know what to do. Even the imperial guard are too afraid to go rescue him.").also { stage++ }
16 -> playerl(FacialExpression.ASKING, "What happened?").also { stage++ }
17 -> npcl(FacialExpression.SAD, "Talk to Denulth, he can tell you all about it. Anything else before I get on with my work?").also { stage = 2 }
}
return true
}
// Death Plateau in progress
if (isQuestInProgress(player!!, DeathPlateau.questName, 21, 24)) {
// Call the dialogue file for Dunstan from the deathplateau quest folder.
openDialogue(player!!, content.region.asgarnia.burthorpe.quest.deathplateau.DunstanDialogueFile(), npc)
return true
}
// Default
when (stage) {
START_DIALOGUE -> playerl(FacialExpression.FRIENDLY, "Hi!").also { stage++ }
1 -> npcl(FacialExpression.FRIENDLY, "Hi! Did you want something?").also { stage++ }
2 -> showTopics(
Topic(FacialExpression.THINKING, "Is it OK if I use your anvil?", 10),
Topic(FacialExpression.FRIENDLY, "Nothing, thanks.", END_DIALOGUE),
// More dialogues here (Sleds, Climbing Boots, Troll Stronghold)
)
10 -> npcl(FacialExpression.FRIENDLY, "So you're a smithy are you?").also { stage++ }
11 -> playerl(FacialExpression.FRIENDLY, "I dabble.").also { stage++ }
@@ -173,32 +173,6 @@ class DenulthDialogueFile : DialogueFile() {
}
}
}
100 -> {
// This should go to Troll Stronghold.
when(stage) {
0 -> playerl(FacialExpression.FRIENDLY, "Hello!").also { stage++ }
1 -> npcl(FacialExpression.HAPPY, "Welcome back friend!").also { stage++ }
2 -> showTopics(
Topic("How goes your fight with the trolls?", 10),
Topic("I thought the White Knights controlled Asgarnia?", 20),
Topic(FacialExpression.HAPPY, "See you about Denulth!", 30)
)
10 -> npcl(FacialExpression.HALF_WORRIED, "I'm afraid I have bad news. We made our attack as planned, but we met unexpected resistance.").also { stage++ }
11 -> playerl(FacialExpression.HALF_ASKING, "What happened?").also { stage++ }
12 -> npcl(FacialExpression.WORRIED, "We were ambushed by trolls coming from the north. They captured Dunstan's son, Godric, who we enlisted at your request, we tried to follow but we were repelled at the foot of their stronghold.").also { stage++ }
13 -> showTopics(
Topic(FacialExpression.SAD, "I'm sorry to hear that.", END_DIALOGUE),
Topic("Is there anything I can do to help?", 100)
)
100 -> npcl(FacialExpression.LAUGH, "Not until we implement Troll Stronghold you can't!").also { stage = END_DIALOGUE }
/**
100 -> npcl(FacialExpression.HALF_WORRIED, "The way to the stronghold is treacherous, friend. Even if you manage to climb your way up, there will be many trolls defending the stronghold.").also{ stage++ }
101 -> playerl(FacialExpression.FRIENDLY, "I'll get Godric back!").also { stage++ }
102 -> npcl(FacialExpression.HAPPY, "God speed friend! I would send some of my men with you, but none of them are brave enough to follow.").also { stage = END_DIALOGUE; strongholdquest.start(player)
**/
}
}
}
}
}
@@ -0,0 +1,52 @@
package content.region.asgarnia.burthorpe.quest.trollstronghold
import core.api.isQuestInProgress
import core.api.produceGroundItem
import core.api.transformNpc
import core.game.node.entity.Entity
import core.game.node.entity.combat.CombatStyle
import core.game.node.entity.npc.AbstractNPC
import core.game.node.entity.player.Player
import core.game.world.map.Location
import core.plugin.Initializable
import org.rs09.consts.Items
import org.rs09.consts.NPCs
@Initializable
class BerryNpc(id: Int = 0, location: Location? = null) : AbstractNPC(id, location) {
override fun construct(id: Int, location: Location, vararg objects: Any): AbstractNPC {
return BerryNpc(id, location)
}
override fun getIds(): IntArray {
return intArrayOf(NPCs.BERRY_1127, NPCs.BERRY_1129)
}
// Transform from sleeping to awake.
override fun isAttackable(entity: Entity, style: CombatStyle, message: Boolean): Boolean {
val attackable = super.isAttackable(entity, style, message)
if (this.id == NPCs.BERRY_1129) {
val prevLifePoints = this.skills.lifepoints
this.transform(NPCs.BERRY_1127)
this.skills.lifepoints = prevLifePoints
}
return attackable
}
override fun handleTickActions() {
super.handleTickActions()
// When returning to spawn, transform back to sleeping and keep lifepoints.
if (getAttribute("return-to-spawn", false) && this.id == NPCs.BERRY_1127) {
val prevLifePoints = this.skills.lifepoints
this.transform(NPCs.BERRY_1129)
this.skills.lifepoints = prevLifePoints
}
}
override fun finalizeDeath(killer: Entity?) {
if (isQuestInProgress(killer as Player, TrollStronghold.questName, 8, 10)) {
produceGroundItem(killer, Items.CELL_KEY_2_3137, 1, this.location)
}
super.finalizeDeath(killer)
}
}
@@ -0,0 +1,48 @@
package content.region.asgarnia.burthorpe.quest.trollstronghold
import core.api.*
import core.game.dialogue.DialoguePlugin
import core.game.dialogue.FacialExpression
import core.game.dialogue.Topic
import core.game.node.entity.player.Player
import core.plugin.Initializable
import core.tools.END_DIALOGUE
import core.tools.START_DIALOGUE
import org.rs09.consts.NPCs
@Initializable
class DadDialogue(player: Player? = null) : DialoguePlugin(player) {
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when (getQuestStage(player!!, TrollStronghold.questName)) {
in 3..4 -> {
when (stage) {
START_DIALOGUE -> npcl(FacialExpression.OLD_HAPPY, "What tiny human do in troll arena? Dad challenge human to fight!").also { stage++ }
1 -> showTopics(
Topic(FacialExpression.THINKING, "Why are you called Dad?", 2),
Topic(FacialExpression.FRIENDLY, "I accept your challenge!", 3),
Topic(FacialExpression.SCARED, "Eek! No thanks.", END_DIALOGUE)
)
2 -> npcl(FacialExpression.OLD_HAPPY, "Troll named after first thing try to eat!").also { stage = 1 }
3 -> npcl(FacialExpression.OLD_HAPPY, "Tiny human brave. Dad squish!").also { stage++ }
4 -> npc!!.attack(player).also {
npc!!.skills.lifepoints = npc!!.skills.maximumLifepoints // Reset dad to max hitpoints.
setQuestStage(player!!, TrollStronghold.questName, 4)
stage = END_DIALOGUE
}
}
}
in 5..100 -> {
sendMessage(player, "He doesn't seem interested in talking right now.")
}
}
return true
}
override fun newInstance(player: Player?): DialoguePlugin {
return DadDialogue(player)
}
override fun getIds(): IntArray {
return intArrayOf(NPCs.DAD_1125)
}
}
@@ -0,0 +1,40 @@
package content.region.asgarnia.burthorpe.quest.trollstronghold
import core.api.setQuestStage
import core.game.dialogue.DialogueFile
import core.game.dialogue.FacialExpression
import core.game.dialogue.Topic
import core.tools.END_DIALOGUE
import core.tools.START_DIALOGUE
class DadDialogueFile(private val dialogueNum: Int = 0) : DialogueFile() {
override fun handle(componentID: Int, buttonID: Int) {
when(dialogueNum) {
1 -> when (stage) {
START_DIALOGUE -> npcl(FacialExpression.OLD_HAPPY, "No human pass through arena without defeating Dad!").also {
stage = END_DIALOGUE
setQuestStage(player!!, TrollStronghold.questName, 3)
}
}
2 -> when (stage) {
START_DIALOGUE -> npcl(FacialExpression.OLD_NORMAL, "Tiny human brave. Dad squish!").also { stage++ }
1 -> npc!!.attack(player).also {
npc!!.skills.lifepoints = npc!!.skills.maximumLifepoints // Reset dad to max hitpoints.
setQuestStage(player!!, TrollStronghold.questName, 4)
stage = END_DIALOGUE
}
}
3 -> when (stage) {
START_DIALOGUE -> npcl(FacialExpression.OLD_NORMAL, "Stop! You win. Not hurt Dad.").also { stage++ }
1 -> showTopics(
Topic(FacialExpression.FRIENDLY, "I'll be going now.", END_DIALOGUE),
Topic(FacialExpression.ANGRY_WITH_SMILE, "I'm not done yet! Prepare to die!", 2)
)
2 -> player!!.attack(npc).also {
setQuestStage(player!!, TrollStronghold.questName, 5)
stage = END_DIALOGUE
}
}
}
}
}
@@ -0,0 +1,76 @@
package content.region.asgarnia.burthorpe.quest.trollstronghold
import core.api.*
import core.game.node.Node
import core.game.node.entity.Entity
import core.game.node.entity.combat.BattleState
import core.game.node.entity.combat.CombatStyle
import core.game.node.entity.npc.AbstractNPC
import core.game.system.task.Pulse
import core.game.world.map.Location
import core.plugin.Initializable
import core.tools.RandomFunction
import org.rs09.consts.NPCs
@Initializable
class DadNpc(id: Int = 0, location: Location? = null) : AbstractNPC(id, location) {
override fun construct(id: Int, location: Location, vararg objects: Any): AbstractNPC {
return DadNpc(id, location)
}
override fun getIds(): IntArray {
return intArrayOf(NPCs.DAD_1125)
}
override fun isAttackable(entity: Entity, style: CombatStyle, message: Boolean): Boolean {
val attackable = super.isAttackable(entity, style, message)
val player = entity.asPlayer()
// Attack Dad. If quest is done, you cannot attack Dad.
when (getQuestStage(player, TrollStronghold.questName)) {
3 -> openDialogue(player, DadDialogueFile(2), this.asNpc()).also { return false }
4 -> { return attackable }
in 5 .. 100 -> sendMessage(player, "You don't need to fight him again.").also { return false }
}
return attackable
}
override fun checkImpact(state: BattleState) {
super.checkImpact(state)
val player = state.attacker
val opponent = state.victim
// If dad is below 30/120 lifepoints, give player option
// Dad can be killed if you oneshot him past 30.
if (opponent.skills.lifepoints < 30) {
player.properties.combatPulse.stop()
opponent.properties.combatPulse.stop()
if (getQuestStage(player!!.asPlayer(), TrollStronghold.questName) == 4){
setQuestStage(player!!.asPlayer(), TrollStronghold.questName, 5)
}
submitWorldPulse(object : Pulse(){
var counter = 0
override fun pulse(): Boolean {
when(counter++){
1 -> {
openDialogue(player.asPlayer(), DadDialogueFile(3), opponent.asNpc())
return true;
}
}
return false
}
})
}
}
override fun finalizeDeath(killer: Entity?) {
// In case Dad gets one shotted to death.
super.finalizeDeath(killer)
if (getQuestStage(killer!!.asPlayer(), TrollStronghold.questName) == 4){
setQuestStage(killer!!.asPlayer(), TrollStronghold.questName, 5)
}
}
override fun handleTickActions() {
super.handleTickActions()
if(RandomFunction.roll(35)){
}
}
}
@@ -0,0 +1,56 @@
package content.region.asgarnia.burthorpe.quest.trollstronghold
import core.api.*
import core.game.dialogue.DialogueFile
import core.game.dialogue.FacialExpression
import core.tools.END_DIALOGUE
import core.tools.START_DIALOGUE
import org.rs09.consts.Items
/**
* Denulth sub dialogue file for troll stronghold.
* Called by DenulthDialogue
* @author ovenbread
*/
class DenulthDialogueFile : DialogueFile() {
override fun handle(componentID: Int, buttonID: Int) {
when (getQuestStage(player!!, TrollStronghold.questName)) {
in 1..7 -> {
when (stage) {
START_DIALOGUE -> npcl(FacialExpression.FRIENDLY, "How are you getting on with rescuing Godric?").also { stage++ }
1 -> {
if (hasAnItem(player!!, Items.CLIMBING_BOOTS_3105).exists()) {
playerl(FacialExpression.FRIENDLY, " I've got some climbing boots.").also { stage = 2 }
} else {
playerl(FacialExpression.FRIENDLY, "I haven't found a way to climb up yet.?").also { stage = 3 }
}
}
2 -> npcl(FacialExpression.FRIENDLY, "Then hurry, friend! What are you still doing here?").also { stage = END_DIALOGUE }
3 -> npcl(FacialExpression.FRIENDLY, "Hurry, friend! Who knows what they'll do with Godric?").also { stage = END_DIALOGUE }
}
}
in 8 .. 10 -> {
when (stage) {
START_DIALOGUE -> playerl(FacialExpression.FRIENDLY, "Hello!").also { stage++ }
1 -> npcl(FacialExpression.FRIENDLY, "Welcome back friend!").also { stage++ }
2 -> playerl(FacialExpression.FRIENDLY, "I've found my way into the prison.").also { stage++ }
3 -> npcl(FacialExpression.FRIENDLY, "...and?").also { stage++ }
4 -> playerl(FacialExpression.FRIENDLY, "That's all.").also { stage++ }
5 -> npcl(FacialExpression.FRIENDLY, "Hurry, friend. Find a way to free Godric!").also {
stage = END_DIALOGUE
}
}
}
11 -> {
when (stage) {
START_DIALOGUE -> playerl(FacialExpression.FRIENDLY, "Hello!").also { stage++ }
1 -> npcl(FacialExpression.FRIENDLY, "Welcome back friend!").also { stage++ }
2 -> playerl(FacialExpression.FRIENDLY, "I have freed Godric!").also { stage++ }
3 -> npcl(FacialExpression.FRIENDLY, "Oh, what great news! You should hurry to tell Dunstan, he will be overjoyed!").also {
stage = END_DIALOGUE
}
}
}
}
}
}
@@ -0,0 +1,44 @@
package content.region.asgarnia.burthorpe.quest.trollstronghold
import core.api.finishQuest
import core.api.getQuestStage
import core.game.dialogue.DialogueFile
import core.game.dialogue.FacialExpression
import core.game.dialogue.Topic
import core.tools.END_DIALOGUE
import core.tools.START_DIALOGUE
class DunstanDialogueFile : DialogueFile() {
override fun handle(componentID: Int, buttonID: Int) {
when (getQuestStage(player!!, TrollStronghold.questName)) {
in 1..10 -> {
when (stage) {
START_DIALOGUE -> npcl(FacialExpression.FRIENDLY, "Have you managed to rescue Godric yet?").also { stage++ }
1 -> playerl(FacialExpression.FRIENDLY, "Not yet.").also { stage++ }
2 -> npcl(FacialExpression.FRIENDLY, "Please hurry! Who knows what they will do to him? Is there anything I can do in the meantime?").also { stage++ }
3 -> showTopics(
Topic(FacialExpression.THINKING, "Is it OK if I use your anvil?", 10),
Topic(FacialExpression.FRIENDLY, "Nothing, thanks.", END_DIALOGUE),
)
10 -> npcl(FacialExpression.FRIENDLY, "So you're a smithy are you?").also { stage++ }
11 -> playerl(FacialExpression.FRIENDLY, "I dabble.").also { stage++ }
12 -> npcl(FacialExpression.FRIENDLY, "A fellow smith is welcome to use my anvil!").also { stage++ }
13 -> playerl(FacialExpression.FRIENDLY, "Thanks!").also { stage++ }
14 -> npcl(FacialExpression.FRIENDLY, "Anything else before I get on with my work?").also { stage = 3 }
}
}
11 -> {
when (stage) {
START_DIALOGUE -> playerl(FacialExpression.FRIENDLY, "Has Godric returned home?").also { stage++ }
1 -> npcl(FacialExpression.FRIENDLY, "He is safe and sound, thanks to you my friend!").also { stage++ }
2 -> playerl(FacialExpression.FRIENDLY, "I'm glad to hear it.").also { stage++ }
3 -> npcl(FacialExpression.FRIENDLY, "I have very little to offer you by way of thanks, but perhaps you will accept these family heirlooms. They were found by my great-great-grandfather, but we still don't have any idea what they do.").also { stage++ }
4 -> {
stage = END_DIALOGUE
finishQuest(player!!, TrollStronghold.questName)
}
}
}
}
}
}
@@ -0,0 +1,33 @@
package content.region.asgarnia.burthorpe.quest.trollstronghold
import content.region.kandarin.quest.grandtree.ForemanDialogue
import content.region.kandarin.quest.grandtree.TheGrandTree
import core.api.*
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import core.game.node.entity.Entity
import core.game.node.entity.npc.AbstractNPC
import core.game.node.entity.player.Player
import core.game.world.map.Location
import core.plugin.Initializable
import org.rs09.consts.Items
import org.rs09.consts.NPCs
@Initializable
class TrollGeneralsNpc(id: Int = 0, location: Location? = null) : AbstractNPC(id,location) {
override fun construct(id: Int, location: Location?, vararg objects: Any?): AbstractNPC {
return TrollGeneralsNpc(id, location)
}
override fun getIds(): IntArray {
return intArrayOf(NPCs.TROLL_GENERAL_1115, NPCs.TROLL_GENERAL_1116, NPCs.TROLL_GENERAL_1117)
}
override fun finalizeDeath(killer: Entity?) {
if(isQuestInProgress(killer as Player, TrollStronghold.questName, 1, 7)) {
produceGroundItem(killer, Items.PRISON_KEY_3135, 1, this.location)
}
super.finalizeDeath(killer)
}
}
@@ -0,0 +1,111 @@
package content.region.asgarnia.burthorpe.quest.trollstronghold
import content.region.asgarnia.burthorpe.quest.deathplateau.DeathPlateau
import core.api.*
import core.game.node.entity.player.Player
import core.game.node.entity.player.link.quest.Quest
import core.game.node.entity.skill.Skills
import core.plugin.Initializable
import org.rs09.consts.Items
/**
* Troll Stronghold Quest
* @author ovenbread
*/
@Initializable
class TrollStronghold : Quest("Troll Stronghold",128, 127, 1, 317, 0, 1, 50) {
/**
* 1 - Talked to Denulth to start the quest
* 3 - Enter the Arena with Dad
* 4 - Start fighting Dad
* 5 - Dad surrenders or gets killed, allowed to exit the Arena
* 8 - Unlocks Prison Gate
* 9 - Unlocked Mad Eadgar's cell
* 10 - Unlocked Godric's cell
* 11 - Unlocked both Mad Eadgar's and Godric's cell
* 100 - Finish at Dunstan
*/
companion object {
const val questName = "Troll Stronghold"
}
override fun drawJournal(player: Player?, stage: Int) {
super.drawJournal(player, stage)
var line = 12
var stage = getStage(player)
var started = getQuestStage(player!!, questName) > 0
if(!started){
line(player, "I can start this quest by speaking to !!Denulth?? in his tent at", line++)
line(player, "the !!Imperial Guard camp?? in !!Burthorpe?? after completing the", line++)
line(player, "!!Death Plateau Quest??", line++, isQuestComplete(player, DeathPlateau.questName))
line++
line(player, "To complete this quest I need:", line++)
line(player, "Level 15 Agility.", line++, hasLevelStat(player, Skills.AGILITY, 15))
line(player, "I also need to be able to defeat a !!level 113 Troll??.", line++)
line(player, "Level 30 Thieving might be useful.", line++, hasLevelStat(player, Skills.THIEVING, 30))
if (isQuestComplete(player, DeathPlateau.questName) && hasLevelStat(player, Skills.AGILITY, 15) && hasLevelStat(player, Skills.THIEVING, 30)) {
line(player, "I have all the requirements to start this quest.", line++)
}
} else {
line(player, "I promised !!Denulth?? that I would rescue !!Godric?? from the !!Troll??", line++, stage == 100)
line(player, "!!Stronghold??", line++, stage == 100)
line++
if (stage >= 5 || inBank(player, Items.CLIMBING_BOOTS_3105) || inInventory(player, Items.CLIMBING_BOOTS_3105) || inEquipment(player, Items.CLIMBING_BOOTS_3105)) {
line(player, "I got some !!climbing boots?? from !!Tenzing??", line++, true)
} else {
line(player, "I have to get some !!climbing boots?? from !!Tenzing??", line++)
}
line++
if (stage >= 5) {
line(player, "I have defeated the !!Troll Champion??", line++, true)
} else if (stage >= 3) {
line(player, "I have to defeat the !!Troll Champion??", line++)
}
if (stage in 5..7) {
line++
line(player, "I have to find a way to get into the !!Troll Stronghold??", line++)
}
line++
if (stage >= 8) {
line(player, "I found my way into the !!Prison??", line++, true)
} else if (stage >= 5) {
line(player, "I have to find a way to get into the !!prison??", line++)
}
line++
if (stage >= 11) {
line(player, "I've rescued !!Godric?? and !!Mad Eadgar??", line++, true)
} else if (stage >= 8) {
line(player, "I have to rescue !!Godric?? and !!Mad Eadgar??", line++)
}
if (stage >= 100) {
line++
line(player, "I talked to Dunstan and he rewarded me.", line++, true)
} else if (stage >= 11) {
line(player, "I should return and tell !!Dunstan?? his son is safe.", line++)
}
if (stage >= 100) {
line++
line(player,"<col=FF0000>QUEST COMPLETE!</col>", line)
}
}
}
override fun finish(player: Player) {
var ln = 10
super.finish(player)
player.packetDispatch.sendString("You have completed the Troll Stronghold quest!", 277, 4)
player.packetDispatch.sendItemZoomOnInterface(Items.MYSTERIOUS_LAMP_13227, 240, 277, 5)
drawReward(player,"1 Quest Point", ln++)
drawReward(player,"2 Reward lamps giving 10,000", ln++)
drawReward(player,"XP each", ln++)
addItemOrDrop(player, Items.MYSTERIOUS_LAMP_13227, 2)
}
override fun newInstance(`object`: Any?): Quest {
return this
}
}
@@ -0,0 +1,317 @@
package content.region.asgarnia.burthorpe.quest.trollstronghold
import core.api.*
import core.game.global.action.DoorActionHandler
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import core.game.node.Node
import core.game.node.entity.player.Player
import core.game.node.entity.skill.Skills
import core.game.system.task.Pulse
import core.game.world.map.Location
import core.game.world.update.flag.context.Animation
import core.tools.RandomFunction
import org.rs09.consts.Items
import org.rs09.consts.NPCs
import org.rs09.consts.Scenery
import kotlin.math.ceil
class TrollStrongholdListener: InteractionListener {
override fun defineListeners() {
// Entrance to arena with Dad in it.
on(intArrayOf(Scenery.ARENA_ENTRANCE_3782, Scenery.ARENA_ENTRANCE_3783), IntType.SCENERY, "open"){ player, node ->
// Only get the dialogue once.
if (getQuestStage(player, TrollStronghold.questName) == 1) {
openDialogue(player, DadDialogueFile(1), findNPC(NPCs.DAD_1125)!!)
}
// Only allow players through when they start Troll Stronghold.
// No one is allowed to go to GWD unless they start the Troll Stronghold quest.
if (getQuestStage(player, TrollStronghold.questName) > 0) {
DoorActionHandler.handleAutowalkDoor(player, node.asScenery())
} else {
sendMessage(player, "You need to start the Troll Stronghold quest.")
}
return@on true;
}
// Not allowed to exit arena into the troll stronghold until Dad is defeated.
on(intArrayOf(Scenery.ARENA_EXIT_3785, Scenery.ARENA_EXIT_3786), IntType.SCENERY, "open"){ player, node ->
if (getQuestStage(player, TrollStronghold.questName) < 5){
openDialogue(player, DadDialogueFile(1), findNPC(NPCs.DAD_1125)!!)
} else {
DoorActionHandler.handleAutowalkDoor(player, node.asScenery())
}
return@on true;
}
// Key to unlock the prison door
on(Scenery.PRISON_DOOR_3780, IntType.SCENERY, "unlock"){ player, node ->
if (getQuestStage(player, TrollStronghold.questName) >= 8){
DoorActionHandler.handleAutowalkDoor(player, node.asScenery())
} else {
if (inInventory(player, Items.PRISON_KEY_3135)) {
if (getQuestStage(player, TrollStronghold.questName) == 5) {
setQuestStage(player, TrollStronghold.questName, 8)
}
if (removeItem(player, Items.PRISON_KEY_3135)) {
DoorActionHandler.handleAutowalkDoor(player, node.asScenery())
sendMessage(player, "You unlock the prison door.")
}
} else {
sendMessage(player, "The prison door is locked.")
}
}
return@on true;
}
// Pickpocket Twig
on(NPCs.TWIG_1128, IntType.NPC, "pickpocket") { player, node ->
val npc = node.asNpc()
player.lock()
submitWorldPulse(object : Pulse(){
var counter = 0
override fun pulse(): Boolean {
when(counter++){
0 -> {
if (hasLevelDyn(player, Skills.THIEVING, 30)){
animate(player, Animation(881))
} else {
sendMessage(player, "You need to be a level 30 thief to pickpocket Twig.")
return true
}
}
3 -> {
val success: Boolean = success(player, Skills.THIEVING)
if(success){
if(isQuestInProgress(player, TrollStronghold.questName, 8, 10)) {
addItem(player, Items.CELL_KEY_1_3136)
sendMessage(player, "You find a small key on Twig.")
} else {
sendMessage(player, "You find nothing on Twig.")
}
} else {
sendChat(npc, "What you think you doing?")
transformNpc(npc, NPCs.TWIG_1126, 50)
npc.attack(player)
}
player.unlock()
return true
}
}
return false
}
})
return@on true
}
// Pickpocket Berry
on(NPCs.BERRY_1129, IntType.NPC, "pickpocket") { player, node ->
val npc = node.asNpc()
player.lock()
submitWorldPulse(object : Pulse(){
var counter = 0
override fun pulse(): Boolean {
when(counter++){
0 -> {
if (hasLevelDyn(player, Skills.THIEVING, 30)){
animate(player, Animation(881))
} else {
sendMessage(player, "You need to be a level 30 thief to pickpocket Berry.")
return true
}
}
3 -> {
val success: Boolean = success(player, Skills.THIEVING)
if(success){
if(isQuestInProgress(player, TrollStronghold.questName, 8, 10)) {
addItem(player, Items.CELL_KEY_2_3137)
sendMessage(player, "You find a small key on Berry.")
} else {
sendMessage(player, "You find nothing on Berry.")
}
} else {
sendChat(npc, "What you think you doing?")
transformNpc(npc, NPCs.BERRY_1127, 50)
npc.attack(player)
}
player.unlock()
return true
}
}
return false
}
})
return@on true
}
// Key to unlock Mad Eadgar's cell
fun unlockMadEadgarCellDoor(player: Player, node: Node) {
if (inInventory(player, Items.CELL_KEY_1_3136)){
sendMessage(player, "You unlock the cell door.")
if (getQuestStage(player, TrollStronghold.questName) == 8) {
setQuestStage(player, TrollStronghold.questName, 9)
} else if (getQuestStage(player, TrollStronghold.questName) == 10) {
setQuestStage(player, TrollStronghold.questName, 11)
}
// Animate Mad Eadgar leaving cell.
val npc = findNPC(NPCs.EADGAR_1113)!!
sendNPCDialogue(player, NPCs.EADGAR_1113, "Thanks! I'm off back home!")
npc.walkRadius = 40
submitWorldPulse(object : Pulse(0) {
// This is basically chaining a series of walks + and door handler.
var count = 0
var stage = 0
var trigger = true
var targetLocation = Location(0, 0, 0)
override fun pulse(): Boolean {
if (npc.location.equals(targetLocation)){
stage++
trigger = true
}
if (trigger) {
trigger = false
when (stage) {
0 -> forceWalk(npc, Location(2831, 10082, 0), "dumb").also {
npc.walkRadius = 11
npc.setWalks(false)
targetLocation = Location(2831, 10082, 0)
}
1 -> DoorActionHandler.handleAutowalkDoor(npc, node.asScenery()).also { targetLocation = Location(2832, 10082, 0) }
// Delay 2 ticks for DoorActionHandler to finish
4 -> forceWalk(npc, Location(2836, 10082, 0), "dumb").also { targetLocation = Location(2836, 10082, 0) }
5 -> forceWalk(npc, Location(2836, 10061, 0), "dumb").also { targetLocation = Location(2836, 10061, 0) }
6 -> forceWalk(npc, Location(2824, 10050, 0), "dumb").also { targetLocation = Location(2824, 10050, 0) }
7 -> {
// Out of sight death to trigger respawn.
npc.teleport(Location(2823, 10035, 0))
npc.startDeath(null)
npc.setWalks(true)
return true
}
}
}
// Keep counting, if more than 100 ticks, end this pulse as a failsafe.
if (count > 100) {
npc.startDeath(null)
npc.setWalks(true)
return true
}
return false
}
})
} else {
sendMessage(player, "The cell door is locked.")
}
}
onUseWith(IntType.SCENERY, Items.CELL_KEY_1_3136, Scenery.CELL_DOOR_3765) { player, used, with ->
unlockMadEadgarCellDoor(player, with)
return@onUseWith true
}
on(Scenery.CELL_DOOR_3765, IntType.SCENERY, "unlock"){ player, node ->
unlockMadEadgarCellDoor(player, node)
return@on true
}
// Key to unlock Godric's cell
fun unlockGodricCellDoor(player: Player, node: Node) {
if (inInventory(player, Items.CELL_KEY_2_3137)){
sendMessage(player, "You unlock the cell door.")
if (getQuestStage(player, TrollStronghold.questName) == 8) {
setQuestStage(player, TrollStronghold.questName, 10)
} else if (getQuestStage(player, TrollStronghold.questName) == 9) {
setQuestStage(player, TrollStronghold.questName, 11)
}
// Animate Godric leaving cell.
val npc = findNPC(NPCs.GODRIC_1114)!!
sendNPCDialogue(player, NPCs.GODRIC_1114, "Thank you, my friend.")
submitWorldPulse(object : Pulse(0) {
// This is basically chaining a series of walks + and door handler.
var count = 0
var stage = 0
var trigger = true
var targetLocation = Location(0, 0, 0)
override fun pulse(): Boolean {
if (npc.location.equals(targetLocation)){
stage++
trigger = true
}
if (trigger) {
trigger = false
when (stage) {
0 -> forceWalk(npc, Location(2831, 10078, 0), "dumb").also {
npc.walkRadius = 11
npc.setWalks(false)
targetLocation = Location(2831, 10078, 0)
}
1 -> DoorActionHandler.handleAutowalkDoor(npc, node.asScenery()).also { targetLocation = Location(2832, 10078, 0) }
// Delay 2 ticks for DoorActionHandler to finish
4 -> forceWalk(npc, Location(2836, 10078, 0), "dumb").also { targetLocation = Location(2836, 10078, 0) }
5 -> forceWalk(npc, Location(2836, 10061, 0), "dumb").also { targetLocation = Location(2836, 10061, 0) }
6 -> forceWalk(npc, Location(2824, 10050, 0), "dumb").also { targetLocation = Location(2824, 10050, 0) }
7 -> {
// Out of sight death to trigger respawn.
npc.teleport(Location(2823, 10035, 0))
npc.startDeath(null)
npc.setWalks(true)
return true
}
}
}
// Keep counting, if more than 100 ticks, end this pulse as a failsafe.
count++
if (count > 100) {
npc.startDeath(null)
npc.setWalks(true)
return true
}
return false
}
})
} else {
sendMessage(player, "The cell door is locked.")
}
}
onUseWith(IntType.SCENERY, Items.CELL_KEY_2_3137, Scenery.CELL_DOOR_3767) { player, used, with ->
unlockGodricCellDoor(player, with)
return@onUseWith true
}
on(Scenery.CELL_DOOR_3767, IntType.SCENERY, "unlock"){ player, node ->
unlockGodricCellDoor(player, node)
return@on true;
}
// Exit
on(Scenery.EXIT_3761, IntType.SCENERY, "open"){ player, _ ->
player.properties.teleportLocation = Location.create(2827, 3646, 0)
return@on true
}
// Reentry Secret Door
on(Scenery.SECRET_DOOR_3762, IntType.SCENERY, "open"){ player, _ ->
if (getQuestStage(player, TrollStronghold.questName) >= 8) {
player.properties.teleportLocation = Location.create(2824, 10050, 0)
} else {
sendMessage(player, "The door is locked.")
}
return@on true
}
}
/**
* Method used to determine the success of a player when thieving.
* Copied from ThievingGuidePlugin
* @param player the player.
* @return `True` if successful, `False` if not.
*/
fun success(player: Player, skill: Int): Boolean {
val level = player.getSkills().getLevel(skill).toDouble()
val req = 30.0
val successChance = ceil((level * 50 - req) / req / 3 * 4)
val roll = RandomFunction.random(99)
return successChance >= roll
}
}
@@ -0,0 +1,54 @@
package content.region.asgarnia.burthorpe.quest.trollstronghold
import core.api.getQuestStage
import core.api.isQuestInProgress
import core.api.produceGroundItem
import core.api.transformNpc
import core.game.node.entity.Entity
import core.game.node.entity.combat.CombatStyle
import core.game.node.entity.npc.AbstractNPC
import core.game.node.entity.player.Player
import core.game.world.map.Location
import core.plugin.Initializable
import core.tools.RandomFunction
import org.rs09.consts.Items
import org.rs09.consts.NPCs
@Initializable
class TwigNpc(id: Int = 0, location: Location? = null) : AbstractNPC(id, location) {
override fun construct(id: Int, location: Location, vararg objects: Any): AbstractNPC {
return TwigNpc(id, location)
}
override fun getIds(): IntArray {
return intArrayOf(NPCs.TWIG_1126, NPCs.TWIG_1128)
}
// Transform from sleeping to awake.
override fun isAttackable(entity: Entity, style: CombatStyle, message: Boolean): Boolean {
val attackable = super.isAttackable(entity, style, message)
if (this.id == NPCs.TWIG_1128) {
val prevLifePoints = this.skills.lifepoints
this.transform(NPCs.TWIG_1126)
this.skills.lifepoints = prevLifePoints
}
return attackable
}
override fun handleTickActions() {
super.handleTickActions()
// When returning to spawn, transform back to sleeping and keep lifepoints.
if (getAttribute("return-to-spawn", false) && this.id == NPCs.TWIG_1126) {
val prevLifePoints = this.skills.lifepoints
this.transform(NPCs.TWIG_1128)
this.skills.lifepoints = prevLifePoints
}
}
override fun finalizeDeath(killer: Entity?) {
if (isQuestInProgress(killer as Player, TrollStronghold.questName, 8, 10)) {
produceGroundItem(killer, Items.CELL_KEY_1_3136, 1, this.location)
}
super.finalizeDeath(killer)
}
}
@@ -291,6 +291,12 @@ public final class TrollheimPlugin extends OptionHandler {
} else {
bandaid(player, player.getLocation(), Location.create(2911, 3686, 0), JUMP);
}
} else if (loc.equals(new Location(2857, 3612, 0)) || loc.equals(new Location(2856, 3612, 0))) {
if (player.getSkills().getLevel(Skills.AGILITY) < 15) {
player.getPacketDispatch().sendMessage("You need an Agility level of 15 in order to climb this rock.");
return true;
}
bandaid(player, player.getLocation(), player.getLocation().getY() < object.getLocation().getY() ? player.getLocation().transform(0, 2, 0) : player.getLocation().transform(0, -2, 0), JUMP);
} else {
bandaid(player, player.getLocation(), player.getLocation().getY() < object.getLocation().getY() ? player.getLocation().transform(0, 2, 0) : player.getLocation().transform(0, -2, 0), JUMP);
}