Fremennik Easy Diary is now completable and Fremennik sea boots 1 can now be obtained

PickUpEvent Event Hook created, for events that need to fire when player picks up a specific item
All currently implemented Diary tasks where the player must pick up items have been converted to use the new PickUpEvent event hook
New zone created for the windswept tree (highest tree in the Fremennik area task) for its diary task
Rough dialogue created for obtaining your completed diary reward from Council Worker
This commit is contained in:
skelsoft 2022-06-25 04:11:08 +00:00 committed by Ryan
parent 49a6c833af
commit 43479e23f6
12 changed files with 282 additions and 32 deletions

View file

@ -270,6 +270,6 @@ public final class HuntingExpert extends DialoguePlugin {
@Override
public int[] getIds() {
return new int[] { 5112, 5113 };
return new int[] { 5113 };
}
}

View file

@ -344,16 +344,16 @@ public enum DiaryType {
new String[]{"Easy", "Medium", "Hard"},
new String[][]{
{
"Kill a cave crawler in the Fremennik Slayer Dungeon", // TODO
"Kill five rock crabs on the shore near Rellekka or on<br><br>Waterbirth Island", // TODO
"Find the highest tree on the Fremennik mainland", // TODO
"View the rewards in the Barbarian Assault tutorial", // TODO
"Speak to Otto Godblessed about barbarian training", // TODO
"Collect three seaweed from the shore north-east of Rellekka", // TODO
"Find the Hunting Expert on the northern ice plains", // TODO
"Catch a fish off one of Rellekka's piers", // TODO
"Recharge your Summoning points near Rellekka's gate", // TODO
"Kill an adult black unicorn" // TODO
"Kill a cave crawler in the Fremennik Slayer Dungeon",
"Kill five rock crabs on the shore near Rellekka or on<br><br>Waterbirth Island",
"Find the highest tree on the Fremennik mainland",
"View the rewards in the Barbarian Assault tutorial", // TODO: Move this to appropriate dialogue once Barbarian Assault is implemented
"Speak to Otto Godblessed about barbarian training", // TODO: Move this to an appropriate point once the entirety of Barbarian training is implemented
"Collect three seaweed from the shore north-east of Rellekka",
"Find the Hunting Expert on the northern ice plains", // TODO: Transcribe the appropriate authentic dialogue for this NPC. Mockup dialogue implemented as a bandaid.
"Catch a fish off one of Rellekka's piers", // TODO: Make this check for any Fishing Spots within the Rellekkan region ID list. Currently only checks the "Cage/Harpoon" Fishing spots at the northeastern most pier.
"Recharge your Summoning points near Rellekka's gate",
"Kill an adult black unicorn"
},
{
"Learn of the history of the Fremennik and the Outerlanders<br><br>from Chieftain Brundt", // TODO

View file

@ -15,5 +15,6 @@ data class ButtonClickedEvent(val iface: Int, val buttonId: Int) : Event
data class UsedWithEvent(val used: Int, val with: Int) : Event
data class SelfDeath(val killer: Entity) : Event
data class TickEvent(val worldTicks: Int) : Event
data class PickUpEvent(val itemId: Int) : Event
data class InterfaceOpenEvent(val component: Component) : Event
data class InterfaceCloseEvent(val component: Component) : Event

View file

@ -12,6 +12,7 @@ object Event {
@JvmStatic val UsedWith = UsedWithEvent::class.java
@JvmStatic val SelfDeath = SelfDeath::class.java
@JvmStatic val Tick = TickEvent::class.java
@JvmStatic val PickedUp = PickUpEvent::class.java
@JvmStatic val InterfaceOpened = InterfaceOpenEvent::class.java
@JvmStatic val InterfaceClosed = InterfaceCloseEvent::class.java
}

View file

@ -4,6 +4,7 @@ import api.*
import core.game.content.dialogue.DialoguePlugin
import core.game.content.dialogue.FacialExpression
import core.game.node.entity.player.Player
import core.game.node.entity.player.link.diary.DiaryType
import core.game.node.item.Item
import core.plugin.Initializable
import org.rs09.consts.Items
@ -22,6 +23,7 @@ class CaptainCainDialogue(player: Player? = null) : DialoguePlugin(player) {
override fun open(vararg args: Any?): Boolean {
npcl(FacialExpression.FRIENDLY, "Hello, there, adventurer. Say, you wouldn't happen to be interested in purchasing a Fighter Torso would you?")
player.achievementDiaryManager.finishTask(player,DiaryType.FREMENNIK,0,3)
stage = 0
return true
}

View file

@ -4,6 +4,7 @@ import core.game.content.dialogue.DialoguePlugin
import core.game.content.dialogue.FacialExpression
import core.game.node.entity.npc.NPC
import core.game.node.entity.player.Player
import core.game.node.entity.player.link.diary.DiaryType
import core.plugin.Initializable
import rs09.tools.END_DIALOGUE
@ -49,7 +50,7 @@ class OttoGodblessedDialogue(player: Player? = null) : DialoguePlugin(player) {
25 -> npc("Look, just... grab the pole under my bed","and go click on that fishing spot.").also { stage++ }
26 -> player(FacialExpression.ASKING,"...click?").also { stage++ }
27 -> npc(FacialExpression.FURIOUS, "JUST GO DO IT!").also { stage++; player.setAttribute("/save:barbtraining:fishing",true) }
28 -> end()
28 -> end().also { player.achievementDiaryManager.finishTask(player, DiaryType.FREMENNIK,0,4) }
}
return true
}

View file

@ -1,12 +1,18 @@
package rs09.game.content.dialogue.region.rellekka
import api.addItem
import api.questStage
import api.sendItemDialogue
import core.game.content.dialogue.DialoguePlugin
import core.game.content.dialogue.FacialExpression
import core.game.node.entity.npc.NPC
import core.game.node.entity.player.Player
import core.game.node.entity.player.link.diary.AchievementDiary
import core.game.node.entity.player.link.diary.DiaryType
import core.plugin.Initializable
import org.rs09.consts.Items;
import rs09.game.content.quest.members.thefremenniktrials.CouncilWorkerFTDialogue
import rs09.game.content.dialogue.region.rellekka.CouncilWorkerDiaryDialogue
@Initializable
class CouncilWorkerDialogue(player: Player? = null) : DialoguePlugin(player){
@ -14,8 +20,13 @@ class CouncilWorkerDialogue(player: Player? = null) : DialoguePlugin(player){
npc = args[0] as NPC
if(questStage(player, "Fremennik Trials") in 1..99){
player.dialogueInterpreter.open((CouncilWorkerFTDialogue(1)))
} else {
npc(FacialExpression.FRIENDLY,"'Ello there.").also { stage = 0 }
}
else if(player.achievementDiaryManager.getDiary(DiaryType.FREMENNIK).isComplete(0, true)){
player.dialogueInterpreter.open((CouncilWorkerDiaryDialogue()))
}
else{
player(FacialExpression.FRIENDLY,"Hello.")
npc(FacialExpression.FRIENDLY,"How do. You planning on crossing this here bridge and heading up to Rellekka then?").also { stage = 0 }
}
return true
}

View file

@ -0,0 +1,42 @@
package rs09.game.content.dialogue.region.rellekka
import api.*
import core.game.content.dialogue.FacialExpression
import org.rs09.consts.Items
import rs09.game.content.dialogue.DialogueFile
import rs09.tools.END_DIALOGUE
import rs09.tools.START_DIALOGUE
const val COUNCIL_WORKER = 1287
class CouncilWorkerDiaryDialogue() : DialogueFile() {
override fun handle(componentID: Int, buttonID: Int) {
when (stage) {
START_DIALOGUE -> {
player(FacialExpression.FRIENDLY, "About my achievement diary...");stage++
}
1 -> {
npc(COUNCIL_WORKER, "You have completed the Fremennik Easy Diary!");stage++
//player.achievementDiaryManager.getDiary(DiaryType.FREMENNIK).setLevelRewarded(0)
}
2 -> {
player?.let { addItem(it, Items.FREMENNIK_SEA_BOOTS_1_14571) }
player?.let {
sendItemDialogue(
it,
Items.FREMENNIK_SEA_BOOTS_1_14571,
"The worker hands you some old sea boots."
);stage++
}
}
3 -> {
npc(
COUNCIL_WORKER,
"You can now use Peer the Seer to deposit your items!"
).also { stage = END_DIALOGUE }
}
}
}
}

View file

@ -0,0 +1,61 @@
package rs09.game.content.dialogue.region.rellekka
import core.game.content.dialogue.DialoguePlugin
import core.game.content.dialogue.FacialExpression
import core.game.node.entity.npc.NPC
import core.game.node.entity.player.Player
import core.game.node.entity.player.link.diary.DiaryType
import core.plugin.Initializable
import rs09.tools.END_DIALOGUE
/**
* Represents the dialogue plugin used for the Hunting Expert in the Rellekkan Hunter area
* @author Crash
* @version 1.0
*/
@Initializable
class HuntingExpertRellekkaDialogue(player: Player? = null) : DialoguePlugin(player) {
override fun newInstance(player: Player): DialoguePlugin {
return HuntingExpertRellekkaDialogue(player)
}
override fun open(vararg args: Any?): Boolean {
npc = args[0] as NPC
npc("Good day, you seem to have a keen eye. Maybe even", "some hunter's blood in that body of yours?")
stage = -1
return true
}
override fun init() {
super.init()
}
override fun handle(interfaceId: Int, buttonId: Int): Boolean {
when (stage) {
-1 -> options("Ask about polar hunting", "Nevermind.").also { stage++ }
0 -> when(buttonId){
1 -> player("Is there anything you can teach me?").also { stage = 20 }
2 -> stage++
}
1 -> stage = END_DIALOGUE
20 -> npc("I can teach you how to hunt.").also { stage++ }
21 -> player("What kind of creatures can I hunt?").also { stage++ }
22 -> npc("Many creatures in many ways.","You need to make some traps","and catch birds!").also { stage++ }
23 -> player("Birds?").also { stage++ }
24 -> npc(FacialExpression.ANGRY, "Yes, birds! Like these ones here!").also { stage++ }
25 -> npc("Look, just... get some Hunting gear","and go set up some traps.").also { stage++ }
26 -> player(FacialExpression.ASKING,"Is that it?").also { stage++ }
27 -> npc(FacialExpression.FURIOUS, "JUST GO DO IT!").also { stage++ }
28 -> end().also { player.achievementDiaryManager.finishTask(player, DiaryType.FREMENNIK,0,6) }
}
return true
}
override fun getIds(): IntArray {
return intArrayOf(5112)
}
}

View file

@ -1,5 +1,6 @@
package rs09.game.content.global.action
import api.events.PickUpEvent
import core.game.content.dialogue.FacialExpression
import core.game.content.global.GodType
import core.game.node.entity.player.Player
@ -57,27 +58,14 @@ object PickupHandler {
if (!RegionManager.isTeleportPermitted(item.location)) {
player.animate(Animation.create(535))
}
if (item is GroundSpawnLoader.GroundSpawn && item.getId() == Items.SEAWEED_401
&& player.zoneMonitor.isInZone("karamja")
&& !player.achievementDiaryManager.hasCompletedTask(DiaryType.KARAMJA, 0, 7)) {
var seaweed = player.getAttribute("seaweed", 0)
seaweed++
player.setAttribute("seaweed", seaweed)
player.achievementDiaryManager.updateTask(player, DiaryType.KARAMJA, 0, 7, seaweed >= 5)
}
// Collect five palm leaves
if (item.getId() == Items.PALM_LEAF_2339 && player.zoneMonitor.isInZone("karamja") && !player.achievementDiaryManager.hasCompletedTask(DiaryType.KARAMJA, 2, 7)) {
var palms = player.getAttribute("palms", 0)
palms++
player.setAttribute("palms", palms)
player.achievementDiaryManager.updateTask(player, DiaryType.KARAMJA, 2, 7, palms >= 5)
}
GroundItemManager.destroy(item)
/* if (item.dropper?.isArtificial == true) {
getItems(item.dropper)?.remove(item)
}*/
}
*/
player.audioManager.send(Audio(2582, 10, 1))
player.dispatch(PickUpEvent(item.id))
}
return true
}

View file

@ -0,0 +1,52 @@
package rs09.game.node.entity.player.diary.seers
import core.game.node.entity.Entity
import core.game.node.entity.player.Player
import core.plugin.Initializable
import core.game.world.map.zone.MapZone
import core.game.node.entity.player.link.diary.DiaryType
import core.game.world.map.Location
import core.game.world.map.zone.ZoneBorders
import core.game.world.map.zone.ZoneBuilder
import core.plugin.Plugin
@Initializable
class WindsweptTreeZone : MapZone("windswept-tree", true), Plugin<Any?> {
override fun newInstance(arg: Any?): WindsweptTreeZone {
ZoneBuilder.configure(this)
return this
}
override fun configure() {
super.register(ZoneBorders(2746, 3733, 2746, 3735))
super.register(ZoneBorders(2570, 3732, 2570, 3736))
}
override fun enter(e: Entity?): Boolean {
return super.enter(e)
}
override fun fireEvent(identifier: String?, vararg args: Any?): Any {
return Unit
}
override fun locationUpdate(e: Entity?, last: Location?) {
if (e is Player && !e.isArtificial) {
val player = e.asPlayer()
if (!player.achievementDiaryManager.hasCompletedTask(DiaryType.FREMENNIK, 0, 2)) {
player.achievementDiaryManager.finishTask(player, DiaryType.FREMENNIK, 0, 2)
println("Fremennik Easy Diary Task 2 Completed!")
} else {
player.achievementDiaryManager.finishTask(player, DiaryType.FREMENNIK, 0, 2)
}
}
}
}
// override fun leave(e: Entity?, logout: Boolean) {
// if (e is Player) {
// super.leave(e, logout)
//}
//}}

View file

@ -26,12 +26,16 @@ class DiaryEventHook : LoginListener, Commands {
player.hook(Event.Interaction, DiaryInteractionEvents)
player.hook(Event.InterfaceOpened, DiaryInterfaceOpenEvents)
player.hook(Event.InterfaceClosed, DiaryInterfaceCloseEvents)
player.hook(Event.PickedUp, DiaryPickupEvents)
}
companion object {
private fun finishTask(entity: Player, diary: DiaryType, index: Int, task: Int) {
entity.achievementDiaryManager.finishTask(entity, diary, index, task)
}
private fun taskCompleted(entity: Player, diary: DiaryType,index: Int,task: Int): Boolean {
return entity.achievementDiaryManager.hasCompletedTask(diary,index,task)
}
}
private object DiaryInterfaceCloseEvents : EventHook<InterfaceCloseEvent> {
@ -78,6 +82,8 @@ class DiaryEventHook : LoginListener, Commands {
24350, 24361 -> if (regionId == 12854) finishTask(entity, DiaryType.VARROCK, 0, 18)
in 115..122 -> if (event.option == "burst") finishTask(entity, DiaryType.FALADOR, 0, 12)
16149 -> finishTask(entity, DiaryType.VARROCK, 0, 4)
29944 -> if(regionId == 10552 && event.option == "renew-points") finishTask(entity, DiaryType.FREMENNIK,0,8)
//18137 -> if(regionId == 10810 && event.option == "examine") finishTask(entity, DiaryType.FREMENNIK,0,2)
//2112 -> if()
}
}
@ -101,11 +107,63 @@ class DiaryEventHook : LoginListener, Commands {
}
}
private object DiaryPickupEvents : EventHook<PickUpEvent>
{
override fun process(entity: Entity, event: PickUpEvent) {
if(entity !is Player) return
val regionId = entity.viewport.region.id
val Karamja = intArrayOf(10801,10802,11053,11054,11055,11056,11057,11058,11309,
11310,11311,11312,11313,11314,11565,11566,11567,11568,11569,11821,11822,11823)
when(event.itemId){
Items.SEAWEED_401 -> {
if(regionId == 10810 && !taskCompleted(entity,DiaryType.FREMENNIK,0,5)){
when(entity.getAttribute("RellekaSeaweed",0)){
0 -> entity.setAttribute("/save:RellekaSeaweed",1)
1 -> entity.incrementAttribute("RellekaSeaweed")
2 -> {
finishTask(entity, DiaryType.FREMENNIK,0,5)
entity.removeAttribute("RellekkaSeaweed")
}
}
}
if(regionId in Karamja && !taskCompleted(entity,DiaryType.KARAMJA, 0, 7)){
when(entity.getAttribute("KaramjaSeaweed", 0)){
0 -> entity.setAttribute("/save:KaramjaSeaweed",1)
in 1..3 -> entity.incrementAttribute("KaramjaSeaweed")
4 -> {
finishTask(entity,DiaryType.KARAMJA,0,7)
entity.removeAttribute("KaramjaSeaweed")
}
}
}
}
Items.PALM_LEAF_2339 -> {
if(regionId in Karamja && !taskCompleted(entity,DiaryType.KARAMJA,2,7)){
when(entity.getAttribute("KaramjaPalms",0)){
0 -> entity.setAttribute("/save:KaramjaPalms",1)
in 1..3 -> entity.incrementAttribute("KaramjaPalms")
4 -> {
finishTask(entity,DiaryType.KARAMJA,2,7)
entity.removeAttribute("KaramjaPalms")
}
}
}
}
}
}
}
private object DiaryGatherHooks : EventHook<ResourceProducedEvent> {
override fun process(entity: Entity, event: ResourceProducedEvent) {
if (entity !is Player) return
val regionId = entity.viewport.region.id
when (event.itemId) {
val RellekkaFishingSpots = intArrayOf(NPCs.FISHING_SPOT_324, NPCs.FISHING_SPOT_334, NPCs.FISHING_SPOT_322, NPCs.FISHING_SPOT_309)
when(event.itemId)
{
//Cut a log from a teak tree
Items.TEAK_LOGS_6333 -> finishTask(entity, DiaryType.KARAMJA, 1, 7)
//Cut a log from a mahogany tree
@ -227,6 +285,15 @@ class DiaryEventHook : LoginListener, Commands {
if (event.source.id == Scenery.COOKING_RANGE_114 && regionId == 12850)
finishTask(entity, DiaryType.LUMBRIDGE, 0, 7)
if(event.source.id == NPCs.FISHING_SPOT_324 && regionId == 10553)
finishTask(entity, DiaryType.FREMENNIK, 0, 7)
//Fish off of any of Rellekka's piers
//in RellekkaFishingSpots -> {
// if(entity.viewport.region.id == 10553)
//finishTask(entity, DiaryType.FREMENNIK, 0, 7)
//}
}
}
@ -244,6 +311,8 @@ class DiaryEventHook : LoginListener, Commands {
val metalDragons =
intArrayOf(NPCs.BRONZE_DRAGON_1590, NPCs.IRON_DRAGON_1591, NPCs.STEEL_DRAGON_1592, NPCs.STEEL_DRAGON_3590)
val lumZombies = intArrayOf(NPCs.ZOMBIE_73, NPCs.ZOMBIE_74)
val fremCrabs = intArrayOf(NPCs.ROCK_CRAB_1265,NPCs.ROCK_CRAB_1267,NPCs.GIANT_ROCK_CRAB_2452,NPCs.GIANT_ROCK_CRAB_2885)
val fremCrawlers = intArrayOf(NPCs.CAVE_CRAWLER_1600,NPCs.CAVE_CRAWLER_1601,NPCs.CAVE_CRAWLER_1602,NPCs.CAVE_CRAWLER_1603,NPCs.CAVE_CRAWLER_7787,NPCs.CAVE_CRAWLER_7812)
override fun process(entity: Entity, event: NPCKillEvent) {
if (entity !is Player) return
@ -261,6 +330,28 @@ class DiaryEventHook : LoginListener, Commands {
}
}
in fremCrawlers ->{
if(entity.viewport.region.id == 11164){
finishTask(entity,DiaryType.FREMENNIK,0,0)
}
}
in fremCrabs -> {
if (entity.viewport.region.id == 10810 || entity.viewport.region.id == 10042) {
when(entity.getAttribute("FremCrabs",0)){
0 -> entity.setAttribute("/save:FremCrabs",1)
in 1..3 -> entity.incrementAttribute("FremCrabs")
4 -> finishTask(entity,DiaryType.FREMENNIK, 0, 1)
}
}
}
NPCs.BLACK_UNICORN_133 -> {
if (entity.viewport.region.id in 10808..10809){
finishTask(entity,DiaryType.FREMENNIK,0,9)
}
}
NPCs.JOGRE_113 -> {
if (entity.viewport.region.id == 11412)
finishTask(entity, DiaryType.KARAMJA, 0, 9)