Implemented 3 unique books for Wise Old Man's house, books are located in the bookshelves in his house

New Wise Old Man dialogue trees for books
Implemented book for digsite quest
This commit is contained in:
szumaster 2023-06-16 11:04:40 +00:00 committed by Ryan
parent 3d8857e01c
commit eb65c4c78b
6 changed files with 602 additions and 4 deletions

View file

@ -0,0 +1,85 @@
package content.region.misthalin.digsite.dialogue
import content.global.handlers.iface.BookInterface
import content.global.handlers.iface.BookLine
import content.global.handlers.iface.Page
import content.global.handlers.iface.PageSet
import core.api.setAttribute
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import core.game.node.entity.player.Player
import org.rs09.consts.Items
class ChemicalsBook : InteractionListener {
// Part of The Dig Site quest. It has some information on how to
// make an explosive potion that can be used to destroy some blocks.
companion object {
private val TITLE = "Volatile chemicals Experimental Test Notes"
private val CONTENTS = arrayOf(
PageSet(
Page(
BookLine("<col=0000FF>Volatile Chemicals:", 55),
BookLine("Experimental Test Notes.", 56),
BookLine("In order to ease the mining", 58),
BookLine("process, my colleagues and", 59),
BookLine("I decided we needed something", 60),
BookLine("stronger than picks to delve", 61),
BookLine("under the surface of the site.", 62),
BookLine("As I already had an", 64),
BookLine("intermediate knowledge", 65),
),
Page(
BookLine("of Herblore, I experimented", 66),
BookLine("with certain chemicals and", 67),
BookLine("invented a compound of", 68),
BookLine("tremendous power that,", 69),
BookLine("if subjected to a spark,", 70),
BookLine("would literally explode.", 71),
BookLine("We used vials of this", 73),
BookLine("compound with great effect,", 74),
BookLine("as it enabled us to reach", 75),
BookLine("further than ever before.", 76),
)
),
PageSet(
Page(
BookLine("Here is what I have left of", 55),
BookLine("the compound's recipe:", 56),
BookLine("1 measure of ammonium", 59),
BookLine("nitrate powder;", 60),
BookLine("1 measure of nitroglycerine;", 62),
BookLine("1 measure of ground charcoal;", 64),
),
Page(
BookLine("1 measure of ?", 66),
BookLine("Unfortunately the last", 68),
BookLine("ingredient was not noted", 69),
BookLine("down, but we understand", 70),
BookLine("that a certain root grows", 71),
BookLine("around these parts that", 72),
BookLine("was used to very good", 73),
BookLine("effect...", 73),
)
),
)
}
private fun display(player: Player, pageNum: Int, buttonID: Int): Boolean {
BookInterface.pageSetup(
player, BookInterface.FANCY_BOOK_3_49, TITLE, CONTENTS
)
return true
}
override fun defineListeners() {
on(Items.BOOK_ON_CHEMICALS_711, IntType.ITEM, "read") { player, _ ->
setAttribute(player, "bookInterfaceCallback", ::display)
setAttribute(player, "bookInterfaceCurrentPage", 0)
display(player, 0, 0)
return@on true
}
}
}

View file

@ -0,0 +1,113 @@
package content.region.misthalin.draynor.dialogue
import content.global.handlers.iface.BookInterface
import content.global.handlers.iface.BookLine
import content.global.handlers.iface.Page
import content.global.handlers.iface.PageSet
import core.api.setAttribute
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import core.game.node.entity.player.Player
import org.rs09.consts.Items
class ChickenBook : InteractionListener {
// Book about the Evil Chicken found on the bookshelves in the Wise Old Man's house in Draynor Village.
companion object {
private val TITLE = "The Origins of the Bird of Evil"
private val CONTENTS = arrayOf(
PageSet(
Page(
BookLine("Many are the rumours", 55),
BookLine("and tales surrounding", 56),
BookLine("this foul beast.", 57),
BookLine("", 58),
BookLine("The earliest of these tales", 59),
BookLine("seems to date back to", 60),
BookLine("the time of the Mahjarrat.", 61),
BookLine("It is a story about a mad", 62),
BookLine("mage, who attempts to summon", 63),
BookLine("a demon and bind it to his", 64),
BookLine("will. Unfortunately his", 65),
),
Page(
BookLine("spell failed and all that", 66),
BookLine("appeared was one confused", 67),
BookLine("chicken. In a fit of anger", 68),
BookLine("at his failure the mage", 69),
BookLine("banished the chicken to the", 70),
BookLine("Abyss. The chicken however", 71),
BookLine("appears to have survived", 72),
BookLine("and grown in power. Years", 73),
BookLine("later, when the mage cast", 74),
BookLine("another spell of summoning,", 75),
BookLine("the chicken appeared!", 76),
)
),
PageSet(
Page(
BookLine("The story does not tell", 55),
BookLine("of what became of the mage.", 56),
BookLine("", 57),
BookLine("Another popular tale", 58),
BookLine("tells of a chicken of", 59),
BookLine("higher than average", 60),
BookLine("mental ability. Realising", 61),
BookLine("that it and its kind were", 62),
BookLine("prisoners in their coops", 63),
BookLine("he organised a rebellion", 64),
BookLine("against the human farmers.", 65),
),
Page(
BookLine("The farmers, of course,", 66),
BookLine("simply slaughtered the", 67),
BookLine("rebellious chickens.", 68),
BookLine("However, ", 70),
BookLine("the Evil Chicken escaped.", 71),
BookLine("Blaming its brethren for", 72),
BookLine("the coup's failure it", 73),
BookLine("swore revenge on", 74),
BookLine("all chickens and all humans.", 75),
)
),
PageSet(
Page(
BookLine("The Chicken can strike", 55),
BookLine("anybody, anywhere. It", 56),
BookLine("is said that a coven ", 57),
BookLine("worships this fell fowl and", 58),
BookLine("have even built a shrine to it.", 59),
BookLine("The exact location of this", 60),
BookLine("shrine is unknown, but is", 61),
BookLine("rumoured to be in the", 62),
BookLine("fairyworlds. Further", 63),
BookLine("rumour suggests that", 64),
BookLine("his lair is guarded by", 65),
),
Page(
BookLine("some fearsome beasts, but", 66),
BookLine("it may be reached by", 67),
BookLine("making a tasty offering...", 68),
BookLine("whatever that may be.", 69),
),
)
)
}
private fun display(player: Player, pageNum: Int, buttonID: Int): Boolean {
BookInterface.pageSetup(
player, BookInterface.FANCY_BOOK_3_49, TITLE, CONTENTS
)
return true
}
override fun defineListeners() {
on(Items.BOOK_ON_CHICKENS_7464, IntType.ITEM, "read") { player, _ ->
setAttribute(player, "bookInterfaceCallback", ::display)
setAttribute(player, "bookInterfaceCurrentPage", 0)
display(player, 0, 0)
return@on true
}
}
}

View file

@ -0,0 +1,62 @@
package content.region.misthalin.draynor.dialogue
import content.global.handlers.iface.BookInterface
import content.global.handlers.iface.BookLine
import content.global.handlers.iface.Page
import content.global.handlers.iface.PageSet
import core.api.setAttribute
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import core.game.node.entity.player.Player
import org.rs09.consts.Items
class FolkloreBook : InteractionListener {
// Book found on the bookshelves in the Wise Old Man's house in Draynor Village.
companion object {
private val TITLE = "The Myth of the Elder-dragons"
private val CONTENTS = arrayOf(
PageSet(
Page(
BookLine("Although the Elder-dragons", 55),
BookLine("are generally considered", 56),
BookLine("to be a myth, stories tell", 57),
BookLine("of an ancient race that dwelt", 58),
BookLine("on Gielinor before any other.", 59),
BookLine("In some arcane way their", 60),
BookLine("lifeforce was linked to the", 61),
BookLine("life of the world itself;", 62),
BookLine("it is written that, as long", 63),
BookLine("as the Elder-dragons", 64),
BookLine("continue to live,", 65),
),
Page(
BookLine("the world shall not end.", 66),
BookLine("However, sceptics claim", 67),
BookLine("that the myth of the", 68),
BookLine("Elder-dragons was invented", 69),
BookLine("to cast doubt on claims", 70),
BookLine("that this realm was lifeless", 71),
BookLine("until the gods first arrived.", 72),
),
)
)
}
private fun display(player: Player, pageNum: Int, buttonID: Int): Boolean {
BookInterface.pageSetup(
player, BookInterface.FANCY_BOOK_3_49, TITLE, CONTENTS
)
return true
}
override fun defineListeners() {
on(Items.BOOK_OF_FOLKLORE_5508, IntType.ITEM, "read") { player, _ ->
setAttribute(player, "bookInterfaceCallback", ::display)
setAttribute(player, "bookInterfaceCurrentPage", 0)
display(player, 0, 0)
return@on true
}
}
}

View file

@ -0,0 +1,249 @@
package content.region.misthalin.draynor.dialogue
import content.global.handlers.iface.BookInterface
import content.global.handlers.iface.BookLine
import content.global.handlers.iface.Page
import content.global.handlers.iface.PageSet
import core.api.setAttribute
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import core.game.node.entity.player.Player
import org.rs09.consts.Items
class StrangeBook : InteractionListener {
// The strange book is a book found on the bookshelves in the Wise Old Man's.
companion object {
private val TITLE = "Stange book"
private val CONTENTS = arrayOf(
PageSet(
Page(
BookLine("<col=0000FF>Perception and Reality", 55),
BookLine("... which leads us to the", 56),
BookLine("new definition of knowledge", 57),
BookLine("as a belief that is both", 58),
BookLine("reliably generated and true.", 59),
BookLine("Our senses tell us about", 61),
BookLine("the world, but to what", 62),
BookLine("extent are they reliable?", 63),
BookLine("One witness may perceive", 64),
BookLine("the weather to be hot,", 65),
),
Page(
BookLine("but another witness may", 66),
BookLine("consider it to be quite", 67),
BookLine("cold.", 68),
BookLine("Perception of colour may", 70),
BookLine("be similarly affected, as", 71),
BookLine("the reader may demonstrate", 72),
BookLine("by staring at a piece of", 73),
BookLine("brightly-coloured paper.", 74),
BookLine("When the paper is removed,", 75),
BookLine("the reader may find that", 76),
)
),
PageSet(
Page(
BookLine("everything else appears", 55),
BookLine("to be a slightly different", 56),
BookLine("colour from normal.", 57),
BookLine("We may conclude from this", 59),
BookLine("that, although we are", 60),
BookLine("sensing some intrinsic", 61),
BookLine("property of the object", 62),
BookLine("under examination,", 63),
BookLine("qualities such as colour", 64),
BookLine("and temperature are NOT", 65),
),
Page(
BookLine("intrinsic.", 66),
BookLine("Henceforth we recommend", 68),
BookLine("that the reader consider", 69),
BookLine("them to be Secondary", 70),
BookLine("qualities. The quantity", 71),
BookLine("of caloric within the", 72),
BookLine("object that gives it this", 73),
BookLine("perceived temperature", 74),
BookLine("truly is intrinsic to", 75),
BookLine("the object, so this may", 76),
)
),
PageSet(
Page(
BookLine("be considered a Primary", 55),
BookLine("quality.", 56),
BookLine("In the following chapter", 58),
BookLine("we will examine the", 59),
BookLine("implications of this", 60),
BookLine("distinction for the study", 61),
BookLine("of natural philosophy.", 62),
BookLine("<col=0000FF>Certainty and Assumption", 65),
),
Page(
BookLine("In this chapter we aim", 66),
BookLine("to examine the extent to", 67),
BookLine("which our senses give", 68),
BookLine("us a reliable impression", 69),
BookLine("of the world in which", 70),
BookLine("we live.", 71),
BookLine("Although we may believe", 73),
BookLine("that we are seeing and", 74),
BookLine("hearing things that exist,", 75),
BookLine("we may be deceived by", 76),
)
),
PageSet(
Page(
BookLine("our senses, as every", 55),
BookLine("keen drinker will have", 56),
BookLine("experienced! But if our", 57),
BookLine("senses may be deceived,", 58),
BookLine("what can we trust?", 59),
BookLine("We may perhaps try to", 61),
BookLine("rely only on logical", 62),
BookLine("deductions and mathematical", 63),
BookLine("principles. Yet it is", 64),
BookLine("even possible that some", 65),
),
Page(
BookLine("fiend may have confused", 66),
BookLine("our minds to the extent", 67),
BookLine("that we are making false", 68),
BookLine("deductions without being", 69),
BookLine("aware of this.", 70),
BookLine("We therefore present the", 72),
BookLine("following statement as", 73),
BookLine("the only piece of knowledge", 74),
BookLine("about which we cannot", 75),
BookLine("possibly be deceived:", 76),
)
),
PageSet(
Page(
BookLine("'I EXIST'", 55),
BookLine("Although all information", 57),
BookLine("gained through use of our", 58),
BookLine("senses and minds may be", 59),
BookLine("distorted, no self-aware", 60),
BookLine("being can be led to", 61),
BookLine("believe that it does not", 62),
BookLine("exist. It may not be the", 63),
BookLine("man or woman it believes", 64),
BookLine("itself to be, but it can", 65),
),
Page(
BookLine("never question its own", 66),
BookLine("existence in some form.", 67),
BookLine("In the following chapter", 69),
BookLine("we will discuss ways in", 70),
BookLine("which one may attempt to", 71),
BookLine("demonstrate the existence", 72),
BookLine("of a world outside of one's", 73),
BookLine("own consciousness.", 74),
BookLine("<col=0000FF>Graphical solution of", 76),
)
),
PageSet(
Page(
BookLine("<col=0000FF>mathematical problems", 55),
BookLine("A simple graph containing", 57),
BookLine("an x-axis and a y-axis may", 58),
BookLine("be used to represent", 59),
BookLine("equations similar to the", 60),
BookLine("following: x + 3y = 5", 61),
BookLine("For every 'x' and 'y' that", 63),
BookLine("satisfy the equation", 64),
BookLine("(such as x = 2, y = 1 or", 65),
),
Page(
BookLine("x = 5, y = 0 for the", 66),
BookLine("above example), the points", 67),
BookLine("'x,y' may be plotted on", 68),
BookLine("the graph, and it will be", 69),
BookLine("found that they form a line.", 70),
BookLine("If a second equation of", 72),
BookLine("this form is plotted on", 73),
BookLine("the same graph, the two", 74),
BookLine("lines may cross at some", 75),
BookLine("point.", 76),
)
),
PageSet(
Page(
BookLine("Any point where the two", 55),
BookLine("lines cross will be given", 56),
BookLine("by some 'x' and 'y'", 57),
BookLine("that fits both equations.", 58),
BookLine("Readers are invited to", 60),
BookLine("create two such equations", 61),
BookLine("and try it for themselves!", 62),
BookLine("<col=0000FF>Readers' Comments", 64),
),
Page(
BookLine("This page left blank for", 67),
BookLine("readers' comments", 68),
BookLine("... better now, walls look", 70),
BookLine("decent, nice and elegant.", 71),
BookLine("Those new lanterns were a", 72),
BookLine("rip-off, blasted dwarf", 73),
BookLine("craftsmen. Still, not a", 74),
BookLine("problem for me!", 75),
)
),
PageSet(
Page(
BookLine("Even got my old Saradomin", 55),
BookLine("armour gilded, beautiful", 56),
BookLine("gold edges on it now. No-one", 57),
BookLine("else's going to have armour", 58),
BookLine("like that, that'll make", 59),
BookLine("them think, heh heh heh...", 60),
BookLine("Lick of gold-leaf here and", 62),
BookLine("there, even my globe looks", 63),
BookLine("smarter now, maybe that", 64),
BookLine("bath screen was a bit much?", 65),
),
Page(
BookLine("No, I saw it, I wanted it,", 66),
BookLine("it's mine.", 67),
BookLine("Vidi, volui, mihi est!", 68),
BookLine("Still don't know what that", 70),
BookLine("'thing' is, but it looks nice", 71),
BookLine("on my desk. Probably some", 72),
BookLine("kind of transport? Must run", 73),
BookLine("off hot air or dragon", 74),
BookLine("flatulence? Running a", 76),
)
),
PageSet(
Page(
BookLine("bit short of runes now.", 55),
BookLine("Those wizards over to", 56),
BookLine("the south always seem to", 57),
BookLine("have plenty, but will they", 58),
BookLine("spare me some? Bah! Not", 59),
BookLine("a chance, poxy mage scum!", 61),
BookLine("Perhaps another little expedition", 62),
BookLine("is needed - they all", 63),
BookLine("look pretty weedy over there...", 64),
)
),
)
}
private fun display(player: Player, pageNum: Int, buttonID: Int): Boolean {
BookInterface.pageSetup(
player, BookInterface.FANCY_BOOK_3_49, TITLE, CONTENTS
)
return true
}
override fun defineListeners() {
on(Items.STRANGE_BOOK_5507, IntType.ITEM, "read") { player, _ ->
setAttribute(player, "bookInterfaceCallback", ::display)
setAttribute(player, "bookInterfaceCurrentPage", 0)
display(player, 0, 0)
return@on true
}
}
}

View file

@ -1,6 +1,7 @@
package content.region.misthalin.draynor.dialogue;
import core.game.dialogue.DialoguePlugin;
import core.game.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;
@ -26,6 +27,13 @@ public final class WiseOldManDialogue extends DialoguePlugin {
*/
private static final Item COINS = new Item(995, 99000);
/**
* Represents the unique books item.
*/
private static final Item[] UNIQUE_BOOKS = new Item[]{ new Item(5507), new Item(5508), new Item(7464)};
/**
* Constructs a new {@code WiseOldManDialogue} {@code Object}.
*/
@ -166,16 +174,26 @@ public final class WiseOldManDialogue extends DialoguePlugin {
}
break;
case 100:
npc("You seem to have no junk in your bank, sorry.");
stage = 101;
if (player.getBank().containsAtLeastOneItem(UNIQUE_BOOKS) && player.getBank().remove(UNIQUE_BOOKS)){
npc(FacialExpression.DISGUSTED, "That's my book! What's it doing in your bank?");
stage = 101;
} else {
npc("You seem to have no junk in your bank, sorry.");
stage = 101;
}
break;
case 101:
player.getAchievementDiaryManager().finishTask(player, DiaryType.LUMBRIDGE, 1, 16);
end();
break;
case 102:
npc("You seem to have no junk in your inventory, sorry.");
stage = 101;
if (player.getInventory().containsAtLeastOneItem(UNIQUE_BOOKS) && player.getInventory().remove(UNIQUE_BOOKS)){
npc(FacialExpression.DISGUSTED, "That's my book! What's it doing in your inventory?");
stage = 101;
} else {
npc("You seem to have no junk in your inventory, sorry.");
stage = 101;
}
break;
case 30:
npc("Jolly good. Give it to me, and I'll tell you anything I know", "about it.");

View file

@ -0,0 +1,71 @@
package content.region.misthalin.draynor.handlers
import core.api.addItem
import core.api.inInventory
import core.api.sendMessage
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import org.rs09.consts.Items
import org.rs09.consts.Scenery
class WiseOldManHouseListener : InteractionListener {
// Searching the bookshelves in the Wise Old Man's house
override fun defineListeners() {
// All shelves in the room
val bookshelves = intArrayOf(
Scenery.OLD_BOOKSHELF_7058, Scenery.OLD_BOOKSHELF_7071,
Scenery.OLD_BOOKSHELF_7072, Scenery.OLD_BOOKSHELF_7073,
Scenery.OLD_BOOKSHELF_7074, Scenery.OLD_BOOKSHELF_7076,
Scenery.OLD_BOOKSHELF_7077, Scenery.OLD_BOOKSHELF_7078,
Scenery.OLD_BOOKSHELF_7079, Scenery.OLD_BOOKSHELF_7081,
Scenery.OLD_BOOKSHELF_7082, Scenery.OLD_BOOKSHELF_7089,
Scenery.OLD_BOOKSHELF_9146, Scenery.OLD_BOOKSHELF_9147,
)
// Shelves contains unique books
val containBookshelf = intArrayOf(
Scenery.OLD_BOOKSHELF_7065, // STRANGE BOOK
Scenery.OLD_BOOKSHELF_7066, // FOLKLORE BOOK
Scenery.OLD_BOOKSHELF_7068, // CHICKEN BOOK
)
val strangeBook = Items.STRANGE_BOOK_5507
val folkloreBook = Items.BOOK_OF_FOLKLORE_5508
val chickenBook = Items.BOOK_ON_CHICKENS_7464
on(Scenery.OLD_BOOKSHELF_7065, IntType.SCENERY, "search") { player, _ ->
if (!inInventory(player, strangeBook)) {
sendMessage(player, "You search the bookcase and find a book named 'Strange Book'.")
addItem(player, strangeBook)
} else {
sendMessage(player, "You search the bookcase and find nothing of interest.")
}
return@on true
}
on(Scenery.OLD_BOOKSHELF_7066, IntType.SCENERY, "search") { player, _ ->
if (!inInventory(player, folkloreBook)) {
sendMessage(player, "You search the bookcase and find a book named 'Book of folklore'.")
addItem(player, folkloreBook)
} else {
sendMessage(player, "You search the bookcase and find nothing of interest.")
}
return@on true
}
on(Scenery.OLD_BOOKSHELF_7068, IntType.SCENERY, "search") { player, _ ->
if (!inInventory(player, chickenBook)) {
sendMessage(player, "You search the bookcase and find a book named 'Book on chickens'.")
addItem(player, chickenBook)
} else {
sendMessage(player, "You search the bookcase and find nothing of interest.")
}
return@on true
}
}
}