Implemented a generic book interface

Converted all books to new book interface
Converted stats command to use the new book interface
This commit is contained in:
Oven Bread
2023-04-24 14:32:52 +00:00
committed by Ryan
parent 4b20cdd001
commit 323c653275
35 changed files with 2177 additions and 2385 deletions
@@ -1,5 +1,6 @@
package content.global.dialogue;
import content.global.handlers.item.book.GeneralRuleBook;
import core.game.dialogue.DialoguePlugin;
import core.game.node.entity.npc.NPC;
import core.game.node.entity.player.Player;
@@ -122,7 +123,7 @@ public final class TownCrierDialogue extends DialoguePlugin {
GameWorld.getPulser().submit(new Pulse(4) {
@Override
public boolean pulse() {
//player.getDialogueInterpreter().open(496107759); // TODO rulebook broken
GeneralRuleBook.Companion.openBook(player);
return true;
}
});
@@ -0,0 +1,181 @@
package content.global.handlers.iface
import core.api.closeInterface
import core.api.getAttribute
import core.api.openInterface
import core.api.setAttribute
import core.game.interaction.InterfaceListener
import core.game.node.entity.player.Player
/**
* Interface listener for Books
* Use this to listen and interact with buttons on book interfaces.
*
* This will handle component(26), component(27) and component(49) globally.
* DO NOT extend this class or override on(26), on(27), on(49) for defineInterfaceListeners.
*
* Instead, simply call BookInterface.pageSetup(...) and pass two attributes.
* bookInterfaceCallback - function to callback (player: Player, pageNum: Int, buttonID: Int) : Boolean
* bookInterfaceCurrentPage - 0 for first page.
*
* @author ovenbreado
*/
class BookInterface : InterfaceListener {
companion object {
/* These should be in org.rs09.consts.Components but currently are not. */
const val FANCY_BOOK_26 = 26 // This is a 15-Lines per page book.
const val FANCY_BOOK_2_27 = 27 // This is a 15-Lines per page book with index and row clickable listeners.
const val FANCY_BOOK_3_49 = 49 // This is an 11-Lines per page book.
/* Book Lines. [Title, Left button text, Right button text, ...lines 1 to X] */
val FANCY_BOOK_26_LINE_IDS = arrayOf(101, 65, 66, 97, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96)
val FANCY_BOOK_2_27_LINE_IDS = arrayOf(163, 5, 6, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67)
val FANCY_BOOK_3_49_LINE_IDS = arrayOf(6, 77, 78, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76)
/* Button IDs. [Left button, Right button, (opt)index button, ...(opt)click lines 1 to X] */
val FANCY_BOOK_26_BUTTON_IDS = arrayOf(61, 63);
val FANCY_BOOK_2_27_BUTTON_IDS = arrayOf(1, 3, 159, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158)
val FANCY_BOOK_3_49_BUTTON_IDS = arrayOf(51, 53);
/** Sets up standard pagination and page numbering. Call this for default setup of book components. */
fun pageSetup(player: Player, bookComponent: Int, title: String, contents: Array<PageSet>) {
val currentPage = getAttribute(player, "bookInterfaceCurrentPage", 0)
closeInterface(player) // Important: Close previous book interfaces.
if (bookComponent == FANCY_BOOK_26) {
openInterface(player, FANCY_BOOK_26) // Important: Opens the current interface.
clearBookLines(player, FANCY_BOOK_26, FANCY_BOOK_26_LINE_IDS);
clearButtons(player, FANCY_BOOK_26, FANCY_BOOK_26_BUTTON_IDS);
setTitle(player, FANCY_BOOK_26, FANCY_BOOK_26_LINE_IDS, title);
setPagination(player, FANCY_BOOK_26, FANCY_BOOK_26_LINE_IDS, FANCY_BOOK_26_BUTTON_IDS, currentPage, contents.size, contents[currentPage].pages.size == 1)
setPageContent(player, FANCY_BOOK_26, FANCY_BOOK_26_LINE_IDS, FANCY_BOOK_26_BUTTON_IDS, currentPage, contents);
} else if (bookComponent == FANCY_BOOK_2_27) {
openInterface(player, FANCY_BOOK_2_27) // Important: Opens the current interface.
clearBookLines(player, FANCY_BOOK_2_27, FANCY_BOOK_2_27_LINE_IDS);
clearButtons(player, FANCY_BOOK_2_27, FANCY_BOOK_2_27_BUTTON_IDS);
setTitle(player, FANCY_BOOK_2_27, FANCY_BOOK_2_27_LINE_IDS, title);
setPagination(player, FANCY_BOOK_2_27, FANCY_BOOK_2_27_LINE_IDS, FANCY_BOOK_2_27_BUTTON_IDS, currentPage, contents.size, contents[currentPage].pages.size == 1)
setPageContent(player, FANCY_BOOK_2_27, FANCY_BOOK_2_27_LINE_IDS, FANCY_BOOK_2_27_BUTTON_IDS, currentPage, contents);
} else if (bookComponent == FANCY_BOOK_3_49) {
openInterface(player, FANCY_BOOK_3_49) // Important: Opens the current interface.
clearBookLines(player, FANCY_BOOK_3_49, FANCY_BOOK_3_49_LINE_IDS);
clearButtons(player, FANCY_BOOK_3_49, FANCY_BOOK_3_49_BUTTON_IDS);
setTitle(player, FANCY_BOOK_3_49, FANCY_BOOK_3_49_LINE_IDS, title);
setPagination(player, FANCY_BOOK_3_49, FANCY_BOOK_3_49_LINE_IDS, FANCY_BOOK_3_49_BUTTON_IDS, currentPage, contents.size, contents[currentPage].pages.size == 1)
setPageContent(player, FANCY_BOOK_3_49, FANCY_BOOK_3_49_LINE_IDS, FANCY_BOOK_3_49_BUTTON_IDS, currentPage, contents);
}
}
/** Clear all lines rather than leaving "Line X" on all visible rows. */
fun clearBookLines(player: Player, componentId: Int, bookLineIds: Array<Int>) {
openInterface(player, componentId) // Important: Opens the current interface.
for (i in bookLineIds) {
player.packetDispatch.sendString("", componentId, i)
}
}
/** Clear all buttons rather than leaving invisible button rows. */
fun clearButtons(player: Player, componentId: Int, bookButtonIds: Array<Int>) {
for (i in bookButtonIds) {
player.packetDispatch.sendInterfaceConfig(componentId, i, true)
}
}
/** Set title of book. */
fun setTitle(player: Player, componentId: Int, bookLineIds: Array<Int>, title: String) {
player.packetDispatch.sendString(title, componentId, bookLineIds[0])
}
/** Set pagination numbers of current page in book. CurrentPage is 0 index. */
fun setPagination(player: Player, componentId: Int, bookLineIds: Array<Int>, bookButtonIds: Array<Int>, currentPage: Int, totalPages: Int, hasRightPage: Boolean) {
player.packetDispatch.sendInterfaceConfig(componentId, bookButtonIds[0], currentPage <= 0)
player.packetDispatch.sendInterfaceConfig(componentId, bookButtonIds[1], currentPage >= totalPages - 1)
player.packetDispatch.sendString("" + (currentPage * 2 + 1), componentId, bookLineIds[1])
player.packetDispatch.sendString("" + (currentPage * 2 + 2), componentId, bookLineIds[2])
if (hasRightPage) {
// If there's no right side page, remove the page number. Usually for odd page books.
player.packetDispatch.sendString("", componentId, BookInterface.FANCY_BOOK_26_LINE_IDS[2])
}
}
/** Set text contents of book. CurrentPage is 0 index. */
fun setPageContent(player: Player, componentId: Int, bookLineIds: Array<Int>, bookButtonIds: Array<Int>, currentPage: Int, contents: Array<PageSet>) {
for (page in contents[currentPage].pages) {
for (line in page.lines) {
// This is to prevent error child lines being set and crashing the client.
if (bookLineIds.contains(line.child)) {
player.packetDispatch.sendString(line.message, componentId, line.child)
}
if (bookButtonIds.contains(line.child)) {
player.packetDispatch.sendInterfaceConfig(componentId, line.child, false)
player.packetDispatch.sendString(line.message, componentId, line.child)
}
}
}
}
/** Check book is read. Trigger off */
fun isLastPage(pageNum: Int, totalPages: Int): Boolean {
return pageNum == totalPages - 1;
}
/** PRIVATE: Increments the current page and invokes the callback function. */
private fun changePageAndCallback(player: Player, increment: Int, buttonId: Int) {
val callback :((player: Player, pageNum: Int, buttonId: Int) -> Boolean)? = getAttribute(player, "bookInterfaceCallback", null)
val currentPage = getAttribute(player, "bookInterfaceCurrentPage", 0)
setAttribute(player, "bookInterfaceCurrentPage", currentPage + increment)
callback?.invoke(player, currentPage + increment, buttonId)
}
}
override fun defineInterfaceListeners() {
on(FANCY_BOOK_26) { player, _, _, buttonID, _, _ ->
when (buttonID) {
FANCY_BOOK_26_BUTTON_IDS[0] -> { changePageAndCallback(player, -1, buttonID) }
FANCY_BOOK_26_BUTTON_IDS[1] -> { changePageAndCallback(player, 1, buttonID) }
else -> (changePageAndCallback(player, 0, buttonID))
}
return@on true
}
on(FANCY_BOOK_2_27) { player, _, _, buttonID, _, _ ->
when (buttonID) {
FANCY_BOOK_2_27_BUTTON_IDS[0] -> { changePageAndCallback(player, -1, buttonID) }
FANCY_BOOK_2_27_BUTTON_IDS[1] -> { changePageAndCallback(player, 1, buttonID) }
else -> (changePageAndCallback(player, 0, buttonID))
}
return@on true
}
on(FANCY_BOOK_3_49) { player, _, _, buttonID, _, _ ->
when (buttonID) {
FANCY_BOOK_3_49_BUTTON_IDS[0] -> { changePageAndCallback(player, -1, buttonID) }
FANCY_BOOK_3_49_BUTTON_IDS[1] -> { changePageAndCallback(player, 1, buttonID) }
else -> (changePageAndCallback(player, 0, buttonID))
}
return@on true
}
}
}
/** Constructs a new PageSet object. */
class PageSet(vararg pages: Page) {
val pages: Array<Page>
init {
this.pages = pages as Array<Page>
}
}
/** Constructs a new Page object. */
class Page(vararg lines: BookLine) {
val lines: Array<BookLine>
init {
this.lines = lines as Array<BookLine>
}
}
/** Constructs a new Page object. */
class BookLine (
val message: String,
val child: Int
)
@@ -1,78 +0,0 @@
package content.global.handlers.item;
import core.cache.def.impl.ItemDefinition;
import core.game.interaction.OptionHandler;
import core.game.node.Node;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
import core.plugin.Initializable;
import core.plugin.Plugin;
import org.rs09.consts.Items;
/**
* Represents the plugin used to handle the "read" option of a book.
*
* @author 'Vexia
* @version 1.0
*/
@Initializable
public class BookreadOption extends OptionHandler {
@Override
public Plugin<Object> newInstance(Object arg) throws Throwable {
ItemDefinition.forId(292).getHandlers().put("option:read", this);
ItemDefinition.forId(757).getHandlers().put("option:read", this);
ItemDefinition.forId(1856).getHandlers().put("option:read", this);
ItemDefinition.forId(Items.BATTERED_BOOK_2886).getHandlers().put("option:read", this);
ItemDefinition.forId(Items.SLASHED_BOOK_9715).getHandlers().put("option:read", this);
ItemDefinition.forId(Items.VARMENS_NOTES_4616).getHandlers().put("option:read", this);
ItemDefinition.forId(9003).getHandlers().put("option:read", this);
ItemDefinition.forId(9004).getHandlers().put("option:read", this);
ItemDefinition.forId(11710).getHandlers().put("option:read", this);
return this;
}
@Override
public boolean handle(Player player, Node node, String option) {
final int id = getDialId(((Item) node).getId());
player.getInterfaceManager().close();
return player.getDialogueInterpreter().open(id, node);
}
@Override
public boolean isWalk() {
return false;
}
/**
* Gets the dialogue id from the item id.
*
* @param item the item.
* @return the dial id.
*/
public int getDialId(int item) {
switch (item) {
case 757:
return 49610758;
case 9003:
return 49610759;
case Items.BATTERED_BOOK_2886:
return 49610760;
case Items.SLASHED_BOOK_9715:
return 49610761;
case Items.GLOUGHS_JOURNAL_785:
return 49610762;
case Items.TRANSLATION_BOOK_784:
return 49610763;
/*case 9004:
return 423943;*/
case 11710:
return 2739823;
case 292:
return 183764;
case 1856:
return 387454;
}
return item;
}
}
@@ -0,0 +1,212 @@
package content.global.handlers.item.book
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.getAttribute
import core.api.setAttribute
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import core.game.node.entity.player.Player
import core.game.world.GameWorld
import org.rs09.consts.Items
/**
* General Rule Book
* This is not an item book, but opened when asking a Town Crier for the Rules
* @author ovenbreado
* @author 'Vexia
*/
class GeneralRuleBook {
companion object {
private const val BLUE = "<col=08088A>"
private val SERVER_NAME = GameWorld.settings!!.name
private val TITLE = "$SERVER_NAME Rules"
private val CONTENTS = arrayOf(
PageSet(
Page(
BookLine("Rules", 38),
BookLine("1 - Offensive Language", 104),
BookLine("2 - Item Scamming", 106),
BookLine("3 - Password Scamming", 108),
BookLine("4 - Cheating/Bug Abuse", 110),
BookLine("5 - Staff Impersonation", 112),
BookLine("6 - Account Sharing/Trading", 114),
BookLine("7 - Using Third Party", 116),
BookLine("Software", 118),
BookLine("8 - Multi Logging-in", 120),
BookLine("9 - Encouraging Others to", 122),
BookLine("Break Rules", 124),
BookLine("10 - False Representation", 126),
BookLine("11 - Website Advertising", 128)
),
Page(
BookLine("12 - Read World Item", 134),
BookLine("Trading", 136),
BookLine("13 - Asking For Personal", 138),
BookLine("Details", 140),
BookLine("14 - Misuse of Official", 142),
BookLine("Forums", 144),
BookLine("15 - Advert Blocking", 146)
)
),
PageSet(
Page(
BookLine(BLUE + "1 - Offensive Language", 38),
BookLine("You must not use any", 40),
BookLine("language which is offensive,", 41),
BookLine("racist or obscene. Remember,", 42),
BookLine("it's nice to be nice!", 43)
), Page(
BookLine(BLUE + "2 - Item Scamming", 53 ),
BookLine("You must not scam or", 55),
BookLine("deceive other players. This", 56),
BookLine("includes claiming that items", 57),
BookLine("are rare when they are not,", 58),
BookLine("team scamming or telling", 59),
BookLine("players that you can", 60),
BookLine("upgrade' their armour in", 61),
BookLine("any way!", 62)
)
),
PageSet(
Page(
BookLine(BLUE + "3 - Password Scamming", 38),
BookLine("Asking for - or trying to", 40),
BookLine("obtain - another player's", 41),
BookLine("password in any way will not", 42),
BookLine("be tolerated, even in jest!", 43)
), Page(
BookLine(BLUE + "4 - Cheating/Bug Abuse", 53),
BookLine("A bug is a technical glitch", 55),
BookLine("found in the game. You", 56),
BookLine("must not use or attempt to", 57),
BookLine("use any cheats or errors that", 58),
BookLine("you find in our software.", 59),
BookLine("Any bugs found must be", 60),
BookLine("reported to " + SERVER_NAME, 61),
BookLine("immediately, by clicking the", 62),
BookLine("'Report a bug/fault' link", 63),
BookLine("found on the main page.", 64)
)
),
PageSet(
Page(
BookLine(BLUE + "5 - Staff Impersonation", 38),
BookLine("You should not attempt to", 40),
BookLine("impersonate " + SERVER_NAME + " staff in", 41),
BookLine("any way.", 42)
), Page(
BookLine(BLUE + "6 - Account Sharing/Trading", 53),
BookLine("Each account should only be", 55),
BookLine("used by ONE person and", 56),
BookLine("ONE person alone.", 57),
BookLine("Remember that trying to", 58),
BookLine("buy, sell, borrow or give", 59),
BookLine("away an account is against", 60),
BookLine("the rules and will land you in", 61),
BookLine("trouble when caught!", 62)
)
),
PageSet(
Page(
BookLine(
BLUE + "7 - Using Third Party <br>" + BLUE + "Software<br><br>You must not use other<br>programs to gain an unfair<br>advantage in the game.",
38
)
), Page(
BookLine(
BLUE + "8 - Multi Logging-in</col><br><br>If you create more than one<br>" + SERVER_NAME + " account, they<br>must not interact. This<br>includes giving items to a<br>friend to transfer to another<br>account you own.",
53
)
)
),
PageSet(
Page(
BookLine(
BLUE + "9 - Encouraging Others to<br>" + BLUE + "Break Rules</col><br><br>You must not encourage<br>others to break any of the<br>" + SERVER_NAME + " rules.",
38
), BookLine(
BLUE + "10 - False Representation</col><br><br>You must not misuse<br>" + SERVER_NAME + " Customer<br>Support.Trying to get<br>another player into trouble<br>by reporting them for no<br>reason or framing them is an<br>abuse of the Customer<br>Support Team's service.<br> want to help as many<br>players as possible and so the<br>Customer Support Team's<br>service must be used<br>appropriately and treated with",
53
)
)
),
PageSet(
Page(
BookLine("respect at all times.", 38),
BookLine(
BLUE + "11 - Website Advertising</col><br><br>You are not allowed to<br>actively advertise any<br>websites, fan-sites, IRC<br>channels or product<br>anywhere in " + SERVER_NAME + ",<br>including the " + SERVER_NAME + "<br>forums.",
53
)
), Page()
),
PageSet(
Page(
BookLine(
BLUE + "12 - Real World Item<br>" + BLUE + "Trading<br><br></col>" + SERVER_NAME + " items must only<br>be exchanged for other items<br>or service within the game.<br>Buying or selling items<br>outside of the " + SERVER_NAME + "<br>environment is not in the<br>spirit of the game and is easy<br>for " + SERVER_NAME + " to trace!",
38
), BookLine(
BLUE + "13 - Asking for Personal<br>" + BLUE + "Details<br><br></col>To protect player's safety<br>and privacy, you must not<br>ask for personal details. This<br>includes full names, phone<br>numbers, MSN, AIM, email<br>and home/school addresses!",
53
)
)
),
PageSet(
Page(
BookLine(
BLUE + "14 - Misuse of Official<br>" + BLUE + "Forums</col><br><br>Forums must be used in<br>accordance with the Forum<br>Code of Conduct and treated<br>with respect at all times.",
38
), BookLine(
BLUE + "15 - Advert Blocking<br><br>Blocking the adverts in the<br>free to play version of<br>" + SERVER_NAME + " is against the<br>rules.",
53
)
)
)
)
private fun display(player: Player, pageNum: Int, buttonID: Int) : Boolean {
if (pageNum == 0) {
when (buttonID) {
104 -> setAttribute(player, "bookInterfaceCurrentPage", 1)
106 -> setAttribute(player, "bookInterfaceCurrentPage", 1)
108 -> setAttribute(player, "bookInterfaceCurrentPage", 2)
110 -> setAttribute(player, "bookInterfaceCurrentPage", 2)
112 -> setAttribute(player, "bookInterfaceCurrentPage", 3)
114 -> setAttribute(player, "bookInterfaceCurrentPage", 3)
116 -> setAttribute(player, "bookInterfaceCurrentPage", 4)
118 -> setAttribute(player, "bookInterfaceCurrentPage", 4)
120 -> setAttribute(player, "bookInterfaceCurrentPage", 4)
122 -> setAttribute(player, "bookInterfaceCurrentPage", 5)
124 -> setAttribute(player, "bookInterfaceCurrentPage", 5)
126 -> setAttribute(player, "bookInterfaceCurrentPage", 5)
128 -> setAttribute(player, "bookInterfaceCurrentPage", 6)
134 -> setAttribute(player, "bookInterfaceCurrentPage", 7)
136 -> setAttribute(player, "bookInterfaceCurrentPage", 7)
138 -> setAttribute(player, "bookInterfaceCurrentPage", 7)
140 -> setAttribute(player, "bookInterfaceCurrentPage", 7)
142 -> setAttribute(player, "bookInterfaceCurrentPage", 8)
144 -> setAttribute(player, "bookInterfaceCurrentPage", 8)
146 -> setAttribute(player, "bookInterfaceCurrentPage", 8)
}
} else {
when (buttonID) {
159 -> setAttribute(player, "bookInterfaceCurrentPage", 0)
}
}
BookInterface.pageSetup(player, BookInterface.FANCY_BOOK_2_27, TITLE, CONTENTS)
if (getAttribute(player,"bookInterfaceCurrentPage", 0) != 0) {
player.packetDispatch.sendInterfaceConfig(BookInterface.FANCY_BOOK_2_27, 159, false)
player.packetDispatch.sendString("Index", BookInterface.FANCY_BOOK_2_27, 159)
}
return true
}
/** Since the Town Crier shows you the book, there is no item here. */
fun openBook(player: Player) {
setAttribute(player, "bookInterfaceCallback", ::display)
setAttribute(player, "bookInterfaceCurrentPage", 0)
display(player, 0, 0)
}
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,141 @@
package content.global.handlers.item.book
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.*
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import core.game.node.entity.player.Player
import org.rs09.consts.Items
/**
* Grim Diary Book
* https://www.youtube.com/watch?v=Vhmm_Gg0584
* @author ovenbreado
* @author Vexia
*/
class GrimDiary : InteractionListener {
companion object {
private const val RED = "<col=8A0808>"
private const val LEFT_PAGE_CHILD = 97
private const val RIGHT_PAGE_CHILD = 82
private const val TITLE = "Diary of Death"
private val CONTENTS = arrayOf(
PageSet(
Page(
BookLine(
"My Diary<br><br> by Grim<br><br>" + RED + "'''''''''''''''''''''''''''''''<br>" + RED + "''''12th Bennath<br>" + RED + "'''''''''''''''''''''''''''''''<br>I had such a busy day<br>dealing out death today<br>It's not as easy being grim.<br>Realised that Alfonse is<br>such a good servant. He<br><br><br><br><br><br>",
LEFT_PAGE_CHILD
)
),
Page(
BookLine(
"seems to have the house<br>in full working order. I<br>shall have to congratulate<br>him tomorrow. Spent<br>some well-deserved time<br>sharpening my scythe -<br>Alfonse kindly reminded<br>me to put the <col=FF0000>sharpener<br></col>back in the <col=FF0000>cabinet</col>. Such<br>a good chap.",
RIGHT_PAGE_CHILD
)
)
),
PageSet(
Page(
BookLine(
"<br><br>" + RED + "'''''''''''''''''''''''''''''''<br>" + RED + "'''13th Bennath<br>" + RED + "'''''''''''''''''''''''''''''''<br></col>Went to the Wilderness<br>today. Plenty of foolish<br>people surrendering their<br>lives to me without<br>thought. My back is<br>killing me from all the<br>standing around waiting.",
LEFT_PAGE_CHILD
)
),
Page(
BookLine(
"Must get that seen to.<br>Got my <col=FF0000>robes</col> stained<br>from one victim. Simply<br>ruined! I decided to<br>throw them in the<br><col=FF0000>fireplace</col> - will light the<br>fire soon. Oh, and I must<br>remember to call mother.",
RIGHT_PAGE_CHILD
)
)
),
PageSet(
Page(
BookLine(
"<br><br>" + RED + "'''''''''''''''''''''''''''''''<br>" + RED + "'''14th Bennath<br>" + RED + "'''''''''''''''''''''''''''''''<br></col>A tragic day. Alfonse and<br>I were in the garden<br>looking at the state of the<br>spider nest. I patted my<br>trusty servant on the<br>back in thanks for all his<br>hard work. Sadly, my<br>touch of death killed him",
LEFT_PAGE_CHILD
)
), Page(BookLine("instantly. Feel quite guilty.", RIGHT_PAGE_CHILD))
),
PageSet(
Page(
BookLine(
"<br><br>" + RED + "'''''''''''''''''''''''''''''''<br>" + RED + "'''20th Bennath<br>" + RED + "'''''''''''''''''''''''''''''''<br></col>House is getting into<br>quite a state without<br>Alfonse - things strewn all<br>over the place. Almost<br>trod on the eye of my<br>mentor, eww. I put the<br><col=FF0000>eye</col> back on the <col=FF0000>shelf</col> so<br>he can watch over me",
LEFT_PAGE_CHILD
)
),
Page(
BookLine(
"and make sure I stay<br>true to his teachings.<br>Went into Varrock to<br>buy some new robes -<br>people kept running away<br>in fear, so it was difficult<br>to find a sale.",
RIGHT_PAGE_CHILD
)
)
),
PageSet(
Page(
BookLine(
"<br><br>" + RED + "'''''''''''''''''''''''''''''''<br>" + RED + "'''21st Bennath<br>" + RED + "'''''''''''''''''''''''''''''''<br></col>Decided to spend a bit of<br>time tidying today - it<br>really isn't an easy job.<br>In my activities I found<br>my old <col=FF0000> 'Voice of Doom'<br></col>potion on the <col=FF0000>bookcase</col> -<br>perfect for giving people a<br>good scare. Oh, I do love",
LEFT_PAGE_CHILD
)
),
Page(
BookLine(
"my job.<br><br><br>" + RED + "'''''''''''''''''''''''''''''''<br>" + RED + "'''22nd Bennath<br>" + RED + "'''''''''''''''''''''''''''''''</col><br>Ordered a new servant<br>today from the agency<br>and got a 10% discount<br>for getting past the<br>1000th servant mark.",
RIGHT_PAGE_CHILD
)
)
),
PageSet(
Page(
BookLine(
"Woo hoo! The agency<br>sent me his <col=FF0000>Last Will and<br>Testement</col>. Shall have to<br><col=FF0000>sit on that</col> for a while.<br><br>" + RED + "'''''''''''''''''''''''''''''''<br>" + RED + "'''23rd Bennath<br>" + RED + "'''''''''''''''''''''''''''''''<br></col>Aquired some bones<br>today. Muncher should<br>appreciate them as a treat",
LEFT_PAGE_CHILD
)
),
Page(
BookLine(
"the next time he behaves.<br>The problem is there<br>aren't many barriers he<br>can't devour, so I decided<br>to lock the <col=FF0000>bones</col> up in<br>the <col=FF0000>chest</col>.<br><br>" + RED + "'''''''''''''''''''''''''''''''" + RED + "<br>" + RED + "''''24th Bennath<br>" + RED + "'''''''''''''''''''''''''''''''<br>My plan to make undead",
RIGHT_PAGE_CHILD
)
)
),
PageSet(
Page(
BookLine(
"fish is going quite well. I<br>managed to obtain a<br>resurrection <col=FF0000>hourglass</col><br>today,so have added that<br>to the <col=FF0000>fishtank </col>to finish<br>off the process. It's so<br>difficult to have pets when<br>everything you touch dies<br>horrifically. I remember<br>having a rabbit once that<br>exploded when I fed it a",
LEFT_PAGE_CHILD
)
),
Page(
BookLine(
"carrot!<br><br>" + RED + "'''''''''''''''''''''''''''''''<br>" + RED + "'''25th Bennath<br>" + RED + "'''''''''''''''''''''''''''''''<br></col>Got back home today to<br>find Muncher has run<br>around the house<br>creating havok - he even<br>ate the postman! I",
RIGHT_PAGE_CHILD
)
)
),
PageSet(
Page(
BookLine(
"scolded him. So hopefully<br>he won't do it again<br>anytime soon. All my<br>things are in such a<br>mess. I'm surely going to<br>have to find someone to<br>tidy things up before my<br>new servant arrives.<br>Don't want to seem<br>totally incapable of looking<br>after myself.",
LEFT_PAGE_CHILD
)
)
)
)
private fun display(player:Player, pageNum: Int, buttonID: Int) : Boolean {
BookInterface.pageSetup(player, BookInterface.FANCY_BOOK_26, TITLE, CONTENTS)
return true
}
}
override fun defineListeners() {
on(Items.THE_GRIM_REAPERS_DIARY_11780, IntType.ITEM, "read") { player, _ ->
setAttribute(player, "bookInterfaceCallback", ::display)
setAttribute(player, "bookInterfaceCurrentPage", 0)
display(player, 0, 0)
return@on true
}
}
}
File diff suppressed because one or more lines are too long
@@ -1,139 +0,0 @@
package content.global.handlers.item.book;
import core.game.component.Component;
import core.game.dialogue.DialoguePlugin;
import core.game.dialogue.book.Book;
import core.game.dialogue.book.BookLine;
import core.game.dialogue.book.Page;
import core.game.dialogue.book.PageSet;
import core.game.node.entity.player.Player;
import core.plugin.Initializable;
import core.game.world.GameWorld;
/**
* Represents the strong hold of security book.
* @author 'Vexia
* @version 1.0
*/
@Initializable
public final class SecurityBookPlugin extends Book {
/**
* Represents the strong hold of security book.
*/
public static int ID = 49610759;
/**
* Represents the component interface.
*/
private static final Component INTERFACE = new Component(26);
/**
* Represents the array of pages for this book.
*/
private static final PageSet[] PAGES = new PageSet[] { new PageSet(new Page(new BookLine("Chapters", 102), new BookLine("<h1>" + BLUE + "Password Tips</col></h1>", 74), new BookLine("<h1>" + BLUE + "Recovery Questions</col></h1>", 75), new BookLine("<h1>" + BLUE + "Password Tips</col></h1>", 74), new BookLine("<h1>" + BLUE + "Recovery Questions</col></h1>", 75), new BookLine("<h1>" + BLUE + "Other Security Tips</col></h1>", 76), new BookLine("<h1>" + BLUE + "Stringhold of Security</col></h1>", 77)), new Page(new BookLine("<h1>" + BLUE + "Password Tips</col></h1>", 87), new BookLine("A good password should be", 88), new BookLine("easily remembered by", 89), new BookLine("yourself but not easily", 90), new BookLine("guessed by anyone else.", 91), new BookLine("Choose a password that has", 93), new BookLine("both letters and numbers in", 94), new BookLine("it for the best security but", 95), new BookLine("don't make it so hard that", 96), new BookLine("you'll forget it!", 97), new BookLine("Never write your password", 99), new BookLine("down or leave it in a text file", 100), new BookLine("on your computer, someone", 101))), new PageSet(new Page(new BookLine("could find it easily!", 102), new BookLine("Never tell anyone your", 74), new BookLine("password in " + GameWorld.getSettings().getName() + ", not", 75), new BookLine("even a Moderator of any", 76), new BookLine("kind.", 77)), new Page(new BookLine("<h1>" + BLUE + "Recovery Questions</col></h1>", 87), new BookLine("Ideally your recovery", 88), new BookLine("questions should be easily", 89), new BookLine("remembered by you but not", 90), new BookLine("guessable by anyone who", 91), new BookLine("may know you or given", 92), new BookLine("away in conversation. Choose", 93), new BookLine("things that do not change,", 94), new BookLine("like dates or names but don't", 95), new BookLine("choose obvious ones like your", 96), new BookLine("birthday and your sister or", 97), new BookLine("bother's name because lots", 98), new BookLine("of people will know that.", 99))), new PageSet(new Page(new BookLine("<h1>" + BLUE + "Recovery Questions</col></h1>", 102), new BookLine("Bear in mind that recovery", 73), new BookLine("questions will take 14 days to", 74), new BookLine("become active after you have", 75), new BookLine("applied for them to be", 76), new BookLine("changed. This is to protect", 77), new BookLine("your account from hijackers", 78), new BookLine("who may change them.", 79), new BookLine("Never give your password to", 81), new BookLine("ANYONE. This includes", 82), new BookLine("your friends, family, and", 83), new BookLine("moderators in game.", 84), new BookLine("Never leave your account", 86)), new Page(new BookLine("logged on if you are away", 87), new BookLine("from the computer, it only", 88), new BookLine("takes 5 seconds to steal your", 89), new BookLine("account!", 90))), new PageSet(new Page(new BookLine("<h1>" + BLUE + "Stronghold of Security</col></h1>", 102), new BookLine("Location: The Stronghold of", 73), new BookLine("Security, as we call it, is", 74), new BookLine("located under the village filled", 75), new BookLine("with Barbarians. It was", 76), new BookLine("found after they moved their", 77), new BookLine("mining operations and a", 78), new BookLine("miner fell through. The", 79), new BookLine("Stronghold contains many", 80), new BookLine("challenges. Both for those", 81), new BookLine("who enjoy combat and those", 82), new BookLine("who enjoy challenges of the", 83), new BookLine("mind. This book will be very", 84), new BookLine("useful to you in your travels", 85), new BookLine("there.", 86)), new Page(new BookLine("You can find the Stronghold", 87), new BookLine("of Security by looking for a", 88), new BookLine("hole in Barbarian Village.", 89), new BookLine("Be sure to take your combat", 90), new BookLine("equipment though!", 91))) };
/**
* Constructs a new {@code ShieldofArravBook} {@code Object}.
*/
public SecurityBookPlugin(final Player player) {
super(player, "" + GameWorld.getSettings().getName() + " Account Security", 9003, PAGES);
}
/**
* Constructs a new {@code ShieldofArravBook} {@code Object}.
*/
public SecurityBookPlugin() {
/**
* empty.
*/
}
/**
* Method used to display a set of pages.
* @param set the set.
*/
public void display(Page[] set) {
/*player.lock(2);
player.getInterfaceManager().open(getInterface());
player.getPacketDispatch().sendInterfaceConfig(getInterface().getId(), 65, index < 1 ? true : false);
boolean lastPage = index == 3;
player.getPacketDispatch().sendInterfaceConfig(getInterface().getId(), 67, lastPage ? true : false);
if (lastPage) {
finish();
}
for (int i : getHiddenChilds()) {
player.getPacketDispatch().sendString("", 26, i);
}
player.getPacketDispatch().sendString(getName(), 26, 3);
player.getPacketDispatch().sendString("" + (index == 0 ? (index + 1) : (index + 2)), 26, 68);
player.getPacketDispatch().sendString("" + (index == 0 ? (index + 2) : (index + 3)), 26, 69);
for (Page page : set) {
for (BookLine line : page.getLines()) {
player.getPacketDispatch().sendString(line.getMessage(), getInterface().getId(), line.getChild());
}
}
player.unlock();*/
}
/**
* Gets the interface.
* @return the interface.
*/
public Component getInterface() {
return INTERFACE;
}
@Override
public DialoguePlugin newInstance(Player player) {
return new SecurityBookPlugin(player);
}
/**
* Represents all the array of all configs to hide.
*/
private static final int[] ALL = new int[] { 102, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101 };
/**
* Represents the first page hidden configs.
*/
private static final int[] FIRST = new int[] { 73, 78, 79, 80, 81, 82, 83, 84, 85, 86, 92, 98 };
/**
* Represents the second stage hidden configs.
*/
private static final int[] SECOND = new int[] { 73, 78, 79, 80, 81, 82, 83, 84, 85, 86, 100, 101 };
/**
* Represents the third page hidden configs.
*/
private static final int[] THIRD = new int[] { 85, 80, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101 };
/**
* Represents the fourth page hidden configs.
*/
private static final int[] FOURTH = new int[] { 92, 93, 94, 95, 96, 97, 98, 99, 100, 101 };
/**
* Gets the hidden childs.
* @return the childs.
*/
@SuppressWarnings("unused")
private int[] getHiddenChilds() {
if (index == 0) {
return FIRST;
} else if (index == 1) {
return SECOND;
} else if (index == 3) {
return THIRD;
} else if (index == 4) {
return FOURTH;
}
return ALL;
}
@Override
public int[] getIds() {
return new int[] { ID };
}
}
@@ -0,0 +1,136 @@
package content.global.handlers.item.book
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 core.game.world.GameWorld
import org.rs09.consts.Items
/**
* Security Book
* https://www.youtube.com/watch?v=yXyRUXYafO0
* @author ovenbreado
*/
class SecurityBookPlugin : InteractionListener {
companion object {
private const val BLUE = "<col=08088A>"
private val TITLE = "" + GameWorld.settings!!.name + " Account Security"
private val CONTENTS = arrayOf(
PageSet(
Page(
BookLine("Chapters", 38),
BookLine("<h1>" + BLUE + "Password Tips</col></h1>", 40),
BookLine("<h1>" + BLUE + "Recovery Questions</col></h1>", 41),
BookLine("<h1>" + BLUE + "Other Security Tips</col></h1>", 42),
BookLine("<h1>" + BLUE + "Stringhold of Security</col></h1>", 43)
),
Page(
BookLine("<h1>" + BLUE + "Password Tips</col></h1>", 53),
BookLine("A good password should be", 54),
BookLine("easily remembered by", 55),
BookLine("yourself but not easily", 56),
BookLine("guessed by anyone else.", 57),
BookLine("Choose a password that has", 59),
BookLine("both letters and numbers in", 60),
BookLine("it for the best security but", 61),
BookLine("don't make it so hard that", 62),
BookLine("you'll forget it!", 63),
BookLine("Never write your password", 65),
BookLine("down or leave it in a text file", 66),
BookLine("on your computer, someone", 67)
)
),
PageSet(
Page(
BookLine("could find it easily!", 38),
BookLine("Never tell anyone your", 40),
BookLine("password in " + GameWorld.settings!!.name + ", not", 41),
BookLine("even a Moderator of any", 42),
BookLine("kind.", 43)
),
Page(
BookLine("<h1>" + BLUE + "Recovery Questions</col></h1>", 53),
BookLine("Ideally your recovery", 54),
BookLine("questions should be easily", 55),
BookLine("remembered by you but not", 56),
BookLine("guessable by anyone who", 57),
BookLine("may know you or given", 58),
BookLine("away in conversation. Choose", 59),
BookLine("things that do not change,", 60),
BookLine("like dates or names but don't", 61),
BookLine("choose obvious ones like your", 62),
BookLine("birthday and your sister or", 63),
BookLine("bother's name because lots", 64),
BookLine("of people will know that.", 65)
)
),
PageSet(
Page(
BookLine("<h1>" + BLUE + "Recovery Questions</col></h1>", 38),
BookLine("Bear in mind that recovery", 39),
BookLine("questions will take 14 days to", 40),
BookLine("become active after you have", 41),
BookLine("applied for them to be", 42),
BookLine("changed. This is to protect", 43),
BookLine("your account from hijackers", 44),
BookLine("who may change them.", 45),
BookLine("Never give your password to", 47),
BookLine("ANYONE. This includes", 48),
BookLine("your friends, family, and", 49),
BookLine("moderators in game.", 50),
BookLine("Never leave your account", 52)
),
Page(
BookLine("logged on if you are away", 53),
BookLine("from the computer, it only", 54),
BookLine("takes 5 seconds to steal your", 55),
BookLine("account!", 56)
)
),
PageSet(
Page(
BookLine("<h1>" + BLUE + "Stronghold of Security</col></h1>", 38),
BookLine("Location: The Stronghold of", 39),
BookLine("Security, as we call it, is", 40),
BookLine("located under the village filled", 41),
BookLine("with Barbarians. It was", 42),
BookLine("found after they moved their", 43),
BookLine("mining operations and a", 44),
BookLine("miner fell through. The", 45),
BookLine("Stronghold contains many", 46),
BookLine("challenges. Both for those", 47),
BookLine("who enjoy combat and those", 48),
BookLine("who enjoy challenges of the", 49),
BookLine("mind. This book will be very", 50),
BookLine("useful to you in your travels", 51),
BookLine("there.", 52)
),
Page(
BookLine("You can find the Stronghold", 53),
BookLine("of Security by looking for a", 54),
BookLine("hole in Barbarian Village.", 55),
BookLine("Be sure to take your combat", 56),
BookLine("equipment though!", 57)
)
)
)
private fun display(player: Player, pageNum: Int, buttonID: Int) : Boolean {
BookInterface.pageSetup(player, BookInterface.FANCY_BOOK_2_27, TITLE, CONTENTS)
return true
}
}
override fun defineListeners() {
on(Items.SECURITY_BOOK_9003, IntType.ITEM, "read") { player, _ ->
setAttribute(player, "bookInterfaceCallback", ::display)
setAttribute(player, "bookInterfaceCurrentPage", 0)
display(player, 0, 0)
return@on true
}
}
}
File diff suppressed because one or more lines are too long
@@ -0,0 +1,138 @@
package content.global.handlers.item.book
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
/**
* Stronghold Notes Book
* https://www.youtube.com/watch?v=gX1jCcfY0l8
* @author ovenbreado
*/
class StrongholdNotes : InteractionListener {
companion object {
private const val BLUE = "<col=08088A>"
private const val TITLE = "Stronghold of Security - Notes"
private val CONTENTS = arrayOf(
PageSet(
Page(
BookLine(
"Chapters<br><br>" + BLUE + "Description<br>" + BLUE + "Level 1<br>" + BLUE + "Level 2<br>" + BLUE + "Level 3<br>" + BLUE + "Level 4<br>" + BLUE + "Navigation<br>" + BLUE + "Diary<br><br><br><br><br><br><br><br><br><br>",
38
)
), Page(
BookLine(
BLUE + "Description<br>This stronghold was<br>unearthed by a miner<br>prospecting for new ores<br>around the Barbarian Village.<br>After gathering some<br>equipment he ventured into<br>the maze of tunnels and was<br>missing for a long time. He<br>finally emerged along with<br>copious notes refarding the<br>new beasts and strange<br>experiences which had befallen<br>him. He also mentioned that<br>there was treasure to be had,",
53
)
)
),
PageSet(
Page(
BookLine(
"but no one has been able to<br>wring a word from him about<br>this, he simply flapped his<br>arms and slapped his head.<br>This book details his notes<br>and my diary of exploration.<br>I am exploring to see if I<br>can find out more...",
38
)
), Page(
BookLine(
BLUE + "Level 1<br>As well as goblins, creatures<br>like a man but also like a cow<br>infest this place! I have never<br>seen anything like this before.<br>The area itself is reminiscent<br>of frontline castles, with<br>many walls, doors and<br>skeletons of dead enemies.<br>I'm sure I hear voices in my<br>head each time I pass<br>through the gates. I have<br>dubbed this level War as it<br>seems like an eternal<br>battleground. I found only",
53
)
)
),
PageSet(
Page(BookLine("one small peaceful area here.", 38)),
Page(
BookLine(
BLUE + "Level 2<br>My supplies are running low<br>and I find myself in barren<br>passages with seemingly<br>endless malnourished beasts<br>attacking me, revenous for<br>food. Nothing appears to be<br>able to grow, many<br>adventurers have died<br>through lack of food and the<br>very air appears to suck<br>vitality from me. I've come to<br>call this place famine.",
53
)
)
),
PageSet(
Page(
BookLine(
BLUE + "Level 3<br>Just breathing in this place<br>makes me shudder at the<br>thought of what foul disease I<br>may contract. The walls and<br>floor ooze and pulsate like<br>something pox ridden. There<br>is a very strange beast whom<br>I narrowly escaped from. At<br>first I thought it to be a<br>cross between a cow and a<br>sheep, something<br>domesticated... but when it<br>looked up at me I was<br>overcome with weakness and",
38
)
),
Page(
BookLine(
"barely got way with my life!<br>Luckily I found a small place<br>where I could heal myself<br>and rest a while. I have<br>named this area pestilence for<br>it reeks with decay.",
53
)
)
),
PageSet(
Page(
BookLine(
BLUE + "Level 4<br>On my first escapade into<br>this place I was utterly<br>shocked. The adventurers<br>who had come before me<br>must have made up a tiny<br>proportion of the skeletons of<br>the dead. Nothing truely<br>alive exists here, even those<br>beings who do wander the<br>halls are not alive as such,<br>but they do know that I am<br>and I get the distinct<br>impression that were they to<br>have their way, I would not",
38
)
),
Page(
BookLine(
"be for long! Death is<br>everywhere and thus I shall<br>name this place. There is one<br>small place of life, which was<br>gladdening to find and very<br>worth my while!",
53
)
)
),
PageSet(
Page(
BookLine(
BLUE + "Navigation<br>After getting lost several<br>times I finally worked out the<br>key to all the ladders and<br>chains around this death<br>infested place. All ropes and<br>chains will take you to the<br>start of the level that you are<br>on. However most ladders will<br>simply take you to the level<br>above. The one esception is<br>the ladder in the bottom level<br>treasure room, which appears<br>to lead through several<br>extremely twisty passages.",
38
)
),
Page(
BookLine(
"and eventually takes you out<br>of the dungeon completely.<br>The portals may be used if<br>you are of sufficient level or<br>have already claimed your<br>reward from the treasure<br>room.",
38
)
)
),
PageSet(
Page(
BookLine(
BLUE + "Diary<br>Day 1<br>Today I set out to find out<br>more about this place. From<br>my research I knew about<br>the sentient doors, imbued by<br>some unkown force to talk<br>to you and ask questions<br>before they will let you pass.<br>I have so far passed these<br>doors without incident, giving<br>the correct answer seems to<br>work a treat.<br><br>Day 2",
38
)
),
Page(
BookLine(
"I have fought my way<br>through the fearsome beasts<br>on the first level and am<br>preparing myself to journey<br>deeper. I hope that things are<br>not too difficult further on as<br>I am already sick of bread<br>and cheese for dinner.<br><br>Day 3<br>I ventured down into the<br>famine level today... I was<br>wounded and have returned<br>to the relative safety of the<br>level above. I am going to",
53
)
)
),
PageSet(
Page(
BookLine(
"try to make my way out<br>through the goblins and<br>mancow things... I hope I<br>make it.....",
38
)
)
)
)
private fun display(player: Player, pageNum: Int, buttonID: Int) : Boolean {
BookInterface.pageSetup(player, BookInterface.FANCY_BOOK_2_27, TITLE, CONTENTS)
return true
}
}
override fun defineListeners() {
on(Items.STRONGHOLD_NOTES_9004, IntType.ITEM, "read") { player, _ ->
setAttribute(player, "bookInterfaceCallback", ::display)
setAttribute(player, "bookInterfaceCurrentPage", 0)
display(player, 0, 0)
return@on true
}
}
}
@@ -1,104 +0,0 @@
package content.global.skill.construction;
import core.game.dialogue.DialogueInterpreter;
import core.game.dialogue.DialoguePlugin;
import core.game.dialogue.book.Book;
import core.game.dialogue.book.Page;
import core.game.node.entity.player.Player;
import core.game.node.item.Item;
import core.game.world.GameWorld;
import core.plugin.Initializable;
/**
* Handles the construction guide book.
* @author Emperor
*
*/
@Initializable
public class ConstructionGuideBook extends Book {
/**
* The resources used in beta.
*/
private static final Item[] RESOURCES = {
new Item(8794),
new Item(2347),
new Item(4819, 500000),
new Item(4820, 500000),
new Item(1539, 500000),
new Item(4821, 500000),
new Item(4822, 500000),
new Item(4823, 500000),
new Item(4824, 500000),
new Item(961, 500000),
new Item(8779, 500000),
new Item(8781, 500000),
new Item(8783, 500000),
new Item(8791, 500000),
new Item(8785, 500000),
new Item(8787, 500000),
new Item(8789, 500000), //16
new Item(8418, 500000),
new Item(8420, 500000),
new Item(8422, 500000),
new Item(8424, 500000),
new Item(8426, 500000),
new Item(8428, 500000),
new Item(8430, 500000),
new Item(8432, 500000),
new Item(8434, 500000),
new Item(8436, 500000),
};
/**
* Constructs a new {@code ConstructionGuideBook} {@code Object}.
*/
public ConstructionGuideBook() {
/*
* empty.
*/
}
/**
* Constructs a new {@code ConstructionGuideBook} {@code Object}.
* @param player
*/
public ConstructionGuideBook(Player player) {
super(player, "Construction guide book", DialogueInterpreter.getDialogueKey("book:conguide"));
}
@Override
public boolean open(final Player player) {
if (GameWorld.getSettings().isDevMode() && GameWorld.getSettings().isBeta()) {
for (Item item : RESOURCES) {
if (!player.getInventory().contains(item.getId(), item.getAmount())) {
player.getInventory().add(item, player);
}
}
}
interpreter.sendPlainMessage(false, "Upon reading the book you discover you're supposed to", "use these resources to test out construction.", "Report all bugs on the forums.");
return true;
}
@Override
public void finish() {
}
@Override
public void display(Page[] set) {
}
@Override
public DialoguePlugin newInstance(Player player) {
return new ConstructionGuideBook(player);
}
@Override
public int[] getIds() {
return new int[] { DialogueInterpreter.getDialogueKey("book:conguide") };
}
}
@@ -0,0 +1,70 @@
package content.global.skill.construction
import core.api.sendMessage
import core.game.dialogue.DialogueInterpreter
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import core.game.node.item.Item
import core.game.world.GameWorld.settings
import org.rs09.consts.Items
/**
* Construction Guide Book
* Used to be book:conguide?
* @author ovenbreado
* @author Emperor
*/
class ConstructionGuideBook : InteractionListener {
companion object {
private val TITLE = "Construction guide book"
/** The resources used in beta. */
private val RESOURCES = arrayOf(
Item(8794),
Item(2347),
Item(4819, 500000),
Item(4820, 500000),
Item(1539, 500000),
Item(4821, 500000),
Item(4822, 500000),
Item(4823, 500000),
Item(4824, 500000),
Item(961, 500000),
Item(8779, 500000),
Item(8781, 500000),
Item(8783, 500000),
Item(8791, 500000),
Item(8785, 500000),
Item(8787, 500000),
Item(8789, 500000), // 16
Item(8418, 500000),
Item(8420, 500000),
Item(8422, 500000),
Item(8424, 500000),
Item(8426, 500000),
Item(8428, 500000),
Item(8430, 500000),
Item(8432, 500000),
Item(8434, 500000),
Item(8436, 500000)
)
}
override fun defineListeners() {
println(intArrayOf(DialogueInterpreter.getDialogueKey("book:conguide")))
// There is supposedly a book here.
on(Items.CONSTRUCTION_GUIDE_8463, IntType.ITEM, "read") { player, _ ->
if (settings!!.isDevMode && settings!!.isBeta) {
for (item in RESOURCES) {
if (!player.inventory.contains(item.id, item.amount)) {
player.inventory.add(item, player)
}
}
}
sendMessage(player, "Upon reading the book you discover you're supposed to use these resources to test out construction. Report all bugs on the forums.")
return@on true
}
}
}
@@ -0,0 +1,136 @@
package content.region.asgarnia.taverley.quest.witchshouse
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
/**
* Witches' Diary Book
* https://www.youtube.com/watch?v=rLsLPVOjNCY
* @author ovenbreado
* @author Ethan Kyle Millard <skype:pumpklins>
*/
class WitchesDiaryBook : InteractionListener {
companion object {
private val TITLE = "Witches' Diary"
private val CONTENTS = arrayOf(
PageSet(
Page(
BookLine("<col=ff0000>2nd of Pentember", 55),
BookLine("Experiment is growing", 56),
BookLine("larger daily. Making", 57),
BookLine("excellent progress now. I", 58),
BookLine("am currently feeding it", 59),
BookLine("on a mixture of fungus,", 60),
BookLine("tar and clay.", 61),
BookLine("It seems to like this", 62),
BookLine("combination a lot!", 63)
),
Page(
BookLine("<col=ff0000>3rd of Pentember", 66),
BookLine("Experiment still going", 67),
BookLine("extremely well. Moved it", 68),
BookLine("to the wooden garden", 69),
BookLine("shed; it does too much", 70),
BookLine("damage in the house! it", 71),
BookLine("is getting very strong", 72),
BookLine("now, but unfortunately is", 73),
BookLine("not too intelligent yet. It", 74),
BookLine("has a really mean stare", 75),
BookLine("too!", 76)
)
),
PageSet(
Page(
BookLine("<col=ff0000>4th of Pentember", 55),
BookLine("Sausages for dinner", 56),
BookLine("tonight! Lovely!", 57),
BookLine("<col=ff0000>5th of Pentember", 59),
BookLine("A guy called Professor", 60),
BookLine("Oddenstein installed a", 61),
BookLine("new security system for", 62),
BookLine("me in the basement. He", 63),
BookLine("seems to have a lot of", 64),
BookLine("good security ideas.", 65)
),
Page(
BookLine("<col=ff0000>6th of Pentember", 66),
BookLine("Don't want people getting", 67),
BookLine("into back garden to see", 68),
BookLine("the experiment. Professor", 69),
BookLine("Oddenstein is fitting me a", 70),
BookLine("new security system,", 71),
BookLine("after his successful", 72),
BookLine("installation in the cellar.", 73)
)
),
PageSet(
Page(
BookLine("<col=ff0000>7th of Pentember", 55),
BookLine("That pesky kid keeps", 56),
BookLine("kicking his ball into my", 57),
BookLine("garden. I swear, if he", 58),
BookLine("does it AGAIN, I'm going", 59),
BookLine("to lock his ball away in", 60),
BookLine("the shed.", 61),
BookLine("<col=ff0000>8th of Pentember.", 63),
BookLine("The security system is", 64),
BookLine("done. By Zamorak! Wow,", 65)
),
Page(
BookLine("is it contrived! Now, to", 66),
BookLine("open my own back door,", 67),
BookLine("I lure a mouse out of a", 68),
BookLine("hole in the back porch, I", 69),
BookLine("fit a magic curved piece", 70),
BookLine("of metal to the harness", 71),
BookLine("on its back, the mouse", 72),
BookLine("goes back in the hole, and", 73),
BookLine("the door unlocks! The", 74),
BookLine("prof tells me that this is", 75),
BookLine("cutting edge technology!", 76)
)
),
PageSet(
Page(
BookLine("As an added precaution I", 55),
BookLine("have hidden the key to", 56),
BookLine("the shed in a secret", 57),
BookLine("compartment of the", 58),
BookLine("fountain in the garden.", 59),
BookLine("No one will ever look", 60),
BookLine("there.", 61),
BookLine("<col=ff0000>9th of Pentember", 63),
BookLine("Still can't think of a good", 64),
BookLine("name of 'The", 65)
),
Page(
BookLine("Experiment'. Leaning", 66),
BookLine("Towards 'fritz'... Although", 67),
BookLine("am considering Lucy as", 68),
BookLine("it reminds me of my", 69),
BookLine("Mother!", 70)
)
)
)
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.DIARY_2408, IntType.ITEM, "read") { player, _ ->
setAttribute(player, "bookInterfaceCallback", ::display)
setAttribute(player, "bookInterfaceCurrentPage", 0)
display(player, 0, 0)
return@on true
}
}
}
@@ -1,163 +0,0 @@
package content.region.asgarnia.taverley.quest.witchshouse;
import core.plugin.Initializable;
import core.game.dialogue.DialoguePlugin;
import core.game.dialogue.book.Book;
import core.game.dialogue.book.BookLine;
import core.game.dialogue.book.Page;
import core.game.dialogue.book.PageSet;
import core.game.node.entity.player.Player;
/**
* Created for 2009Scape
* User: Ethan Kyle Millard
* Date: March 30, 2020
* Time: 2:49 PM
*/
@Initializable
public class WitchsDiaryBook extends Book {
/**
* Represents the shield of arrav book id.
*/
public static int ID = 4501993;
/**
* Represents the array of pages for this book.
*/
private static final PageSet[] PAGES = new PageSet[]{
new PageSet(
new Page(new BookLine("<col=ff0000>2nd of Pentember", 55),
new BookLine("Experiment is growing", 56),
new BookLine("larger daily. Making", 57),
new BookLine("excellent progress now. I", 58),
new BookLine("am currently feeding it", 59),
new BookLine("on a mixture of fungus,", 60),
new BookLine("tar and clay.", 61),
new BookLine("It seems to like this", 62),
new BookLine("combination a lot!", 63)),
new Page(new BookLine("<col=ff0000>3rd of Pentember", 66),
new BookLine("Experiment still going", 67),
new BookLine("extremely well. Moved it", 68),
new BookLine("to the wooden garden", 69),
new BookLine("shed; it does too much", 70),
new BookLine("damage in the house! it", 71),
new BookLine("is getting very strong", 72),
new BookLine("now, but unfortunately is", 73),
new BookLine("not too intelligent yet. It", 74),
new BookLine("has a really mean stare", 75),
new BookLine("too!", 76))),
new PageSet(
new Page(new BookLine("<col=ff0000>4th of Pentember", 55),
new BookLine("Sausages for dinner", 56),
new BookLine("tonight! Lovely!", 57),
new BookLine("<col=ff0000>5th of Pentember", 59),
new BookLine("A guy called Professor", 60),
new BookLine("Oddenstein installed a", 61),
new BookLine("new security system for", 62),
new BookLine("me in the basement. He", 63),
new BookLine("seems to have a lot of", 64),
new BookLine("good security ideas.", 65)),
new Page(new BookLine("<col=ff0000>6th of Pentember", 66),
new BookLine("Don't want people getting", 67),
new BookLine("into back garden to see", 68),
new BookLine("the experiment. Professor", 69),
new BookLine("Oddenstein is fitting me a", 70),
new BookLine("new security system,", 71),
new BookLine("after his successful", 72),
new BookLine("installation in the cellar.", 73))),
new PageSet(
new Page(new BookLine("<col=ff0000>7th of Pentember", 55),
new BookLine("That pesky kid keeps", 56),
new BookLine("kicking his ball into my", 57),
new BookLine("garden. I swear, if he", 58),
new BookLine("does it AGAIN, I'm going", 59),
new BookLine("to lock his ball away in", 60),
new BookLine("the shed.", 61),
new BookLine("<col=ff0000>8th of Pentember.", 63),
new BookLine("The security system is", 64),
new BookLine("done. By Zamorak! Wow,", 65)),
new Page(new BookLine("is it contrived! Now, to", 66),
new BookLine("open my own back door,", 67),
new BookLine("I lure a mouse out of a", 68),
new BookLine("hole in the back porch, I", 69),
new BookLine("fit a magic curved piece", 70),
new BookLine("of metal to the harness", 71),
new BookLine("on its back, the mouse", 72),
new BookLine("goes back in the hole, and", 73),
new BookLine("the door unlocks! The", 74),
new BookLine("prof tells me that this is", 75),
new BookLine("cutting edge technology!", 76))),
new PageSet(
new Page(new BookLine("As an added precaution I", 55),
new BookLine("have hidden the key to", 56),
new BookLine("the shed in a secret", 57),
new BookLine("compartment of the", 58),
new BookLine("fountain in the garden.", 59),
new BookLine("No one will ever look", 60),
new BookLine("there.", 61),
new BookLine("<col=ff0000>9th of Pentember", 63),
new BookLine("Still can't think of a good", 64),
new BookLine("name of 'The", 65)),
new Page(new BookLine("Experiment'. Leaning", 66),
new BookLine("Towards 'fritz'... Although", 67),
new BookLine("am considering Lucy as", 68),
new BookLine("it reminds me of my", 69),
new BookLine("Mother!", 70))),
};
/**
* Constructs a new {@code WitchsDiaryBook} {@code Object}.
*/
public WitchsDiaryBook(final Player player) {
super(player, "Witches' Diary", 2408, PAGES);
}
/**
* Constructs a new {@code WitchsDiaryBook} {@code Object}.
*/
public WitchsDiaryBook() {
/**
* empty.
*/
}
@Override
public void finish() {
}
@Override
public void display(Page[] set) {
player.lock();
player.getInterfaceManager().open(getInterface());
for (int i = 55; i < 77; i++) {
player.getPacketDispatch().sendString("", getInterface().getId(), i);
}
player.getPacketDispatch().sendString(getName(), getInterface().getId(), 6);
player.getPacketDispatch().sendString("", getInterface().getId(), 77);
player.getPacketDispatch().sendString("", getInterface().getId(), 78);
for (Page page : set) {
for (BookLine line : page.getLines()) {
player.getPacketDispatch().sendString(line.getMessage(), getInterface().getId(), line.getChild());
}
}
player.getPacketDispatch().sendInterfaceConfig(getInterface().getId(), 51, index < 1);
boolean lastPage = index == sets.length - 1;
player.getPacketDispatch().sendInterfaceConfig(getInterface().getId(), 53, lastPage);
if (lastPage) {
finish();
}
player.unlock();
}
@Override
public DialoguePlugin newInstance(Player player) {
return new WitchsDiaryBook(player);
}
@Override
public int[] getIds() {
return new int[]{ID};
}
}
@@ -1,18 +1,10 @@
package content.region.desert.quest.thegolem
import core.api.*
import core.game.dialogue.DialoguePlugin
import core.game.dialogue.book.Book
import core.game.dialogue.book.BookLine
import core.game.dialogue.book.Page
import core.game.dialogue.book.PageSet
import core.game.node.entity.npc.NPC
import core.game.node.entity.player.Player
import core.plugin.Initializable
import org.rs09.consts.Items
import org.rs09.consts.NPCs
import core.game.dialogue.DialogueBuilder
import core.game.dialogue.DialogueBuilderFile
@Initializable
public final class ClayGolemDialoguePlugin(player: Player? = null) : core.game.dialogue.DialoguePlugin(player) {
@@ -126,306 +118,6 @@ val LETTER_LINES = arrayOf(
"Your loving Elissa.",
)
val VARMEN_NOTES = arrayOf(
core.game.dialogue.book.PageSet(
core.game.dialogue.book.Page(
core.game.dialogue.book.BookLine("Septober 19:", 55),
core.game.dialogue.book.BookLine("The nomads were right:", 56),
core.game.dialogue.book.BookLine("there is a city here,", 57),
core.game.dialogue.book.BookLine("probably buried for", 58),
core.game.dialogue.book.BookLine("millenia and revealed by", 59),
core.game.dialogue.book.BookLine("the random motions of", 60),
core.game.dialogue.book.BookLine("the sand. The", 61),
core.game.dialogue.book.BookLine("architecture is impressive", 62),
core.game.dialogue.book.BookLine("even in ruin, and must", 63),
core.game.dialogue.book.BookLine("once have been amazing.", 64),
core.game.dialogue.book.BookLine("One puzzling factor is the", 65),
),
core.game.dialogue.book.Page(
core.game.dialogue.book.BookLine("pottery -- there are", 66),
core.game.dialogue.book.BookLine("fragments all over the", 67),
core.game.dialogue.book.BookLine("ruins, surely too much", 68),
core.game.dialogue.book.BookLine("for a city even of this", 69),
core.game.dialogue.book.BookLine("size. We have set up", 70),
core.game.dialogue.book.BookLine("camp and will do a proper", 71),
core.game.dialogue.book.BookLine("survey tomorrow.", 72),
)
),
core.game.dialogue.book.PageSet(
core.game.dialogue.book.Page(
core.game.dialogue.book.BookLine("Septober 20:", 55),
core.game.dialogue.book.BookLine("The meaning of the", 56),
core.game.dialogue.book.BookLine("pottery was explained", 57),
core.game.dialogue.book.BookLine("today in a most", 58),
core.game.dialogue.book.BookLine("surprising manner. We", 59),
core.game.dialogue.book.BookLine("found a mostly-intact clay", 60),
core.game.dialogue.book.BookLine("statue buried up to its", 61),
core.game.dialogue.book.BookLine("waist in sand, and as", 62),
core.game.dialogue.book.BookLine("soon as we dug it out, it", 63),
core.game.dialogue.book.BookLine("started to walk around! It", 64),
core.game.dialogue.book.BookLine("is a clay golem, built by", 65),
),
core.game.dialogue.book.Page(
core.game.dialogue.book.BookLine("the city's inhabitants and", 66),
core.game.dialogue.book.BookLine("dormant all this time. Its", 67),
core.game.dialogue.book.BookLine("head is badly damaged", 68),
core.game.dialogue.book.BookLine("and it is", 69),
core.game.dialogue.book.BookLine("uncommunicative, but its", 70),
core.game.dialogue.book.BookLine("existence tells us that the", 71),
core.game.dialogue.book.BookLine("city's inhabitants were", 72),
core.game.dialogue.book.BookLine("expert magical craftsmen.", 73),
core.game.dialogue.book.BookLine("The huge kilns in some", 74),
core.game.dialogue.book.BookLine("of the buildings indicate", 75),
core.game.dialogue.book.BookLine("that at some point before", 76),
)
),
core.game.dialogue.book.PageSet(
core.game.dialogue.book.Page(
core.game.dialogue.book.BookLine("its destruction the whole", 55),
core.game.dialogue.book.BookLine("city was converted to the", 56),
core.game.dialogue.book.BookLine("manufacture of these", 57),
core.game.dialogue.book.BookLine("golems.", 58),
core.game.dialogue.book.BookLine("", 59),
core.game.dialogue.book.BookLine("We have also examined", 60),
core.game.dialogue.book.BookLine("the carvings on the large", 61),
core.game.dialogue.book.BookLine("building in the centre.", 62),
core.game.dialogue.book.BookLine("These are symbols", 63),
core.game.dialogue.book.BookLine("depicting several of the", 64),
core.game.dialogue.book.BookLine("ancient gods, including", 65),
),
core.game.dialogue.book.Page(
core.game.dialogue.book.BookLine("Saradomin, Zamorak, and", 66),
core.game.dialogue.book.BookLine("Armadyl, but there is", 67),
core.game.dialogue.book.BookLine("another prominent symbol", 68),
core.game.dialogue.book.BookLine("that I cannot identify. As", 69),
core.game.dialogue.book.BookLine("it seems we will need to", 70),
core.game.dialogue.book.BookLine("be here for longer than I", 71),
core.game.dialogue.book.BookLine("had thought, I have sent", 72),
core.game.dialogue.book.BookLine("to Elissa for books on", 73),
core.game.dialogue.book.BookLine("golems and religious", 74),
core.game.dialogue.book.BookLine("symbols.", 75),
)
),
core.game.dialogue.book.PageSet(
core.game.dialogue.book.Page(
core.game.dialogue.book.BookLine("Septober 21:", 55),
core.game.dialogue.book.BookLine("As we examine the ruins", 56),
core.game.dialogue.book.BookLine("one thing becomes", 57),
core.game.dialogue.book.BookLine("increasingly clear: most", 58),
core.game.dialogue.book.BookLine("of the damage was not", 59),
core.game.dialogue.book.BookLine("due to weathering. The", 60),
core.game.dialogue.book.BookLine("buildings were destroyed", 61),
core.game.dialogue.book.BookLine("by force, as if torn down", 62),
core.game.dialogue.book.BookLine("by giant hands.", 63),
),
core.game.dialogue.book.Page(
core.game.dialogue.book.BookLine("Septober 22:", 66),
core.game.dialogue.book.BookLine("A breakthrough! We have", 67),
core.game.dialogue.book.BookLine("found the staircase into", 68),
core.game.dialogue.book.BookLine("the lower levels of the", 69),
core.game.dialogue.book.BookLine("temple. This part has", 70),
core.game.dialogue.book.BookLine("been untouched by the", 71),
core.game.dialogue.book.BookLine("elements, and the", 72),
core.game.dialogue.book.BookLine("carvings here are more", 73),
core.game.dialogue.book.BookLine("intact, especially four", 74),
core.game.dialogue.book.BookLine("beautiful statuettes in", 75),
core.game.dialogue.book.BookLine("alcoves framing the large", 76),
)
),
core.game.dialogue.book.PageSet(
core.game.dialogue.book.Page(
core.game.dialogue.book.BookLine("door. I have removed one", 55),
core.game.dialogue.book.BookLine("of them. The door will", 56),
core.game.dialogue.book.BookLine("not open. I am glad I", 57),
core.game.dialogue.book.BookLine("sent for a book on", 58),
core.game.dialogue.book.BookLine("symbols, as the", 59),
core.game.dialogue.book.BookLine("unidentified symbol is", 60),
core.game.dialogue.book.BookLine("even more prominent", 61),
core.game.dialogue.book.BookLine("here, especially on the", 62),
core.game.dialogue.book.BookLine("door.", 63),
),
core.game.dialogue.book.Page(
core.game.dialogue.book.BookLine("Septober 23:", 66),
core.game.dialogue.book.BookLine("Our messenger returned", 67),
core.game.dialogue.book.BookLine("with the books I asked for", 68),
core.game.dialogue.book.BookLine("and a letter from Elissa.", 69),
core.game.dialogue.book.BookLine("It is unfortunate that the", 70),
core.game.dialogue.book.BookLine("museum will not be able", 71),
core.game.dialogue.book.BookLine("to finance a full-scale", 72),
core.game.dialogue.book.BookLine("excavation here as well as", 73),
core.game.dialogue.book.BookLine("the one closer to Varrock,", 74),
core.game.dialogue.book.BookLine("although I am of course", 75),
core.game.dialogue.book.BookLine("pleased that the other city", 76),
)
),
core.game.dialogue.book.PageSet(
core.game.dialogue.book.Page(
core.game.dialogue.book.BookLine("has been uncovered. But", 55),
core.game.dialogue.book.BookLine("with the books I am able", 56),
core.game.dialogue.book.BookLine("to piece together more of", 57),
core.game.dialogue.book.BookLine("the story of this city.", 58),
core.game.dialogue.book.BookLine("", 59),
core.game.dialogue.book.BookLine("The unidentified symbol", 60),
core.game.dialogue.book.BookLine("in the ruins is that of the", 61),
core.game.dialogue.book.BookLine("demon Thammaron, who", 62),
core.game.dialogue.book.BookLine("was Zamorak's chief", 63),
core.game.dialogue.book.BookLine("lieutenant during the", 64),
core.game.dialogue.book.BookLine("godwars of the Third", 65),
),
core.game.dialogue.book.Page(
core.game.dialogue.book.BookLine("Age. With that", 66),
core.game.dialogue.book.BookLine("information I can say", 67),
core.game.dialogue.book.BookLine("with confidence that these", 68),
core.game.dialogue.book.BookLine("are the ruins of Uzer, an", 69),
core.game.dialogue.book.BookLine("advanced human", 70),
core.game.dialogue.book.BookLine("civilization said to have", 71),
core.game.dialogue.book.BookLine("been destroyed towards", 72),
core.game.dialogue.book.BookLine("the end of the Third Age", 73),
core.game.dialogue.book.BookLine("(roughly 2,500 years", 74),
core.game.dialogue.book.BookLine("ago). It was allied with", 75),
core.game.dialogue.book.BookLine("Saradomin and enjoyed", 76),
)
),
core.game.dialogue.book.PageSet(
core.game.dialogue.book.Page(
core.game.dialogue.book.BookLine("his protection, as well as", 55),
core.game.dialogue.book.BookLine("that of its own mages and", 56),
core.game.dialogue.book.BookLine("warriors. Thammaron was", 57),
core.game.dialogue.book.BookLine("able to open a portal from", 58),
core.game.dialogue.book.BookLine("his own domain straight", 59),
core.game.dialogue.book.BookLine("into the heart of the city,", 60),
core.game.dialogue.book.BookLine("bypassing its defences.", 61),
core.game.dialogue.book.BookLine("With Saradomin's help the", 62),
core.game.dialogue.book.BookLine("army of Uzer was able to", 63),
core.game.dialogue.book.BookLine("drive Thammaron back,", 64),
core.game.dialogue.book.BookLine("but the record ends at", 65),
),
core.game.dialogue.book.Page(
core.game.dialogue.book.BookLine("that point and it has", 66),
core.game.dialogue.book.BookLine("always been assumed that", 67),
core.game.dialogue.book.BookLine("a later attack, either by", 68),
core.game.dialogue.book.BookLine("Thammaron or by", 69),
core.game.dialogue.book.BookLine("Zamorak's other forces,", 70),
core.game.dialogue.book.BookLine("finished the city off.", 71),
core.game.dialogue.book.BookLine("", 72),
core.game.dialogue.book.BookLine("Examining the door", 73),
core.game.dialogue.book.BookLine("again, I now see that it is", 74),
core.game.dialogue.book.BookLine("exactly the sort of door", 75),
core.game.dialogue.book.BookLine("that could be used to seal", 76),
)
),
core.game.dialogue.book.PageSet(
core.game.dialogue.book.Page(
core.game.dialogue.book.BookLine("Thammaron's portal. I am", 55),
core.game.dialogue.book.BookLine("suddently glad I was not", 56),
core.game.dialogue.book.BookLine("able to open it! I surmise", 57),
core.game.dialogue.book.BookLine("that the army of golems", 58),
core.game.dialogue.book.BookLine("was created in order to", 59),
core.game.dialogue.book.BookLine("fight the demon, since", 60),
core.game.dialogue.book.BookLine("Uzer's army had been", 61),
core.game.dialogue.book.BookLine("wiped out and", 62),
core.game.dialogue.book.BookLine("Saradomin's forces were", 63),
core.game.dialogue.book.BookLine("increasingly stretched.", 64),
core.game.dialogue.book.BookLine("However, this approach", 65),
),
core.game.dialogue.book.Page(
core.game.dialogue.book.BookLine("evidently failed, since the", 66),
core.game.dialogue.book.BookLine("city was eventually", 67),
core.game.dialogue.book.BookLine("destroyed.", 68),
core.game.dialogue.book.BookLine("", 69),
core.game.dialogue.book.BookLine("The art of the", 70),
core.game.dialogue.book.BookLine("construction of golems", 71),
core.game.dialogue.book.BookLine("has been lost since the", 72),
core.game.dialogue.book.BookLine("Third Age, and, although", 73),
core.game.dialogue.book.BookLine("they are sometimes", 74),
core.game.dialogue.book.BookLine("discovered lying dormant", 75),
core.game.dialogue.book.BookLine("in the ground, no", 76),
)
),
core.game.dialogue.book.PageSet(
core.game.dialogue.book.Page(
core.game.dialogue.book.BookLine("concerted effort has been", 55),
core.game.dialogue.book.BookLine("made to regain it, thanks", 56),
core.game.dialogue.book.BookLine("largely to the modern", 57),
core.game.dialogue.book.BookLine("Saradomist Church's view", 58),
core.game.dialogue.book.BookLine("of them as unnatural.", 59),
core.game.dialogue.book.BookLine("This view is without", 60),
core.game.dialogue.book.BookLine("foundation, as golems are", 61),
core.game.dialogue.book.BookLine("neither good nor evil but", 62),
core.game.dialogue.book.BookLine("follow instructions they", 63),
core.game.dialogue.book.BookLine("are given to the letter", 64),
core.game.dialogue.book.BookLine("and without imagination,", 65),
),
core.game.dialogue.book.Page(
core.game.dialogue.book.BookLine("indeed experiencing", 66),
core.game.dialogue.book.BookLine("extreme discomfort for as", 67),
core.game.dialogue.book.BookLine("long as a task assigned to", 68),
core.game.dialogue.book.BookLine("them remains incomplete.", 69),
core.game.dialogue.book.BookLine("Some golems were", 70),
core.game.dialogue.book.BookLine("constructed to obey", 71),
core.game.dialogue.book.BookLine("verbal instructions, but", 72),
core.game.dialogue.book.BookLine("the main method of", 73),
core.game.dialogue.book.BookLine("instruction was to place", 74),
core.game.dialogue.book.BookLine("magical words into the", 75),
core.game.dialogue.book.BookLine("golem's skull cavity.", 76),
)
),
core.game.dialogue.book.PageSet(
core.game.dialogue.book.Page(
core.game.dialogue.book.BookLine("These were written on", 55),
core.game.dialogue.book.BookLine("papyrus using a naturally", 56),
core.game.dialogue.book.BookLine("occurring source of ink,", 57),
core.game.dialogue.book.BookLine("and their magical power", 58),
core.game.dialogue.book.BookLine("derived from the use of a", 59),
core.game.dialogue.book.BookLine("phoenix tail feather as a", 60),
core.game.dialogue.book.BookLine("pen. These would be used", 61),
core.game.dialogue.book.BookLine("for long-term or", 62),
core.game.dialogue.book.BookLine("important tasks, and", 63),
core.game.dialogue.book.BookLine("would override any verbal", 64),
core.game.dialogue.book.BookLine("instructions.", 65),
)
)
)
@Initializable
class VarmensNotesHandler : core.game.dialogue.book.Book {
constructor() {}
constructor(player: Player?) : super(player, "The Ruins of Uzer", Items.VARMENS_NOTES_4616, *VARMEN_NOTES) {}
override fun finish() {
player.setAttribute("/save:the-golem:varmen-notes-read", true)
}
override fun display(set: Array<core.game.dialogue.book.Page>) {
player.interfaceManager.open(getInterface())
for (i in 55..76) {
player.packetDispatch.sendString("", getInterface().id, i)
}
player.packetDispatch.sendString("", getInterface().id, 77)
player.packetDispatch.sendString("", getInterface().id, 78)
player.packetDispatch.sendString(getName(), getInterface().id, 6)
for (page in set) {
for (line in page.lines) {
player.packetDispatch.sendString(line.message, getInterface().id, line.child)
}
}
player.packetDispatch.sendInterfaceConfig(getInterface().id, 51, index < 1)
val lastPage = index == sets.size - 1
player.packetDispatch.sendInterfaceConfig(getInterface().id, 53, lastPage)
if (lastPage) {
finish()
}
}
override fun newInstance(player: Player): core.game.dialogue.DialoguePlugin {
return VarmensNotesHandler(player)
}
override fun getIds(): IntArray {
return intArrayOf(Items.VARMENS_NOTES_4616)
}
}
val DISPLAY_CASE_TEXT = arrayOf("3rd age - yr 3000-4000",
"",
"This statuette was found in an underground",
@@ -0,0 +1,300 @@
package content.region.desert.quest.thegolem
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.InteractionListener
import core.game.interaction.IntType
import core.game.node.entity.player.Player
import org.rs09.consts.Items
/**
* Varmen's Notes Book
* @author ovenbreado
*/
class VarmensNotes : InteractionListener {
companion object {
private val TITLE = "The Ruins of Uzer"
val CONTENTS = arrayOf(
PageSet(
Page(
BookLine("Septober 19:", 55),
BookLine("The nomads were right:", 56),
BookLine("there is a city here,", 57),
BookLine("probably buried for", 58),
BookLine("millenia and revealed by", 59),
BookLine("the random motions of", 60),
BookLine("the sand. The", 61),
BookLine("architecture is impressive", 62),
BookLine("even in ruin, and must", 63),
BookLine("once have been amazing.", 64),
BookLine("One puzzling factor is the", 65),
),
Page(
BookLine("pottery -- there are", 66),
BookLine("fragments all over the", 67),
BookLine("ruins, surely too much", 68),
BookLine("for a city even of this", 69),
BookLine("size. We have set up", 70),
BookLine("camp and will do a proper", 71),
BookLine("survey tomorrow.", 72),
)
),
PageSet(
Page(
BookLine("Septober 20:", 55),
BookLine("The meaning of the", 56),
BookLine("pottery was explained", 57),
BookLine("today in a most", 58),
BookLine("surprising manner. We", 59),
BookLine("found a mostly-intact clay", 60),
BookLine("statue buried up to its", 61),
BookLine("waist in sand, and as", 62),
BookLine("soon as we dug it out, it", 63),
BookLine("started to walk around! It", 64),
BookLine("is a clay golem, built by", 65),
),
Page(
BookLine("the city's inhabitants and", 66),
BookLine("dormant all this time. Its", 67),
BookLine("head is badly damaged", 68),
BookLine("and it is", 69),
BookLine("uncommunicative, but its", 70),
BookLine("existence tells us that the", 71),
BookLine("city's inhabitants were", 72),
BookLine("expert magical craftsmen.", 73),
BookLine("The huge kilns in some", 74),
BookLine("of the buildings indicate", 75),
BookLine("that at some point before", 76),
)
),
PageSet(
Page(
BookLine("its destruction the whole", 55),
BookLine("city was converted to the", 56),
BookLine("manufacture of these", 57),
BookLine("golems.", 58),
BookLine("", 59),
BookLine("We have also examined", 60),
BookLine("the carvings on the large", 61),
BookLine("building in the centre.", 62),
BookLine("These are symbols", 63),
BookLine("depicting several of the", 64),
BookLine("ancient gods, including", 65),
),
Page(
BookLine("Saradomin, Zamorak, and", 66),
BookLine("Armadyl, but there is", 67),
BookLine("another prominent symbol", 68),
BookLine("that I cannot identify. As", 69),
BookLine("it seems we will need to", 70),
BookLine("be here for longer than I", 71),
BookLine("had thought, I have sent", 72),
BookLine("to Elissa for books on", 73),
BookLine("golems and religious", 74),
BookLine("symbols.", 75),
)
),
PageSet(
Page(
BookLine("Septober 21:", 55),
BookLine("As we examine the ruins", 56),
BookLine("one thing becomes", 57),
BookLine("increasingly clear: most", 58),
BookLine("of the damage was not", 59),
BookLine("due to weathering. The", 60),
BookLine("buildings were destroyed", 61),
BookLine("by force, as if torn down", 62),
BookLine("by giant hands.", 63),
),
Page(
BookLine("Septober 22:", 66),
BookLine("A breakthrough! We have", 67),
BookLine("found the staircase into", 68),
BookLine("the lower levels of the", 69),
BookLine("temple. This part has", 70),
BookLine("been untouched by the", 71),
BookLine("elements, and the", 72),
BookLine("carvings here are more", 73),
BookLine("intact, especially four", 74),
BookLine("beautiful statuettes in", 75),
BookLine("alcoves framing the large", 76),
)
),
PageSet(
Page(
BookLine("door. I have removed one", 55),
BookLine("of them. The door will", 56),
BookLine("not open. I am glad I", 57),
BookLine("sent for a book on", 58),
BookLine("symbols, as the", 59),
BookLine("unidentified symbol is", 60),
BookLine("even more prominent", 61),
BookLine("here, especially on the", 62),
BookLine("door.", 63),
),
Page(
BookLine("Septober 23:", 66),
BookLine("Our messenger returned", 67),
BookLine("with the books I asked for", 68),
BookLine("and a letter from Elissa.", 69),
BookLine("It is unfortunate that the", 70),
BookLine("museum will not be able", 71),
BookLine("to finance a full-scale", 72),
BookLine("excavation here as well as", 73),
BookLine("the one closer to Varrock,", 74),
BookLine("although I am of course", 75),
BookLine("pleased that the other city", 76),
)
),
PageSet(
Page(
BookLine("has been uncovered. But", 55),
BookLine("with the books I am able", 56),
BookLine("to piece together more of", 57),
BookLine("the story of this city.", 58),
BookLine("", 59),
BookLine("The unidentified symbol", 60),
BookLine("in the ruins is that of the", 61),
BookLine("demon Thammaron, who", 62),
BookLine("was Zamorak's chief", 63),
BookLine("lieutenant during the", 64),
BookLine("godwars of the Third", 65),
),
Page(
BookLine("Age. With that", 66),
BookLine("information I can say", 67),
BookLine("with confidence that these", 68),
BookLine("are the ruins of Uzer, an", 69),
BookLine("advanced human", 70),
BookLine("civilization said to have", 71),
BookLine("been destroyed towards", 72),
BookLine("the end of the Third Age", 73),
BookLine("(roughly 2,500 years", 74),
BookLine("ago). It was allied with", 75),
BookLine("Saradomin and enjoyed", 76),
)
),
PageSet(
Page(
BookLine("his protection, as well as", 55),
BookLine("that of its own mages and", 56),
BookLine("warriors. Thammaron was", 57),
BookLine("able to open a portal from", 58),
BookLine("his own domain straight", 59),
BookLine("into the heart of the city,", 60),
BookLine("bypassing its defences.", 61),
BookLine("With Saradomin's help the", 62),
BookLine("army of Uzer was able to", 63),
BookLine("drive Thammaron back,", 64),
BookLine("but the record ends at", 65),
),
Page(
BookLine("that point and it has", 66),
BookLine("always been assumed that", 67),
BookLine("a later attack, either by", 68),
BookLine("Thammaron or by", 69),
BookLine("Zamorak's other forces,", 70),
BookLine("finished the city off.", 71),
BookLine("", 72),
BookLine("Examining the door", 73),
BookLine("again, I now see that it is", 74),
BookLine("exactly the sort of door", 75),
BookLine("that could be used to seal", 76),
)
),
PageSet(
Page(
BookLine("Thammaron's portal. I am", 55),
BookLine("suddently glad I was not", 56),
BookLine("able to open it! I surmise", 57),
BookLine("that the army of golems", 58),
BookLine("was created in order to", 59),
BookLine("fight the demon, since", 60),
BookLine("Uzer's army had been", 61),
BookLine("wiped out and", 62),
BookLine("Saradomin's forces were", 63),
BookLine("increasingly stretched.", 64),
BookLine("However, this approach", 65),
),
Page(
BookLine("evidently failed, since the", 66),
BookLine("city was eventually", 67),
BookLine("destroyed.", 68),
BookLine("", 69),
BookLine("The art of the", 70),
BookLine("construction of golems", 71),
BookLine("has been lost since the", 72),
BookLine("Third Age, and, although", 73),
BookLine("they are sometimes", 74),
BookLine("discovered lying dormant", 75),
BookLine("in the ground, no", 76),
)
),
PageSet(
Page(
BookLine("concerted effort has been", 55),
BookLine("made to regain it, thanks", 56),
BookLine("largely to the modern", 57),
BookLine("Saradomist Church's view", 58),
BookLine("of them as unnatural.", 59),
BookLine("This view is without", 60),
BookLine("foundation, as golems are", 61),
BookLine("neither good nor evil but", 62),
BookLine("follow instructions they", 63),
BookLine("are given to the letter", 64),
BookLine("and without imagination,", 65),
),
Page(
BookLine("indeed experiencing", 66),
BookLine("extreme discomfort for as", 67),
BookLine("long as a task assigned to", 68),
BookLine("them remains incomplete.", 69),
BookLine("Some golems were", 70),
BookLine("constructed to obey", 71),
BookLine("verbal instructions, but", 72),
BookLine("the main method of", 73),
BookLine("instruction was to place", 74),
BookLine("magical words into the", 75),
BookLine("golem's skull cavity.", 76),
)
),
PageSet(
Page(
BookLine("These were written on", 55),
BookLine("papyrus using a naturally", 56),
BookLine("occurring source of ink,", 57),
BookLine("and their magical power", 58),
BookLine("derived from the use of a", 59),
BookLine("phoenix tail feather as a", 60),
BookLine("pen. These would be used", 61),
BookLine("for long-term or", 62),
BookLine("important tasks, and", 63),
BookLine("would override any verbal", 64),
BookLine("instructions.", 65),
)
)
)
private fun display(player: Player, pageNum: Int, buttonID: Int) : Boolean {
BookInterface.pageSetup(player, BookInterface.FANCY_BOOK_3_49, TITLE, CONTENTS)
if (BookInterface.isLastPage(pageNum, CONTENTS.size)) {
player.setAttribute("/save:the-golem:varmen-notes-read", true)
}
return true
}
}
override fun defineListeners() {
on(Items.VARMENS_NOTES_4616, IntType.ITEM, "read") { player, _ ->
setAttribute(player, "bookInterfaceCallback", ::display)
setAttribute(player, "bookInterfaceCurrentPage", 0)
display(player, 0, 0)
return@on true
}
}
}
@@ -1,164 +1,135 @@
package content.region.kandarin.seers.quest.elementalworkshop
import core.api.setQuestStage
import core.game.dialogue.DialoguePlugin
import core.game.dialogue.book.Book
import core.game.dialogue.book.BookLine
import core.game.dialogue.book.Page
import core.game.dialogue.book.PageSet
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 core.plugin.Initializable
import org.rs09.consts.Items
/**
* Gloughs Journal book handler for The Grand Tree quest
*
* @author crop & szu
* @author crop & szu & ovenbreado
*/
@Initializable
class GloughsJournal : Book {
constructor(player: Player?) : super(player, "Glough's Journal", Items.GLOUGHS_JOURNAL_785, *arrayOf(
PageSet(
Page(
BookLine("<col=FF2D00>The migration failed!", 55),
BookLine("After spending half", 56),
BookLine("a century hiding", 57),
BookLine("underground you", 58),
BookLine("you would think", 59),
BookLine("that the great", 60),
BookLine("migration would have", 61),
BookLine("improved life on", 62),
BookLine("Gielinor for tree gnomes.", 63),
BookLine("However, rather", 64),
BookLine("than the great liberation", 65),
class GloughsJournal : InteractionListener {
companion object {
private val TITLE = "Glough's Journal"
private val CONTENTS = arrayOf(
PageSet(
Page(
BookLine("<col=FF2D00>The migration failed!", 55),
BookLine("After spending half", 56),
BookLine("a century hiding", 57),
BookLine("underground you", 58),
BookLine("you would think", 59),
BookLine("that the great", 60),
BookLine("migration would have", 61),
BookLine("improved life on", 62),
BookLine("Gielinor for tree gnomes.", 63),
BookLine("However, rather", 64),
BookLine("than the great liberation", 65),
),
Page(
BookLine("promised to us by", 65),
BookLine("King Healthorg at the", 66),
BookLine("end of the last age,", 67),
BookLine("we have been forced", 68),
BookLine("to live in hiding,", 69),
BookLine("up trees or in the", 70),
BookLine("gnome maze, laughed", 71),
BookLine("at and mocked by man.", 72),
BookLine("Living in constant", 73),
BookLine("fear of human aggression", 74),
BookLine("we are in a no better", 75),
)
),
Page(
BookLine("promised to us by", 65),
BookLine("King Healthorg at the", 66),
BookLine("end of the last age,", 67),
BookLine("we have been forced", 68),
BookLine("to live in hiding,", 69),
BookLine("up trees or in the", 70),
BookLine("gnome maze, laughed", 71),
BookLine("at and mocked by man.", 72),
BookLine("Living in constant", 73),
BookLine("fear of human aggression", 74),
BookLine("we are in a no better", 75),
)
),
PageSet(
Page(
BookLine("we are in a no better", 55),
BookLine("situation now than", 56),
BookLine("when we lived", 57),
BookLine("in the caves!", 58),
BookLine("Change must come soon!", 59),
BookLine("<col=FF2D00>They must be stopped!", 60),
BookLine("Today I heard of three", 61),
BookLine("more gnomes slain", 62),
BookLine("by Khazard's human", 63),
BookLine("troops for fun,", 64),
BookLine("I can't control", 65),
PageSet(
Page(
BookLine("we are in a no better", 55),
BookLine("situation now than", 56),
BookLine("when we lived", 57),
BookLine("in the caves!", 58),
BookLine("Change must come soon!", 59),
BookLine("<col=FF2D00>They must be stopped!", 60),
BookLine("Today I heard of three", 61),
BookLine("more gnomes slain", 62),
BookLine("by Khazard's human", 63),
BookLine("troops for fun,", 64),
BookLine("I can't control", 65),
),
Page(
BookLine("my anger!", 66),
BookLine("Humanity seems to", 67),
BookLine("have acquired a", 68),
BookLine("level of arrogance", 69),
BookLine("comparable to that", 70),
BookLine("of Zamorak, killing", 71),
BookLine("and pillaging at will!", 72),
BookLine("We are small and at", 73),
BookLine("heart not warriors", 74),
BookLine("but something must", 75),
)
),
Page(
BookLine("my anger!", 66),
BookLine("Humanity seems to", 67),
BookLine("have acquired a", 68),
BookLine("level of arrogance", 69),
BookLine("comparable to that", 70),
BookLine("of Zamorak, killing", 71),
BookLine("and pillaging at will!", 72),
BookLine("We are small and at", 73),
BookLine("heart not warriors", 74),
BookLine("but something must", 75),
)
),
PageSet(
Page(
BookLine("be done! We will", 55),
BookLine("pick up arms and", 56),
BookLine("go forth into the", 57),
BookLine("human world! We will", 58),
BookLine("defend ourselves and", 59),
BookLine("we will pursue justice", 60),
BookLine("for all gnomes who", 61),
BookLine("fell at the hands", 62),
BookLine("of humans!", 63),
BookLine("<col=FF2D00>Gaining support.", 64),
BookLine("", 65),
PageSet(
Page(
BookLine("be done! We will", 55),
BookLine("pick up arms and", 56),
BookLine("go forth into the", 57),
BookLine("human world! We will", 58),
BookLine("defend ourselves and", 59),
BookLine("we will pursue justice", 60),
BookLine("for all gnomes who", 61),
BookLine("fell at the hands", 62),
BookLine("of humans!", 63),
BookLine("<col=FF2D00>Gaining support.", 64),
BookLine("", 65),
),
Page(
BookLine("Some of the local", 66),
BookLine("gnomes seem strangely", 67),
BookLine("deluded about humans,", 68),
BookLine("many actually believe", 69),
BookLine("that humans are not", 70),
BookLine("all naturally evil", 71),
BookLine("but instead vary", 72),
BookLine("from person to person.", 73),
BookLine("This sort of talk", 74),
BookLine("could be the end", 75),
)
),
Page(
BookLine("Some of the local", 66),
BookLine("gnomes seem strangely", 67),
BookLine("deluded about humans,", 68),
BookLine("many actually believe", 69),
BookLine("that humans are not", 70),
BookLine("all naturally evil", 71),
BookLine("but instead vary", 72),
BookLine("from person to person.", 73),
BookLine("This sort of talk", 74),
BookLine("could be the end", 75),
)
),
PageSet(
Page(
BookLine("for the tree gnomes", 55),
BookLine("and I must continue", 56),
BookLine("to convince my fellow", 57),
BookLine("gnome folk the cold", 58),
BookLine("truth about these", 59),
BookLine("human creatures!", 60),
BookLine("How they will not", 61),
BookLine("stop until all gnome", 62),
BookLine("life is destroyed!", 63),
BookLine("Unless we can ", 64),
BookLine("destroy them first!", 65),
PageSet(
Page(
BookLine("for the tree gnomes", 55),
BookLine("and I must continue", 56),
BookLine("to convince my fellow", 57),
BookLine("gnome folk the cold", 58),
BookLine("truth about these", 59),
BookLine("human creatures!", 60),
BookLine("How they will not", 61),
BookLine("stop until all gnome", 62),
BookLine("life is destroyed!", 63),
BookLine("Unless we can ", 64),
BookLine("destroy them first!", 65),
)
)
)
)
) {}
constructor() {
/**
* empty.
*/
}
override fun finish() {
}
override fun display(set: Array<Page>) {
player.lock()
player.interfaceManager.open(getInterface())
for (i in 55..76) {
player.packetDispatch.sendString("", getInterface().id, i)
private fun display(player: Player, pageNum: Int, buttonID: Int): Boolean {
BookInterface.pageSetup(player, BookInterface.FANCY_BOOK_3_49, TITLE, CONTENTS)
return true
}
player.packetDispatch.sendString("", getInterface().id, 77)
player.packetDispatch.sendString("", getInterface().id, 78)
player.packetDispatch.sendString(getName(), getInterface().id, 6)
for (page in set) {
for (line in page.lines) {
player.packetDispatch.sendString(line.message, getInterface().id, line.child)
}
}
player.packetDispatch.sendInterfaceConfig(getInterface().id, 51, index < 1)
val lastPage = index == sets.size - 1
player.packetDispatch.sendInterfaceConfig(getInterface().id, 53, lastPage)
if (lastPage) {
finish()
}
player.unlock()
}
override fun newInstance(player: Player): DialoguePlugin {
return GloughsJournal(player)
}
override fun getIds(): IntArray {
// This is all handled in `BookreadOption.java` you need to manually
// register a new dialogue key for your file there.
return intArrayOf(49610762)
override fun defineListeners() {
on(Items.GLOUGHS_JOURNAL_785, IntType.ITEM, "read") { player, _ ->
setAttribute(player, "bookInterfaceCallback", ::display)
setAttribute(player, "bookInterfaceCurrentPage", 0)
display(player, 0, 0)
return@on true
}
}
}
@@ -1,6 +1,5 @@
package content.region.kandarin.quest.grandtree
import content.global.handlers.item.BookreadOption
import content.region.kandarin.quest.grandtree.TheGrandTree.Companion.questName
import core.api.*
import core.game.interaction.IntType
@@ -159,16 +158,6 @@ class GrandTreeListeners: InteractionListener {
return@on true;
}
on(Items.GLOUGHS_JOURNAL_785, IntType.ITEM, "read"){ player, _ ->
openDialogue(player, BookreadOption().getDialId(Items.GLOUGHS_JOURNAL_785))
return@on true;
}
on(Items.TRANSLATION_BOOK_784, IntType.ITEM, "read"){ player, _ ->
openDialogue(player, BookreadOption().getDialId(Items.TRANSLATION_BOOK_784))
return@on true;
}
// Roots for Daconia rock
on(32319, IntType.SCENERY, "search"){ player, node ->
if(questStage(player, questName) < 99 || player.hasItem(Item(Items.DACONIA_ROCK_793))){ return@on true; }
@@ -1,169 +1,141 @@
package content.region.kandarin.quest.grandtree
import core.game.dialogue.DialoguePlugin
import core.game.dialogue.book.Book
import core.game.dialogue.book.BookLine
import core.game.dialogue.book.Page
import core.game.dialogue.book.PageSet
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 core.plugin.Initializable
import org.rs09.consts.Items
/**
* Translation Book handler for The Grand Tree quest
*
* @author crop & szu
* @author crop & szu & ovenbreado
*/
@Initializable
class TranslationBook : Book {
constructor(player: Player?) : super(player, "Translation Book", Items.TRANSLATION_BOOK_784, *arrayOf(
PageSet(
Page(
BookLine("Gnome", 55),
BookLine("English translation", 56),
BookLine("written by Anita", 57),
BookLine("", 58),
BookLine("This text contains", 59),
BookLine("the ancient Gnome words", 60),
BookLine("I have managed to", 61),
BookLine("translate thus far.", 62),
BookLine("", 63),
class TranslationBook : InteractionListener {
companion object {
private val TITLE = "Translation Book"
private val CONTENTS = arrayOf(
PageSet(
Page(
BookLine("Gnome", 55),
BookLine("English translation", 56),
BookLine("written by Anita", 57),
BookLine("", 58),
BookLine("This text contains", 59),
BookLine("the ancient Gnome words", 60),
BookLine("I have managed to", 61),
BookLine("translate thus far.", 62),
BookLine("", 63),
),
Page(
BookLine("-A-", 66),
BookLine("arpos: rocks", 67),
BookLine("ando: gate", 68),
BookLine("andra: city", 69),
BookLine("ataris: cow", 70),
BookLine("-C-", 71),
BookLine("cef: threat", 72),
BookLine("cheray: lazy", 73),
BookLine("Cinqo: King", 74),
BookLine("cretor: bucket", 75),
)
),
Page(
BookLine("-A-", 66),
BookLine("arpos: rocks", 67),
BookLine("ando: gate", 68),
BookLine("andra: city", 69),
BookLine("ataris: cow", 70),
BookLine("-C-", 71),
BookLine("cef: threat", 72),
BookLine("cheray: lazy", 73),
BookLine("Cinqo: King", 74),
BookLine("cretor: bucket", 75),
)
),
PageSet(
Page(
BookLine("-E-", 55),
BookLine("eis: me", 56),
BookLine("es: a", 57),
BookLine("et: and", 58),
BookLine("eto: will", 59),
BookLine("-G-", 60),
BookLine("gandius: jungle", 61),
BookLine("Gal: All", 62),
BookLine("gentis: leaf", 63),
BookLine("gutus: banana", 64),
BookLine("gomondo: branch", 65),
PageSet(
Page(
BookLine("-E-", 55),
BookLine("eis: me", 56),
BookLine("es: a", 57),
BookLine("et: and", 58),
BookLine("eto: will", 59),
BookLine("-G-", 60),
BookLine("gandius: jungle", 61),
BookLine("Gal: All", 62),
BookLine("gentis: leaf", 63),
BookLine("gutus: banana", 64),
BookLine("gomondo: branch", 65),
),
Page(
BookLine("-H-", 66),
BookLine("har: old", 67),
BookLine("harij: harpoon", 68),
BookLine("hewo: grass", 69),
BookLine("", 70),
BookLine("-I-", 71),
BookLine("ip: you", 72),
BookLine("imindus: quest", 73),
BookLine("irno: translate", 74),
BookLine("", 75),
)
),
Page(
BookLine("-H-", 66),
BookLine("har: old", 67),
BookLine("harij: harpoon", 68),
BookLine("hewo: grass", 69),
BookLine("", 70),
BookLine("-I-", 71),
BookLine("ip: you", 72),
BookLine("imindus: quest", 73),
BookLine("irno: translate", 74),
BookLine("", 75),
)
),
PageSet(
Page(
BookLine("-K-", 55),
BookLine("kar: no", 56),
BookLine("kai: boat", 57),
BookLine("ko: sail", 58),
BookLine("", 59),
BookLine("-L-", 60),
BookLine("lauf: eye", 61),
BookLine("laquinay: common sense", 62),
BookLine("lemanto: man", 63),
BookLine("lemantolly: stupid man", 64),
BookLine("lovos: gave", 65),
PageSet(
Page(
BookLine("-K-", 55),
BookLine("kar: no", 56),
BookLine("kai: boat", 57),
BookLine("ko: sail", 58),
BookLine("", 59),
BookLine("-L-", 60),
BookLine("lauf: eye", 61),
BookLine("laquinay: common sense", 62),
BookLine("lemanto: man", 63),
BookLine("lemantolly: stupid man", 64),
BookLine("lovos: gave", 65),
),
Page(
BookLine("-M-", 66),
BookLine("meriz: kill", 67),
BookLine("mina: time(s)", 68),
BookLine("mos: coin", 69),
BookLine("mi: I", 70),
BookLine("mond: seal", 71),
BookLine("", 72),
)
),
Page(
BookLine("-M-", 66),
BookLine("meriz: kill", 67),
BookLine("mina: time(s)", 68),
BookLine("mos: coin", 69),
BookLine("mi: I", 70),
BookLine("mond: seal", 71),
BookLine("", 72),
)
),
PageSet(
Page(
BookLine("-P-", 55),
BookLine("por: long", 56),
BookLine("prit: with", 57),
BookLine("priw: tree", 58),
BookLine("pro: to", 59),
BookLine("", 60),
BookLine("-Q-", 61),
BookLine("Qui: guard", 62),
BookLine("Quir: guardian", 63),
BookLine("-R-", 64),
BookLine("rentos: agility", 65),
),
Page(
BookLine("-S-", 66),
BookLine("sarko: Begone", 67),
BookLine("sind: big", 68),
BookLine("", 69),
BookLine("-T-", 70),
BookLine("ta: the", 71),
BookLine("tuzo: open", 72),
BookLine("-U-", 73),
BookLine("Undri: lands", 74),
BookLine("Umesco: Soul", 75),
PageSet(
Page(
BookLine("-P-", 55),
BookLine("por: long", 56),
BookLine("prit: with", 57),
BookLine("priw: tree", 58),
BookLine("pro: to", 59),
BookLine("", 60),
BookLine("-Q-", 61),
BookLine("Qui: guard", 62),
BookLine("Quir: guardian", 63),
BookLine("-R-", 64),
BookLine("rentos: agility", 65),
),
Page(
BookLine("-S-", 66),
BookLine("sarko: Begone", 67),
BookLine("sind: big", 68),
BookLine("", 69),
BookLine("-T-", 70),
BookLine("ta: the", 71),
BookLine("tuzo: open", 72),
BookLine("-U-", 73),
BookLine("Undri: lands", 74),
BookLine("Umesco: Soul", 75),
)
)
)
)
) {}
constructor() {
/**
* empty.
*/
}
override fun finish() {
}
override fun display(set: Array<Page>) {
player.lock()
player.interfaceManager.open(getInterface())
for (i in 55..76) {
player.packetDispatch.sendString("", getInterface().id, i)
private fun display(player:Player, pageNum: Int, buttonID: Int) : Boolean {
BookInterface.pageSetup(player, BookInterface.FANCY_BOOK_3_49, TITLE, CONTENTS)
return true
}
player.packetDispatch.sendString("", getInterface().id, 77)
player.packetDispatch.sendString("", getInterface().id, 78)
player.packetDispatch.sendString(getName(), getInterface().id, 6)
for (page in set) {
for (line in page.lines) {
player.packetDispatch.sendString(line.message, getInterface().id, line.child)
}
}
player.packetDispatch.sendInterfaceConfig(getInterface().id, 51, index < 1)
val lastPage = index == sets.size - 1
player.packetDispatch.sendInterfaceConfig(getInterface().id, 53, lastPage)
if (lastPage) {
finish()
}
player.unlock()
}
override fun newInstance(player: Player): DialoguePlugin {
return TranslationBook(player)
}
override fun getIds(): IntArray {
// This is all handled in `BookreadOption.java` you need to manually
// register a new dialogue key for your file there.
return intArrayOf(49610763)
override fun defineListeners() {
on(Items.TRANSLATION_BOOK_784, IntType.ITEM, "read") { player, _ ->
setAttribute(player, "bookInterfaceCallback", ::display)
setAttribute(player, "bookInterfaceCurrentPage", 0)
display(player, 0, 0)
return@on true
}
}
}
@@ -0,0 +1,161 @@
package content.region.kandarin.quest.waterfall
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
/**
* Baxtorian Book
* @author ovenbreado
* @author Splinter
*/
class BaxtorianBook : InteractionListener {
companion object {
private val TITLE = "Book on Baxtorian"
private val CONTENTS = arrayOf(
PageSet(
Page(
BookLine("The missing relics", 55),
BookLine("", 56),
BookLine(" Many artefacts of", 57),
BookLine("elven history were lost", 58),
BookLine("after the fourth age. The", 59),
BookLine("greatest loss to our", 60),
BookLine("collections of elf history", 61),
BookLine("were the hidden treasures", 62),
BookLine("of Baxtorian.", 63),
BookLine(" Some believe these", 64),
BookLine("treasures are still", 65)
),
Page(
BookLine("unclaimed, but it is more", 66),
BookLine("commonly believed that", 67),
BookLine("dwarf miners recovered", 68),
BookLine("the treasure at the", 69),
BookLine("beginning of the third", 70),
BookLine("age. Another great loss", 71),
BookLine("was Glarial's pebble, a key", 72),
BookLine("which allowed her family", 73),
BookLine("to visit her tomb.", 74),
BookLine(" The stone was taken", 75),
BookLine("by a gnome family over a", 76)
)
),
PageSet(
Page(
BookLine("century ago. It is", 55),
BookLine("believed that the gnomes'", 56),
BookLine("descendant Golrie still has", 57),
BookLine("the stone hidden in the", 58),
BookLine("caves under the gnome", 59),
BookLine("tree village.", 60),
BookLine("", 61),
BookLine("The sonnet of Baxtorian", 62),
BookLine("", 63),
BookLine("The love between", 64),
BookLine("Baxtorian and Glarial was", 65)
), Page(
BookLine("said to have lasted over a", 66),
BookLine("century. They lived a", 67),
BookLine("peaceful life learning and", 68),
BookLine("teaching the laws of", 69),
BookLine("nature. When Baxtorian's", 70),
BookLine("kingdom was invaded by", 71),
BookLine("the dark forces he left on", 72),
BookLine("a five year campaign. He", 73),
BookLine("returned to find his", 74),
BookLine("people slaughtered and his", 75),
BookLine("wife taken by the enemy.", 76)
)
),
PageSet(
Page(
BookLine(" After years of", 55),
BookLine("searching for his love he", 56),
BookLine("finally gave up and", 57),
BookLine("returned to the home he", 58),
BookLine("made for Glarial under", 59),
BookLine("the Baxtorian Waterfall.", 60),
BookLine("Once he entered he", 61),
BookLine("never returned. Only", 62),
BookLine("Glarial had the power to", 63),
BookLine("also enter the waterfall.", 64),
BookLine(" Since Baxtorian", 65)
),
Page(
BookLine("entered no one but her", 66),
BookLine("can follow him in, it's as if", 67),
BookLine("the powers of nature still", 68),
BookLine("work to protect him.", 69),
BookLine("", 70),
BookLine("The power of nature", 71),
BookLine("", 72),
BookLine(" Glarial and Baxtorian", 73),
BookLine("were masters of nature.", 74),
BookLine("Trees would grow, hills", 75),
BookLine("form and rivers flood on", 76)
)
),
PageSet(
Page(
BookLine("their command. Baxtorian", 55),
BookLine("in particular had", 56),
BookLine("perfected rune lore. It", 57),
BookLine("was said that he could", 58),
BookLine("uses the stones to control", 59),
BookLine("water, earth, and air.", 60),
BookLine("", 61),
BookLine("Ode to eternity", 62),
BookLine("", 63),
BookLine("A short piece written by", 64),
BookLine("Baxtorian himself.", 65)
),
Page(
BookLine("", 66),
BookLine("What care I for this", 67),
BookLine("mortal coil,", 68),
BookLine("where treasures are yet", 69),
BookLine("so frail,", 70),
BookLine("for it is you that is my", 71),
BookLine("life blood,", 72),
BookLine("the wine to my holy grail", 73),
BookLine("and if I see the", 74),
BookLine("judgement day,", 75),
BookLine("when the gods fill the air", 76)
)
),
PageSet(
Page(
BookLine("with dust,", 55),
BookLine("I'll happily choke on your", 56),
BookLine("memory,", 57),
BookLine("as my kingdom turns to", 58),
BookLine("rust", 59)
)
)
)
private fun display(player: Player, pageNum: Int, buttonID: Int) : Boolean {
BookInterface.pageSetup(player, BookInterface.FANCY_BOOK_3_49, TITLE, CONTENTS)
if (player.questRepository.getQuest(WaterFall.NAME).getStage(player) == 20) {
player.questRepository.getQuest(WaterFall.NAME).setStage(player, 30)
}
return true
}
}
override fun defineListeners() {
on(Items.BOOK_ON_BAXTORIAN_292, IntType.ITEM, "read") { player, _ ->
setAttribute(player, "bookInterfaceCallback", ::display)
setAttribute(player, "bookInterfaceCurrentPage", 0)
display(player, 0, 0)
return@on true
}
}
}
@@ -1,122 +0,0 @@
package content.region.kandarin.quest.waterfall;
import core.game.dialogue.DialoguePlugin;
import core.game.dialogue.book.Book;
import core.game.dialogue.book.BookLine;
import core.game.dialogue.book.Page;
import core.game.dialogue.book.PageSet;
import core.game.node.entity.player.Player;
/**
* Handles the book on Baxtorian that nobody will read.
* @author Splinter
*/
public final class BookOnBaxtorianPlugin extends Book {
/**
* Represents the book id
*/
public static int ID = 183764;
/**
* Represents the array of pages for this book.
*/
private static final PageSet[] PAGES = new PageSet[] {
new PageSet(
new Page(
new BookLine("The missing relics", 55), new BookLine("", 56), new BookLine(" Many artefacts of", 57), new BookLine("elven history were lost", 58),
new BookLine("after the fourth age. The", 59), new BookLine("greatest loss to our", 60), new BookLine("collections of elf history", 61),
new BookLine("were the hidden treasures", 62), new BookLine("of Baxtorian.", 63), new BookLine(" Some believe these", 64), new BookLine("treasures are still", 65)),
new Page(
new BookLine("unclaimed, but it is more", 66), new BookLine("commonly believed that", 67), new BookLine("dwarf miners recovered", 68),
new BookLine("the treasure at the", 69), new BookLine("beginning of the third", 70), new BookLine("age. Another great loss", 71), new BookLine("was Glarial's pebble, a key", 72),
new BookLine("which allowed her family", 73), new BookLine("to visit her tomb.", 74), new BookLine(" The stone was taken", 75), new BookLine("by a gnome family over a", 76))),
new PageSet(
new Page(
new BookLine("century ago. It is", 55), new BookLine("believed that the gnomes'", 56), new BookLine("descendant Golrie still has", 57), new BookLine("the stone hidden in the", 58),
new BookLine("caves under the gnome", 59), new BookLine("tree village.", 60), new BookLine("", 61), new BookLine("The sonnet of Baxtorian", 62), new BookLine("", 63),
new BookLine("The love between", 64), new BookLine("Baxtorian and Glarial was", 65)), new Page(new BookLine("said to have lasted over a", 66), new BookLine("century. They lived a", 67),
new BookLine("peaceful life learning and", 68), new BookLine("teaching the laws of", 69), new BookLine("nature. When Baxtorian's", 70), new BookLine("kingdom was invaded by", 71),
new BookLine("the dark forces he left on", 72), new BookLine("a five year campaign. He", 73), new BookLine("returned to find his", 74), new BookLine("people slaughtered and his", 75),
new BookLine("wife taken by the enemy.", 76))),
new PageSet(
new Page(
new BookLine(" After years of", 55), new BookLine("searching for his love he", 56),
new BookLine("finally gave up and", 57), new BookLine("returned to the home he", 58), new BookLine("made for Glarial under", 59), new BookLine("the Baxtorian Waterfall.", 60),
new BookLine("Once he entered he", 61), new BookLine("never returned. Only", 62), new BookLine("Glarial had the power to", 63), new BookLine("also enter the waterfall.", 64),
new BookLine(" Since Baxtorian", 65)),
new Page(new BookLine("entered no one but her", 66), new BookLine("can follow him in, it's as if", 67), new BookLine("the powers of nature still", 68), new BookLine("work to protect him.", 69),
new BookLine("", 70), new BookLine("The power of nature", 71), new BookLine("", 72), new BookLine(" Glarial and Baxtorian", 73), new BookLine("were masters of nature.", 74),
new BookLine("Trees would grow, hills", 75), new BookLine("form and rivers flood on", 76))),
new PageSet(
new Page(
new BookLine("their command. Baxtorian", 55), new BookLine("in particular had", 56), new BookLine("perfected rune lore. It", 57), new BookLine("was said that he could", 58),
new BookLine("uses the stones to control", 59), new BookLine("water, earth, and air.", 60), new BookLine("", 61), new BookLine("Ode to eternity", 62), new BookLine("", 63),
new BookLine("A short piece written by", 64), new BookLine("Baxtorian himself.", 65)),
new Page(new BookLine("", 66), new BookLine("What care I for this", 67), new BookLine("mortal coil,", 68), new BookLine("where treasures are yet", 69),
new BookLine("so frail,", 70), new BookLine("for it is you that is my", 71), new BookLine("life blood,", 72), new BookLine("the wine to my holy grail", 73),
new BookLine("and if I see the", 74), new BookLine("judgement day,", 75), new BookLine("when the gods fill the air", 76))),
new PageSet(
new Page(
new BookLine("with dust,", 55), new BookLine("I'll happily choke on your", 56), new BookLine("memory,", 57), new BookLine("as my kingdom turns to", 58), new BookLine("rust", 59))),
};
/**
* Constructs a new {@code ShieldofArravBook} {@code Object}.
*/
public BookOnBaxtorianPlugin(final Player player) {
super(player, "Book On Baxtorian", 260, PAGES);
}
/**
* Constructs a new {@code ShieldofArravBook} {@code Object}.
*/
public BookOnBaxtorianPlugin() {
/**
* empty.
*/
}
@Override
public void finish() {
if (player.getQuestRepository().getQuest(WaterFall.NAME).getStage(player) == 20) {
player.getQuestRepository().getQuest(WaterFall.NAME).setStage(player, 30);
}
}
@Override
public void display(Page[] set) {
player.lock();
player.getInterfaceManager().open(getInterface());
player.getPacketDispatch().sendString("Previous", getInterface().getId(), 77);
player.getPacketDispatch().sendString("Next", getInterface().getId(), 78);
if (player.getQuestRepository().getQuest(WaterFall.NAME).getStage(player) == 20) {
player.getQuestRepository().getQuest(WaterFall.NAME).setStage(player, 30);
}
for (int i = 55; i < 77; i++) {
player.getPacketDispatch().sendString("", getInterface().getId(), i);
}
player.getPacketDispatch().sendString(getName(), getInterface().getId(), 6);
for (Page page : set) {
for (BookLine line : page.getLines()) {
player.getPacketDispatch().sendString(line.getMessage(), getInterface().getId(), line.getChild());
}
}
boolean lastPage = index == sets.length - 1;
if (lastPage) {
finish();
}
player.unlock();
}
@Override
public DialoguePlugin newInstance(Player player) {
return new BookOnBaxtorianPlugin(player);
}
@Override
public int[] getIds() {
return new int[] { ID };
}
}
@@ -84,7 +84,7 @@ public class WaterFall extends Quest {
@Override
public Quest newInstance(Object object) {
ClassScanner.definePlugins(new AlmeraDialogue(), new BookOnBaxtorianPlugin(), new GolrieDialogue(), new HadleyDialogue(), new HudonDialogue(), new WaterfallPlugin(), new WaterfallTreeDialogue());
ClassScanner.definePlugins(new AlmeraDialogue(), new GolrieDialogue(), new HadleyDialogue(), new HudonDialogue(), new WaterfallPlugin(), new WaterfallTreeDialogue());
return this;
}
@@ -1,11 +1,11 @@
package content.region.kandarin.seers.quest.elementalworkshop
import content.global.handlers.iface.BookInterface
import core.api.setAttribute
import core.api.setQuestStage
import core.game.dialogue.DialoguePlugin
import core.game.dialogue.book.Book
import core.game.dialogue.book.Page
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import core.game.node.entity.player.Player
import core.plugin.Initializable
import org.rs09.consts.Items
/**
@@ -13,52 +13,29 @@ import org.rs09.consts.Items
*
* @author Woah, with love
*/
@Initializable
class BatteredBookHandler : core.game.dialogue.book.Book {
class BatteredBookHandler : InteractionListener {
constructor(player: Player?) : super(player, "Book of the elemental shield", Items.BATTERED_BOOK_2886, *EWUtils.PAGES) {}
companion object {
private val TITLE = "Book of the elemental shield"
private val CONTENTS = EWUtils.PAGES;
constructor() {
/**
* empty.
*/
}
override fun finish() {
if (EWUtils.currentStage(player) == 0) {
setQuestStage(player, "Elemental Workshop I", 1)
}
}
override fun display(set: Array<core.game.dialogue.book.Page>) {
player.lock()
player.interfaceManager.open(getInterface())
for (i in 55..76) {
player.packetDispatch.sendString("", getInterface().id, i)
}
player.packetDispatch.sendString("", getInterface().id, 77)
player.packetDispatch.sendString("", getInterface().id, 78)
player.packetDispatch.sendString(getName(), getInterface().id, 6)
for (page in set) {
for (line in page.lines) {
player.packetDispatch.sendString(line.message, getInterface().id, line.child)
private fun display(player:Player, pageNum: Int, buttonID: Int) : Boolean {
BookInterface.pageSetup(player, BookInterface.FANCY_BOOK_3_49, TITLE, CONTENTS)
if (BookInterface.isLastPage(pageNum, CONTENTS.size)) {
if (EWUtils.currentStage(player) == 0) {
setQuestStage(player, "Elemental Workshop I", 1)
}
}
return true
}
player.packetDispatch.sendInterfaceConfig(getInterface().id, 51, index < 1)
val lastPage = index == sets.size - 1
player.packetDispatch.sendInterfaceConfig(getInterface().id, 53, lastPage)
if (lastPage) {
finish()
}
player.unlock()
}
override fun newInstance(player: Player): core.game.dialogue.DialoguePlugin {
return BatteredBookHandler(player)
}
override fun getIds(): IntArray {
return intArrayOf(EWUtils.BATTERED_BOOK_ID)
override fun defineListeners() {
on(Items.BATTERED_BOOK_2886, IntType.ITEM, "read") { player, _ ->
setAttribute(player, "bookInterfaceCallback", ::display)
setAttribute(player, "bookInterfaceCurrentPage", 0)
display(player, 0, 0)
return@on true
}
}
}
@@ -1,9 +1,9 @@
package content.region.kandarin.seers.quest.elementalworkshop
import content.global.handlers.iface.BookLine
import content.global.handlers.iface.Page
import content.global.handlers.iface.PageSet
import core.api.getVarbitValue
import core.game.dialogue.book.BookLine
import core.game.dialogue.book.Page
import core.game.dialogue.book.PageSet
import core.game.node.entity.player.Player
import org.rs09.consts.Vars
@@ -14,66 +14,58 @@ import org.rs09.consts.Vars
* @author Woah, with love
*/
object EWUtils {
// Helpers for the battered/slashed book
/**
* Represents the book id
*/
const val BATTERED_BOOK_ID = 49610760
const val SLASHED_BOOK_ID = 49610761
/**
* Represents the array of pages for this book.
* Represents the array of pages for both the BATTERED_BOOK and SLASHED_BOOK.
*/
val PAGES = arrayOf(
core.game.dialogue.book.PageSet(
core.game.dialogue.book.Page(
core.game.dialogue.book.BookLine("Within the pages of this", 55),
core.game.dialogue.book.BookLine("book you will find the", 56),
core.game.dialogue.book.BookLine("secret to working the", 57),
core.game.dialogue.book.BookLine("very elements themselves.", 58),
core.game.dialogue.book.BookLine("Early in the fifth age, a", 59),
core.game.dialogue.book.BookLine("new ore was discovered.", 60),
core.game.dialogue.book.BookLine("This ore has a unique", 61),
core.game.dialogue.book.BookLine("property of absorbing,", 62),
core.game.dialogue.book.BookLine("transforming or focusing", 63),
core.game.dialogue.book.BookLine("elemental energy. A", 64),
core.game.dialogue.book.BookLine("workshop was erected", 65),
PageSet(
Page(
BookLine("Within the pages of this", 55),
BookLine("book you will find the", 56),
BookLine("secret to working the", 57),
BookLine("very elements themselves.", 58),
BookLine("Early in the fifth age, a", 59),
BookLine("new ore was discovered.", 60),
BookLine("This ore has a unique", 61),
BookLine("property of absorbing,", 62),
BookLine("transforming or focusing", 63),
BookLine("elemental energy. A", 64),
BookLine("workshop was erected", 65),
),
core.game.dialogue.book.Page(
core.game.dialogue.book.BookLine("close by to work this new", 66),
core.game.dialogue.book.BookLine("material. The workshop", 67),
core.game.dialogue.book.BookLine("was set up for artisans", 68),
core.game.dialogue.book.BookLine("and inventors to be able", 69),
core.game.dialogue.book.BookLine("to come and create", 70),
core.game.dialogue.book.BookLine("devices made from the", 71),
core.game.dialogue.book.BookLine("unique ore, found only in", 72),
core.game.dialogue.book.BookLine("the village of the Seers.", 73)
Page(
BookLine("close by to work this new", 66),
BookLine("material. The workshop", 67),
BookLine("was set up for artisans", 68),
BookLine("and inventors to be able", 69),
BookLine("to come and create", 70),
BookLine("devices made from the", 71),
BookLine("unique ore, found only in", 72),
BookLine("the village of the Seers.", 73)
)
),
core.game.dialogue.book.PageSet(
core.game.dialogue.book.Page(
core.game.dialogue.book.BookLine("After some time of", 55),
core.game.dialogue.book.BookLine("successful industry the", 56),
core.game.dialogue.book.BookLine("true power of this ore", 57),
core.game.dialogue.book.BookLine("became apparent, as", 58),
core.game.dialogue.book.BookLine("greater and more", 59),
core.game.dialogue.book.BookLine("powerful weapons were", 60),
core.game.dialogue.book.BookLine("created. Realising the", 61),
core.game.dialogue.book.BookLine("threat this posed, the magi", 62),
core.game.dialogue.book.BookLine("of the time closed down", 63),
core.game.dialogue.book.BookLine("the workshop and bound", 64),
core.game.dialogue.book.BookLine("it under lock and key,", 65)
PageSet(
Page(
BookLine("After some time of", 55),
BookLine("successful industry the", 56),
BookLine("true power of this ore", 57),
BookLine("became apparent, as", 58),
BookLine("greater and more", 59),
BookLine("powerful weapons were", 60),
BookLine("created. Realising the", 61),
BookLine("threat this posed, the magi", 62),
BookLine("of the time closed down", 63),
BookLine("the workshop and bound", 64),
BookLine("it under lock and key,", 65)
),
core.game.dialogue.book.Page(
core.game.dialogue.book.BookLine("also trying to destroy all", 66),
core.game.dialogue.book.BookLine("knowledge of ", 67),
core.game.dialogue.book.BookLine("manufacturing processes.", 68),
core.game.dialogue.book.BookLine("Yet this book remains and", 69),
core.game.dialogue.book.BookLine("you may still find a way", 70),
core.game.dialogue.book.BookLine("to enter the workshop", 71),
core.game.dialogue.book.BookLine("within this leather bound", 72),
core.game.dialogue.book.BookLine("volume.", 73),
Page(
BookLine("also trying to destroy all", 66),
BookLine("knowledge of ", 67),
BookLine("manufacturing processes.", 68),
BookLine("Yet this book remains and", 69),
BookLine("you may still find a way", 70),
BookLine("to enter the workshop", 71),
BookLine("within this leather bound", 72),
BookLine("volume.", 73),
)
)
)
@@ -1,10 +1,10 @@
package content.region.kandarin.seers.quest.elementalworkshop
import core.game.dialogue.DialoguePlugin
import core.game.dialogue.book.Book
import core.game.dialogue.book.Page
import content.global.handlers.iface.BookInterface
import core.api.setAttribute
import core.game.interaction.IntType
import core.game.interaction.InteractionListener
import core.game.node.entity.player.Player
import core.plugin.Initializable
import org.rs09.consts.Items
/**
@@ -12,47 +12,23 @@ import org.rs09.consts.Items
*
* @author Woah, with love
*/
@Initializable
class SlashedBookHandler : core.game.dialogue.book.Book {
constructor(player: Player?) : super(player, "Book of the elemental shield", Items.SLASHED_BOOK_9715, *EWUtils.PAGES) {}
class SlashedBookHandler : InteractionListener {
companion object {
private val TITLE = "Book of the elemental shield"
private val CONTENTS = EWUtils.PAGES;
constructor() {
/**
* empty.
*/
private fun display(player:Player, pageNum: Int, buttonID: Int) : Boolean {
BookInterface.pageSetup(player, BookInterface.FANCY_BOOK_3_49, TITLE, CONTENTS)
return true
}
}
override fun finish() {}
override fun display(set: Array<core.game.dialogue.book.Page>) {
player.lock()
player.interfaceManager.open(getInterface())
for (i in 55..76) {
player.packetDispatch.sendString("", getInterface().id, i)
override fun defineListeners() {
on(Items.SLASHED_BOOK_9715, IntType.ITEM, "read") { player, _ ->
setAttribute(player, "bookInterfaceCallback", ::display)
setAttribute(player, "bookInterfaceCurrentPage", 0)
display(player, 0, 0)
return@on true
}
player.packetDispatch.sendString("", getInterface().id, 77)
player.packetDispatch.sendString("", getInterface().id, 78)
player.packetDispatch.sendString(getName(), getInterface().id, 6)
for (page in set) {
for (line in page.lines) {
player.packetDispatch.sendString(line.message, getInterface().id, line.child)
}
}
player.packetDispatch.sendInterfaceConfig(getInterface().id, 51, index < 1)
val lastPage = index == sets.size - 1
player.packetDispatch.sendInterfaceConfig(getInterface().id, 53, lastPage)
if (lastPage) {
finish()
}
player.unlock()
}
override fun newInstance(player: Player): core.game.dialogue.DialoguePlugin {
return BatteredBookHandler(player)
}
override fun getIds(): IntArray {
return intArrayOf(EWUtils.SLASHED_BOOK_ID)
}
}
@@ -1,163 +1,126 @@
package content.region.karamja.quest.tribaltotem
import core.game.dialogue.book.BookLine
import core.game.dialogue.DialoguePlugin
import core.game.dialogue.book.Book
import core.game.dialogue.book.Page
import core.game.dialogue.book.PageSet
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 core.plugin.Initializable
import org.rs09.consts.Items
/**
* This was some code for a post-tutorial RSPS guide book a long ass
* time ago, but it was using the ID for the guide book for Tribal Totem
* and I kind of need that, bro
*
* Ardougne Guide Book
* https://www.youtube.com/watch?v=-Qburz3T00o
* @author ovenbreado
* @author Splinter
* @author Phil
*/
@Initializable
class ArdougneGuideBook : core.game.dialogue.book.Book {
/**
* Constructs a new `ShieldofArravBook` `Object`.
*/
constructor(player: Player?) : super(player, "Ardougne Guide Book", 1856, *PAGES) {}
/**
* Constructs a new `ShieldofArravBook` `Object`.
*/
constructor() {
/**
* empty.
*/
}
override fun finish() {}
override fun display(set: Array<core.game.dialogue.book.Page>) {
player.lock()
player.interfaceManager.open(getInterface())
player.packetDispatch.sendString("Previous", getInterface().id, 77)
player.packetDispatch.sendString("Next", getInterface().id, 78)
for (i in 55..76) {
player.packetDispatch.sendString("", getInterface().id, i)
}
player.packetDispatch.sendString(getName(), getInterface().id, 6)
for (page in set) {
for (line in page.lines) {
player.packetDispatch.sendString(line.message, getInterface().id, line.child)
}
}
val lastPage = index == sets.size - 1
if (lastPage) {
finish()
}
player.unlock()
}
override fun newInstance(player: Player): core.game.dialogue.DialoguePlugin {
return ArdougneGuideBook(player)
}
override fun getIds(): IntArray {
return intArrayOf(ID)
}
class ArdougneGuideBook : InteractionListener {
companion object {
/**
* Represents the book id
*/
var ID = 387454
/**
* Represents the array of pages for this book.
*/
private val PAGES = arrayOf(
core.game.dialogue.book.PageSet(
core.game.dialogue.book.Page(
core.game.dialogue.book.BookLine("Introduction", 57),
core.game.dialogue.book.BookLine("This book is your guide to", 59),
core.game.dialogue.book.BookLine("the vibrant city of Ardougne.", 60),
core.game.dialogue.book.BookLine("Ardougne is known as an", 61),
core.game.dialogue.book.BookLine("exciting modern city located", 62),
core.game.dialogue.book.BookLine("on the sun drenched southern", 63),
core.game.dialogue.book.BookLine("coast of Kandarin", 64),
),
core.game.dialogue.book.Page(
core.game.dialogue.book.BookLine("Ardougne: City of Shopping!", 66),
core.game.dialogue.book.BookLine("Come sample the delights of", 67),
core.game.dialogue.book.BookLine("the Ardougne market - the", 68),
core.game.dialogue.book.BookLine("biggest in the known world!", 69),
core.game.dialogue.book.BookLine("From spices to silk, there", 70),
core.game.dialogue.book.BookLine("is something here for", 71),
core.game.dialogue.book.BookLine("everybody! Other popular", 72),
core.game.dialogue.book.BookLine("shopping destinations in", 73),
core.game.dialogue.book.BookLine("the area include the Armoury", 74),
core.game.dialogue.book.BookLine("and the ever popular", 75),
core.game.dialogue.book.BookLine("Adventurers' supply store.", 76)
)
private val TITLE = "Tourist Guide to Ardougne"
private val CONTENTS = arrayOf(
PageSet(
Page(
BookLine("<col=ff0000>Introduction", 57),
BookLine("This book is your guide to", 59),
BookLine("the vibrant city of Ardougne.", 60),
BookLine("Ardougne is known as an", 61),
BookLine("exciting modern city located", 62),
BookLine("on the sun drenched southern", 63),
BookLine("coast of Kandarin", 64),
),
core.game.dialogue.book.PageSet(
core.game.dialogue.book.Page(
core.game.dialogue.book.BookLine("Ardougne: City of Fun!", 55),
core.game.dialogue.book.BookLine("If you're looking for", 56),
core.game.dialogue.book.BookLine("entertainment in Ardougne,", 57),
core.game.dialogue.book.BookLine("why not pay a visit to the", 58),
core.game.dialogue.book.BookLine("Ardougne City zoo? Or relax", 59),
core.game.dialogue.book.BookLine("with a drink in the ever", 60),
core.game.dialogue.book.BookLine("popular Flying Horse Inn?", 61),
core.game.dialogue.book.BookLine("And for the adventurous,", 62),
core.game.dialogue.book.BookLine("there are always rats to be", 63),
core.game.dialogue.book.BookLine("slaughtered in the expansive", 64),
core.game.dialogue.book.BookLine("and vermin-ridden sewers", 65)
),
core.game.dialogue.book.Page(
core.game.dialogue.book.BookLine("There is something truly", 66),
core.game.dialogue.book.BookLine("for everybody here!", 67)
)
),
core.game.dialogue.book.PageSet(
core.game.dialogue.book.Page(
core.game.dialogue.book.BookLine("Ardougne: City of History!", 55),
core.game.dialogue.book.BookLine("Ardougne is renowned as an", 56),
core.game.dialogue.book.BookLine("important city of historical", 57),
core.game.dialogue.book.BookLine("interest. One historic building", 58),
core.game.dialogue.book.BookLine("is the magnificent Handelmort", 59),
core.game.dialogue.book.BookLine("Mansion, currently owned by", 60),
core.game.dialogue.book.BookLine("Lord Francis Kurt Handelmort.", 61),
core.game.dialogue.book.BookLine("Also of historical interest is", 62),
core.game.dialogue.book.BookLine("Ardougne Castle in the east of", 63),
core.game.dialogue.book.BookLine("the city recently opened to the", 64),
core.game.dialogue.book.BookLine("public. And of course the Holy", 65)
),
core.game.dialogue.book.Page(
core.game.dialogue.book.BookLine("Order of Paladins still wander", 66),
core.game.dialogue.book.BookLine("the streets of Ardougne, and", 67),
core.game.dialogue.book.BookLine("are often of interest to", 68),
core.game.dialogue.book.BookLine("tourists.", 69)
)
),
core.game.dialogue.book.PageSet(
core.game.dialogue.book.Page(
core.game.dialogue.book.BookLine("Further Fields", 55),
core.game.dialogue.book.BookLine("", 56),
core.game.dialogue.book.BookLine("The area surrounding Ardougne", 57),
core.game.dialogue.book.BookLine("is also of great interest to", 58),
core.game.dialogue.book.BookLine("the cultural tourist. If you", 59),
core.game.dialogue.book.BookLine("want to go further afield, why", 60),
core.game.dialogue.book.BookLine("not have a look at the ominous", 61),
core.game.dialogue.book.BookLine("Pillars of Zanash, the", 62),
core.game.dialogue.book.BookLine("mysterious marble pillars", 63),
core.game.dialogue.book.BookLine("located just West of the city?", 64),
core.game.dialogue.book.BookLine("Or perhaps the town of Brimhaven,", 65)
),
core.game.dialogue.book.Page(
core.game.dialogue.book.BookLine("on the exotic island of Karamja?", 66),
core.game.dialogue.book.BookLine("It's only a short boat trip with", 67),
core.game.dialogue.book.BookLine("regular transport leaving from", 68),
core.game.dialogue.book.BookLine("Ardougne harbor at all times", 69),
core.game.dialogue.book.BookLine("of the day, all year round.", 70)
)
Page(
BookLine("<col=ff0000>Ardougne: City of Shopping!", 66),
BookLine("Come sample the delights of", 67),
BookLine("the Ardougne market - the", 68),
BookLine("biggest in the known world!", 69),
BookLine("From spices to silk, there", 70),
BookLine("is something here for", 71),
BookLine("everybody! Other popular", 72),
BookLine("shopping destinations in", 73),
BookLine("the area include the Armoury", 74),
BookLine("and the ever popular", 75),
BookLine("Adventurers' supply store.", 76)
)
),
PageSet(
Page(
BookLine("<col=ff0000>Ardougne: City of Fun!", 55),
BookLine("If you're looking for", 56),
BookLine("entertainment in Ardougne,", 57),
BookLine("why not pay a visit to the", 58),
BookLine("Ardougne City zoo? Or relax", 59),
BookLine("with a drink in the ever", 60),
BookLine("popular Flying Horse Inn?", 61),
BookLine("And for the adventurous,", 62),
BookLine("there are always rats to be", 63),
BookLine("slaughtered in the expansive", 64),
BookLine("and vermin-ridden sewers", 65)
),
Page(
BookLine("There is something truly", 66),
BookLine("for everybody here!", 67)
)
),
PageSet(
Page(
BookLine("<col=ff0000>Ardougne: City of History!", 55),
BookLine("Ardougne is renowned as an", 56),
BookLine("important city of historical", 57),
BookLine("interest. One historic building", 58),
BookLine("is the magnificent Handelmort", 59),
BookLine("Mansion, currently owned by", 60),
BookLine("Lord Francis Kurt Handelmort.", 61),
BookLine("Also of historical interest is", 62),
BookLine("Ardougne Castle in the east of", 63),
BookLine("the city recently opened to the", 64),
BookLine("public. And of course the Holy", 65)
),
Page(
BookLine("Order of Paladins still wander", 66),
BookLine("the streets of Ardougne, and", 67),
BookLine("are often of interest to", 68),
BookLine("tourists.", 69)
)
),
PageSet(
Page(
BookLine("<col=ff0000>Further Fields", 55),
BookLine("", 56),
BookLine("The area surrounding Ardougne", 57),
BookLine("is also of great interest to", 58),
BookLine("the cultural tourist. If you", 59),
BookLine("want to go further afield, why", 60),
BookLine("not have a look at the ominous", 61),
BookLine("Pillars of Zanash, the", 62),
BookLine("mysterious marble pillars", 63),
BookLine("located just West of the city?", 64),
BookLine("Or perhaps the town of Brimhaven,", 65)
),
Page(
BookLine("on the exotic island of Karamja?", 66),
BookLine("It's only a short boat trip with", 67),
BookLine("regular transport leaving from", 68),
BookLine("Ardougne harbor at all times", 69),
BookLine("of the day, all year round.", 70)
)
)
)
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.GUIDE_BOOK_1856, IntType.ITEM, "read") { player, _ ->
setAttribute(player, "bookInterfaceCallback", ::display)
setAttribute(player, "bookInterfaceCurrentPage", 0)
display(player, 0, 0)
return@on true
}
}
}
@@ -59,7 +59,7 @@ public class ShieldofArrav extends Quest {
@Override
public Quest newInstance(Object object) {
ClassScanner.definePlugins(new CertificatePlugin(), new CuratorHaigHalenDialogue(), new JohnnyBeardNPC(), new JonnytheBeardPlugin(), new KatrineDialogue(), new KingRoaldDialogue(), new ReldoDialogue(), new ShieldArravPlugin(), new ShieldofArravBook(), new StravenDialogue(), new WeaponsMasterDialogue());
ClassScanner.definePlugins(new CertificatePlugin(), new CuratorHaigHalenDialogue(), new JohnnyBeardNPC(), new JonnytheBeardPlugin(), new KatrineDialogue(), new KingRoaldDialogue(), new ReldoDialogue(), new ShieldArravPlugin(), new StravenDialogue(), new WeaponsMasterDialogue());
return this;
}
@@ -1,84 +0,0 @@
package content.region.misthalin.varrock.quest.shieldofarrav;
import core.game.dialogue.DialoguePlugin;
import core.game.dialogue.book.Book;
import core.game.dialogue.book.BookLine;
import core.game.dialogue.book.Page;
import core.game.dialogue.book.PageSet;
import core.game.node.entity.player.Player;
/**
* Represents the shield of arrav book.
* @author 'Vexia
* @author Empathy
* @version 2.0
*/
public final class ShieldofArravBook extends Book {
/**
* Represents the shield of arrav book id.
*/
public static int ID = 49610758;
/**
* Represents the array of pages for this book.
*/
private static final PageSet[] PAGES = new PageSet[] { new PageSet(new Page(new BookLine("The Shield of Arrav", 55), new BookLine("by A.R Wright", 57), new BookLine("Arrav is probably the best", 61), new BookLine("known hero of the 4th", 62), new BookLine("age. Many legends are", 63), new BookLine("told of his heroics. One", 64), new BookLine("surviving artefact from", 65)), new Page(new BookLine("the 4th age is a fabulous", 66), new BookLine("shield.", 67), new BookLine("This shield is believed to", 69), new BookLine("have once belonged to", 70), new BookLine("Arrav and is now indeed", 71), new BookLine("known as the Shield of", 72), new BookLine("Arrav. For over 150", 73), new BookLine("years it was the prize", 74), new BookLine("piece in the royal", 75), new BookLine("museum of Varrock.", 76))), new PageSet(new Page(new BookLine("However, in the year 143", 55), new BookLine("of the fith age a gang of", 56), new BookLine("thieves called the Phoenix", 57), new BookLine("Gang broke into the", 58), new BookLine("museum and stole the", 59), new BookLine("shield in a daring raid. As", 60), new BookLine("a result, the current", 61), new BookLine("ruler, King Roald, put a", 62), new BookLine("1200 gold bounty (a", 63), new BookLine("massive sum of money in", 64), new BookLine("those days) on the return", 65)), new Page(new BookLine("of the shield, hoping that", 66), new BookLine("one of the culprits would", 67), new BookLine("betray his fellows out of", 68), new BookLine("greed.", 69))), new PageSet(new Page(new BookLine("This tactic did not work", 55), new BookLine("however, and the thieves", 56), new BookLine("who stole the shield have", 57), new BookLine("since gone on to become", 58), new BookLine("the most powerful crime", 59), new BookLine("gang in Varrock, despite", 60), new BookLine("making an enemy of the", 61), new BookLine("Royal Family many", 62), new BookLine("years ago.", 63)), new Page(new BookLine("The reward for the", 66), new BookLine("return of the shield still", 67), new BookLine("stands.", 68))) };
/**
* Constructs a new {@code ShieldofArravBook} {@code Object}.
*/
public ShieldofArravBook(final Player player) {
super(player, "The Shield of Arrav", ShieldofArrav.BOOK.getId(), PAGES);
}
/**
* Constructs a new {@code ShieldofArravBook} {@code Object}.
*/
public ShieldofArravBook() {
/**
* empty.
*/
}
@Override
public void finish() {
if (player.getQuestRepository().getQuest("Shield of Arrav").getStage(player) == 10) {
player.getQuestRepository().getQuest("Shield of Arrav").setStage(player, 20);
}
}
@Override
public void display(Page[] set) {
player.lock();
player.getInterfaceManager().open(getInterface());
for (int i = 55; i < 77; i++) {
player.getPacketDispatch().sendString("", getInterface().getId(), i);
}
player.getPacketDispatch().sendString(getName(), getInterface().getId(), 6);
player.getPacketDispatch().sendString("", getInterface().getId(), 77);
player.getPacketDispatch().sendString("", getInterface().getId(), 78);
for (Page page : set) {
for (BookLine line : page.getLines()) {
player.getPacketDispatch().sendString(line.getMessage(), getInterface().getId(), line.getChild());
}
}
player.getPacketDispatch().sendInterfaceConfig(getInterface().getId(), 51, index < 1 ? true : false);
boolean lastPage = index == sets.length - 1;
player.getPacketDispatch().sendInterfaceConfig(getInterface().getId(), 53, lastPage ? true : false);
if (lastPage) {
finish();
}
player.unlock();
}
@Override
public DialoguePlugin newInstance(Player player) {
return new ShieldofArravBook(player);
}
@Override
public int[] getIds() {
return new int[] { ID };
}
}
@@ -0,0 +1,105 @@
package content.region.misthalin.varrock.quest.shieldofarrav
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
/**
* Shield of Arrav Book
* @author ovenbreado
* @author 'Vexia
* @author Empathy
*/
class ShieldofArravBook : InteractionListener {
companion object {
private val TITLE = "Shield of Arrav"
private val CONTENTS = arrayOf(
PageSet(
Page(
BookLine("The Shield of Arrav", 55),
BookLine("by A.R Wright", 57),
BookLine("Arrav is probably the best", 61),
BookLine("known hero of the 4th", 62),
BookLine("age. Many legends are", 63),
BookLine("told of his heroics. One", 64),
BookLine("surviving artefact from", 65)
),
Page(
BookLine("the 4th age is a fabulous", 66),
BookLine("shield.", 67),
BookLine("This shield is believed to", 69),
BookLine("have once belonged to", 70),
BookLine("Arrav and is now indeed", 71),
BookLine("known as the Shield of", 72),
BookLine("Arrav. For over 150", 73),
BookLine("years it was the prize", 74),
BookLine("piece in the royal", 75),
BookLine("museum of Varrock.", 76)
)
),
PageSet(
Page(
BookLine("However, in the year 143", 55),
BookLine("of the fith age a gang of", 56),
BookLine("thieves called the Phoenix", 57),
BookLine("Gang broke into the", 58),
BookLine("museum and stole the", 59),
BookLine("shield in a daring raid. As", 60),
BookLine("a result, the current", 61),
BookLine("ruler, King Roald, put a", 62),
BookLine("1200 gold bounty (a", 63),
BookLine("massive sum of money in", 64),
BookLine("those days) on the return", 65)
),
Page(
BookLine("of the shield, hoping that", 66),
BookLine("one of the culprits would", 67),
BookLine("betray his fellows out of", 68),
BookLine("greed.", 69)
)
),
PageSet(
Page(
BookLine("This tactic did not work", 55),
BookLine("however, and the thieves", 56),
BookLine("who stole the shield have", 57),
BookLine("since gone on to become", 58),
BookLine("the most powerful crime", 59),
BookLine("gang in Varrock, despite", 60),
BookLine("making an enemy of the", 61),
BookLine("Royal Family many", 62),
BookLine("years ago.", 63)
),
Page(
BookLine("The reward for the", 66),
BookLine("return of the shield still", 67),
BookLine("stands.", 68)
)
)
)
private fun display(player: Player, pageNum: Int, buttonID: Int) : Boolean {
BookInterface.pageSetup(player, BookInterface.FANCY_BOOK_3_49, TITLE, CONTENTS)
if (BookInterface.isLastPage(pageNum, CONTENTS.size)) {
if (player.questRepository.getQuest("Shield of Arrav").getStage(player) == 10) {
player.questRepository.getQuest("Shield of Arrav").setStage(player, 20)
}
}
return true
}
}
override fun defineListeners() {
on(Items.BOOK_757, IntType.ITEM, "read") { player, _ ->
setAttribute(player, "bookInterfaceCallback", ::display)
setAttribute(player, "bookInterfaceCurrentPage", 0)
display(player, 0, 0)
return@on true
}
}
}
@@ -1,197 +0,0 @@
package core.game.dialogue.book;
import core.game.component.Component;
import core.game.dialogue.DialoguePlugin;
import core.game.dialogue.DialoguePlugin;
import core.game.node.entity.player.Player;
import core.plugin.PluginManifest;
import core.plugin.PluginType;
/**
* Represents a dialogue book.
* @author 'Vexia
* @date 1/1/14
*/
@PluginManifest(type = PluginType.DIALOGUE)
public abstract class Book extends DialoguePlugin {
/**
* Represents the component interface of the book.
*/
private static final Component INTERFACE = new Component(49);
/**
* Represents the red string.
*/
protected static final String RED = "<col=8A0808>";
/**
* Represents the blue string.
*/
protected static final String BLUE = "<col=08088A>";
/**
* Represents the name of the book.
*/
protected String name;
/**
* Represents the id of this book.
*/
protected int id;
/**
* Represents the pages of this book.
*/
protected PageSet[] sets;
/**
* Represents the index of the page set we're at.
*/
protected int index = -1;
/**
* Constructs a new {@code Book} {@code Object}.
* @param name the name.
* @param id the id.
*/
public Book(final Player player, final String name, final int id, final PageSet... sets) {
this.player = player;
this.name = name;
this.id = id;
this.sets = sets;
}
/**
* Constructs a new {@code Book} {@code Object}.
*/
public Book() {
/**
* empty.
*/
}
@Override
public boolean open(Object... args) {
return open(player);
}
@Override
public boolean handle(int interfaceId, int buttonId) {
switch (buttonId) {
case 112:
player.getInterfaceManager().close();
break;
case 66:
case 52:
next();
break;
case 64:
case 50:
previous();
break;
}
return true;
}
@Override
public Object fireEvent(String identifier, Object... args) {
return this;
}
/**
* Method used to open a book.
* @return <code>True</code> if succesfully opened.
*/
public boolean open(final Player player) {
next();
return true;
}
/**
* Method used to write the next dialogue.
*/
public void next() {
player.lock();
index++;
if (index > sets.length - 1) {
player.unlock();
player.getInterfaceManager().close();
return;
}
final Page[] set = sets[index].getPages();
display(set);
player.unlock();
}
/**
* Method used to write the previous dialogue.
*/
public void previous() {
player.lock();
index--;
if (index < 0) {
index = 0;
}
final Page[] set = sets[index].getPages();
display(set);
player.unlock();
}
/**
* Method used to display a set of pages.
* @param set the set.
*/
public void display(Page[] set) {
// TODO: It seems like different subclasses instantiate this by
// copy-paste, this should probably be made final, and should switch between a few
// implementations by component id
}
/**
* Method used when the book is finished.
*/
public void finish() {
}
/**
* Gets the name.
* @return The name.
*/
public String getName() {
return name;
}
/**
* Gets the id.
* @return The id.
*/
public int getId() {
return id;
}
/**
* Gets the index.
* @return The index.
*/
public int getIndex() {
return index;
}
/**
* Sets the index.
* @param index The index to set.
*/
public void setIndex(int index) {
this.index = index;
}
/**
* Gets the interface component.
* @return the component.
*/
public Component getInterface() {
return INTERFACE;
}
}
@@ -1,46 +0,0 @@
package core.game.dialogue.book;
/**
* Represents a book line.
* @author 'Vexia
* @date 31/12/2013
*/
public class BookLine {
/**
* Represents the message to display.
*/
private final String message;
/**
* Represents the child if of the line.
*/
private final int child;
/**
* Constructs a new {@code Page} {@code Object}.
* @param message the message.
* @param child the child.
*/
public BookLine(final String message, final int child) {
this.message = message;
this.child = child;
}
/**
* Gets the message.
* @return The message.
*/
public String getMessage() {
return message;
}
/**
* Gets the child.
* @return The child.
*/
public int getChild() {
return child;
}
}
@@ -1,31 +0,0 @@
package core.game.dialogue.book;
/**
* Represents a page on a book.
* @author 'Vexia
* @date 1/1/14
*/
public class Page {
/**
* Represents the lines on a page.
*/
private final BookLine[] lines;
/**
* Constructs a new {@code Page} {@code Object}.
* @param lines the lines.
*/
public Page(BookLine... lines) {
this.lines = lines;
}
/**
* Gets the lines.
* @return The lines.
*/
public BookLine[] getLines() {
return lines;
}
}
@@ -1,29 +0,0 @@
package core.game.dialogue.book;
/**
* Represents a set of pages on a book.
* @author 'Vexia
*/
public class PageSet {
/**
* Represents the set of pages.
*/
private final Page[] pages;
/**
* Constructs a new {@code PageSet} {@code Object}.
* @param pages the pages.
*/
public PageSet(final Page... pages) {
this.pages = pages;
}
/**
* Gets the pages.
* @return The pages.
*/
public Page[] getPages() {
return pages;
}
}
@@ -1,17 +1,20 @@
package core.game.system.command.sets
import core.game.component.Component
import content.data.BossKillCounter
import content.global.activity.ttrail.TreasureTrailManager
import content.global.handlers.iface.BookInterface
import content.global.handlers.iface.Page
import content.global.handlers.iface.PageSet
import content.global.skill.slayer.SlayerManager
import core.api.setAttribute
import core.game.node.entity.player.Player
import core.plugin.Initializable
import org.rs09.consts.Items;
import org.rs09.consts.NPCs;
import core.api.utils.GlobalKillCounter;
import core.game.interaction.InterfaceListener
import org.rs09.consts.Items
import org.rs09.consts.NPCs
import core.api.utils.GlobalKillCounter
import core.game.system.command.Privilege
import core.game.world.repository.Repository
import java.util.*
val TUROTH_IDS = intArrayOf(NPCs.TUROTH_1622, NPCs.TUROTH_1623, NPCs.TUROTH_1626, NPCs.TUROTH_1627, NPCs.TUROTH_1628, NPCs.TUROTH_1629, NPCs.TUROTH_1630)
val KURASK_IDS = intArrayOf(NPCs.KURASK_1608, NPCs.KURASK_1609, NPCs.KURASK_4229, NPCs.KURASK_7811)
@@ -27,193 +30,169 @@ val STEEL_DRAGON_IDS = intArrayOf(NPCs.STEEL_DRAGON_1592, NPCs.STEEL_DRAGON_3590
val MITHRIL_DRAGON_IDS = intArrayOf(NPCs.MITHRIL_DRAGON_5363, NPCs.MITHRIL_DRAGON_8424)
val SKELETAL_WYVERN_IDS = intArrayOf(NPCs.SKELETAL_WYVERN_3068, NPCs.SKELETAL_WYVERN_3069, NPCs.SKELETAL_WYVERN_3070, NPCs.SKELETAL_WYVERN_3071)
val SPACER = "<str> </str>";
val NUM_PAGES = 3
fun sendStats(player: Player, other: Player, page: Int){
prepareInterface(player, other, page)
val globalData = other.savedData.globalData
for(i in (68..97)) {
when(page) {
0 -> {
when(i) {
//Various stats
97 -> sendLine(player,"Easy Clues: ${TreasureTrailManager.getInstance(other).completedClues[0]}",i)
68 -> sendLine(player,"Medium Clues: ${TreasureTrailManager.getInstance(other).completedClues[1]}",i)
69 -> sendLine(player,"Hard Clues: ${TreasureTrailManager.getInstance(other).completedClues[2]}",i)
70 -> sendLine(player, SPACER,i)
71 -> sendLine(player,"Slayer Tasks: ${SlayerManager.getInstance(other).flags.completedTasks}",i)
72 -> sendLine(player,"Quest Points: ${other.questRepository.points}",i)
73 -> sendLine(player,"Ironman Mode: ${other.ironmanManager.mode.name.toLowerCase()}",i)
74 -> sendLine(player,"Deaths: ${other.getAttribute("$STATS_BASE:$STATS_DEATHS",0)}",i)
75 -> sendLine(player, SPACER,i)
76 -> sendLine(player,"Logs Chopped: ${other.getAttribute("$STATS_BASE:$STATS_LOGS",0)}",i)
77 -> sendLine(player,"Rocks Mined: ${other.getAttribute("$STATS_BASE:$STATS_ROCKS",0)}",i)
78 -> sendLine(player,"Fish Caught: ${other.getAttribute("$STATS_BASE:$STATS_FISH",0)}",i)
79 -> sendLine(player, "Essence Crafted: ${other.getAttribute("$STATS_BASE:$STATS_RC",0)}", i)
//Boss KC
82 -> sendLine(player, "KBD KC: ${globalData.bossCounters.get(BossKillCounter.KING_BLACK_DRAGON.ordinal)}",i)
83 -> sendLine(player, "TDs KC: ${globalData.bossCounters.get(BossKillCounter.TORMENTED_DEMONS.ordinal)}",i)
84 -> sendLine(player, "Supreme KC: ${globalData.bossCounters.get(BossKillCounter.DAGANNOTH_SUPREME.ordinal)}",i)
85 -> sendLine(player, "Rex KC: ${globalData.bossCounters.get(BossKillCounter.DAGANNOTH_REX.ordinal)}",i)
86 -> sendLine(player, "Prime KC: ${globalData.bossCounters.get(BossKillCounter.DAGANNOTH_PRIME.ordinal)}",i)
87 -> sendLine(player, "Barrows KC: ${globalData.barrowsLoots}",i)
88 -> sendLine(player, "Chaos Ele: ${globalData.bossCounters.get(BossKillCounter.CHAOS_ELEMENTAL.ordinal)}",i)
89 -> sendLine(player, "Mole KC: ${globalData.bossCounters.get(BossKillCounter.GIANT_MOLE.ordinal)}",i)
90 -> sendLine(player, "Sara KC: ${globalData.bossCounters.get(BossKillCounter.SARADOMIN.ordinal)}",i)
91 -> sendLine(player, "Zammy KC: ${globalData.bossCounters.get(BossKillCounter.ZAMORAK.ordinal)}",i)
92 -> sendLine(player, "Bandos KC: ${globalData.bossCounters.get(BossKillCounter.BANDOS.ordinal)}",i)
93 -> sendLine(player, "Arma KC: ${globalData.bossCounters.get(BossKillCounter.ARMADYL.ordinal)}",i)
94 -> sendLine(player, "Jad KC: ${globalData.bossCounters.get(BossKillCounter.JAD.ordinal)}",i)
95 -> sendLine(player, "KQ KC: ${globalData.bossCounters.get(BossKillCounter.KALPHITE_QUEEN.ordinal)}",i)
96 -> sendLine(player, "Corp KC: ${globalData.bossCounters.get(BossKillCounter.CORPOREAL_BEAST.ordinal)}",i)
else -> sendLine(player,"",i)
}
}
1 -> {
when(i) {
97 -> sendLine(player, "Turoths: ${GlobalKillCounter.getKills(other, TUROTH_IDS)}", i)
68 -> sendLine(player, "Kurasks: ${GlobalKillCounter.getKills(other, KURASK_IDS)}", i)
69 -> sendLine(player, "Leaf-bladed swords: ${GlobalKillCounter.getRareDrops(other, Items.LEAF_BLADED_SWORD_13290)}", i)
70 -> sendLine(player, SPACER,i)
71 -> sendLine(player, "Gargoyles: ${GlobalKillCounter.getKills(other, GARGOYLE_IDS)}", i)
72 -> sendLine(player, "Granite mauls: ${GlobalKillCounter.getRareDrops(other, Items.GRANITE_MAUL_4153)}", i)
73 -> sendLine(player, SPACER,i)
74 -> sendLine(player, "Spiritual mages: ${GlobalKillCounter.getKills(other, SPIRITUAL_MAGE_IDS)}", i)
75 -> sendLine(player, "Dragon boots: ${GlobalKillCounter.getRareDrops(other, Items.DRAGON_BOOTS_11732)}", i)
76 -> sendLine(player, SPACER,i)
77 -> sendLine(player, "Abyssal demons: ${GlobalKillCounter.getKills(other, NPCs.ABYSSAL_DEMON_1615)}", i)
78 -> sendLine(player, "Abyssal whips: ${GlobalKillCounter.getRareDrops(other, Items.ABYSSAL_WHIP_4151)}", i)
79 -> sendLine(player, SPACER,i)
80 -> sendLine(player, "Dark beasts: ${GlobalKillCounter.getKills(other, NPCs.DARK_BEAST_2783)}", i)
81 -> sendLine(player, "Dark bows: ${GlobalKillCounter.getRareDrops(other, Items.DARK_BOW_11235)}", i)
82 -> sendLine(player, "Green Dragons: ${GlobalKillCounter.getKills(other, GREEN_DRAGON_IDS)}", i)
83 -> sendLine(player, "Blue Dragons: ${GlobalKillCounter.getKills(other, BLUE_DRAGON_IDS)}", i)
84 -> sendLine(player, "Red Dragons: ${GlobalKillCounter.getKills(other, RED_DRAGON_IDS)}", i)
85 -> sendLine(player, "Black Dragons: ${GlobalKillCounter.getKills(other, BLACK_DRAGON_IDS)}", i)
86 -> sendLine(player, SPACER,i)
87 -> sendLine(player, "Bronze Dragons: ${GlobalKillCounter.getKills(other, BRONZE_DRAGON_IDS)}", i)
88 -> sendLine(player, "Iron Dragons: ${GlobalKillCounter.getKills(other, IRON_DRAGON_IDS)}", i)
89 -> sendLine(player, "Steel Dragons: ${GlobalKillCounter.getKills(other, STEEL_DRAGON_IDS)}", i)
90 -> sendLine(player, "Mithril Dragons: ${GlobalKillCounter.getKills(other, MITHRIL_DRAGON_IDS)}", i)
91 -> sendLine(player, "Skeletal Wyverns: ${GlobalKillCounter.getKills(other, SKELETAL_WYVERN_IDS)}", i)
92 -> sendLine(player, SPACER,i)
93 -> sendLine(player, "Draconic visages: ${GlobalKillCounter.getRareDrops(other, Items.DRACONIC_VISAGE_11286)}", i)
else -> sendLine(player,"",i)
}
}
2 -> {
when(i) {
97 -> sendLine(player, "Ahrim's hood: ${GlobalKillCounter.getRareDrops(other, Items.AHRIMS_HOOD_4708)}", i)
68 -> sendLine(player, "Ahrim's staff: ${GlobalKillCounter.getRareDrops(other, Items.AHRIMS_STAFF_4710)}", i)
69 -> sendLine(player, "Ahrim's robetop: ${GlobalKillCounter.getRareDrops(other, Items.AHRIMS_ROBETOP_4712)}", i)
70 -> sendLine(player, "Ahrim's robeskirt: ${GlobalKillCounter.getRareDrops(other, Items.AHRIMS_ROBESKIRT_4714)}", i)
71 -> sendLine(player, SPACER,i)
72 -> sendLine(player, "Dharok's helm: ${GlobalKillCounter.getRareDrops(other, Items.DHAROKS_HELM_4716)}", i)
73 -> sendLine(player, "Dharok's greataxe: ${GlobalKillCounter.getRareDrops(other, Items.DHAROKS_GREATAXE_4718)}", i)
74 -> sendLine(player, "Dharok's platebody: ${GlobalKillCounter.getRareDrops(other, Items.DHAROKS_PLATEBODY_4720)}", i)
75 -> sendLine(player, "Dharok's platelegs: ${GlobalKillCounter.getRareDrops(other, Items.DHAROKS_PLATELEGS_4722)}", i)
76 -> sendLine(player, SPACER,i)
77 -> sendLine(player, "Guthan's helm: ${GlobalKillCounter.getRareDrops(other, Items.GUTHANS_HELM_4724)}", i)
78 -> sendLine(player, "Guthan's warspear: ${GlobalKillCounter.getRareDrops(other, Items.GUTHANS_WARSPEAR_4726)}", i)
79 -> sendLine(player, "Guthan's platebody: ${GlobalKillCounter.getRareDrops(other, Items.GUTHANS_PLATEBODY_4728)}", i)
80 -> sendLine(player, "Guthan's chainskirt: ${GlobalKillCounter.getRareDrops(other, Items.GUTHANS_CHAINSKIRT_4730)}", i)
82 -> sendLine(player, "Karil's coif: ${GlobalKillCounter.getRareDrops(other, Items.KARILS_COIF_4732)}", i)
83 -> sendLine(player, "Karil's crossbow: ${GlobalKillCounter.getRareDrops(other, Items.KARILS_CROSSBOW_4734)}", i)
84 -> sendLine(player, "Karil's leathertop: ${GlobalKillCounter.getRareDrops(other, Items.KARILS_LEATHERTOP_4736)}", i)
85 -> sendLine(player, "Karil's leatherskirt: ${GlobalKillCounter.getRareDrops(other, Items.KARILS_LEATHERSKIRT_4738)}", i)
86 -> sendLine(player, SPACER,i)
87 -> sendLine(player, "Torag's helm: ${GlobalKillCounter.getRareDrops(other, Items.TORAGS_HELM_4745)}", i)
88 -> sendLine(player, "Torag's hammers: ${GlobalKillCounter.getRareDrops(other, Items.TORAGS_HAMMERS_4747)}", i)
89 -> sendLine(player, "Torag's platebody: ${GlobalKillCounter.getRareDrops(other, Items.TORAGS_PLATEBODY_4749)}", i)
90 -> sendLine(player, "Torag's platelegs: ${GlobalKillCounter.getRareDrops(other, Items.TORAGS_PLATELEGS_4751)}", i)
91 -> sendLine(player, SPACER,i)
92 -> sendLine(player, "Verac's helm: ${GlobalKillCounter.getRareDrops(other, Items.VERACS_HELM_4753)}", i)
93 -> sendLine(player, "Verac's flail: ${GlobalKillCounter.getRareDrops(other, Items.VERACS_FLAIL_4755)}", i)
94 -> sendLine(player, "Verac's brassard: ${GlobalKillCounter.getRareDrops(other, Items.VERACS_BRASSARD_4757)}", i)
95 -> sendLine(player, "Verac's plateskirt: ${GlobalKillCounter.getRareDrops(other, Items.VERACS_PLATESKIRT_4759)}", i)
else -> sendLine(player,"",i)
}
}
}
}
player.interfaceManager.open(Component(26))
}
fun sendLine(player: Player, line: String, child: Int) {
player.packetDispatch.sendString(line,26,child)
}
fun prepareInterface(player: Player,other: Player, page: Int){
player.setAttribute("stats-page-info", StatsPageInfo(other, page))
if(page == 0) {
player.packetDispatch.sendInterfaceConfig(26,62,true)
player.packetDispatch.sendInterfaceConfig(26,65,true)
} else {
sendLine(player, "Previous", 65)
}
if(page == NUM_PAGES - 1) {
player.packetDispatch.sendInterfaceConfig(26,64,true)
player.packetDispatch.sendInterfaceConfig(26,66,true)
} else {
sendLine(player, "Next", 66)
}
player.packetDispatch.sendString(other.username + "'s Stats - Page ${page + 1}",26,101)
}
data class StatsPageInfo(val other: Player, val page: Int) {}
val SPACER = "<str> </str>"
val FAKE_CONTENT = arrayOf(
PageSet(Page(), Page()),
PageSet(Page(), Page()),
PageSet(Page(), Page()),
)
@Initializable
class StatsCommandSet : CommandSet(Privilege.STANDARD) {
override fun defineCommands() {
define("stats"){player,args ->
if(args.size == 1){
sendStats(player)
return@define
companion object {
private fun display(player: Player, pageNum: Int, buttonId: Int) : Boolean {
val queryPlayer: Player? = player.getAttribute("stats-command-query-player", null)
if (queryPlayer == null) {
return false
}
val globalData = queryPlayer.globalData
BookInterface.pageSetup(player, BookInterface.FANCY_BOOK_26,queryPlayer.username + "'s Stats", FAKE_CONTENT)
for(i in (68..97)) {
when(pageNum) {
0 -> {
when(i) {
//Various stats
97 -> sendLine(player,"Easy Clues: ${TreasureTrailManager.getInstance(queryPlayer).completedClues[0]}",i)
68 -> sendLine(player,"Medium Clues: ${TreasureTrailManager.getInstance(queryPlayer).completedClues[1]}",i)
69 -> sendLine(player,"Hard Clues: ${TreasureTrailManager.getInstance(queryPlayer).completedClues[2]}",i)
70 -> sendLine(player, SPACER,i)
71 -> sendLine(player,"Slayer Tasks: ${SlayerManager.getInstance(queryPlayer).flags.completedTasks}",i)
72 -> sendLine(player,"Quest Points: ${queryPlayer.questRepository.points}",i)
73 -> sendLine(player,"Ironman Mode: ${queryPlayer.ironmanManager.mode.name.lowercase(Locale.getDefault())}",i)
74 -> sendLine(player,"Deaths: ${queryPlayer.getAttribute("$STATS_BASE:$STATS_DEATHS",0)}",i)
75 -> sendLine(player, SPACER,i)
76 -> sendLine(player,"Logs Chopped: ${queryPlayer.getAttribute("$STATS_BASE:$STATS_LOGS",0)}",i)
77 -> sendLine(player,"Rocks Mined: ${queryPlayer.getAttribute("$STATS_BASE:$STATS_ROCKS",0)}",i)
78 -> sendLine(player,"Fish Caught: ${queryPlayer.getAttribute("$STATS_BASE:$STATS_FISH",0)}",i)
79 -> sendLine(player, "Essence Crafted: ${queryPlayer.getAttribute("$STATS_BASE:$STATS_RC",0)}", i)
//Boss KC
82 -> sendLine(player, "KBD KC: ${globalData.bossCounters.get(BossKillCounter.KING_BLACK_DRAGON.ordinal)}",i)
83 -> sendLine(player, "TDs KC: ${globalData.bossCounters.get(BossKillCounter.TORMENTED_DEMONS.ordinal)}",i)
84 -> sendLine(player, "Supreme KC: ${globalData.bossCounters.get(BossKillCounter.DAGANNOTH_SUPREME.ordinal)}",i)
85 -> sendLine(player, "Rex KC: ${globalData.bossCounters.get(BossKillCounter.DAGANNOTH_REX.ordinal)}",i)
86 -> sendLine(player, "Prime KC: ${globalData.bossCounters.get(BossKillCounter.DAGANNOTH_PRIME.ordinal)}",i)
87 -> sendLine(player, "Barrows KC: ${globalData.barrowsLoots}",i)
88 -> sendLine(player, "Chaos Ele: ${globalData.bossCounters.get(BossKillCounter.CHAOS_ELEMENTAL.ordinal)}",i)
89 -> sendLine(player, "Mole KC: ${globalData.bossCounters.get(BossKillCounter.GIANT_MOLE.ordinal)}",i)
90 -> sendLine(player, "Sara KC: ${globalData.bossCounters.get(BossKillCounter.SARADOMIN.ordinal)}",i)
91 -> sendLine(player, "Zammy KC: ${globalData.bossCounters.get(BossKillCounter.ZAMORAK.ordinal)}",i)
92 -> sendLine(player, "Bandos KC: ${globalData.bossCounters.get(BossKillCounter.BANDOS.ordinal)}",i)
93 -> sendLine(player, "Arma KC: ${globalData.bossCounters.get(BossKillCounter.ARMADYL.ordinal)}",i)
94 -> sendLine(player, "Jad KC: ${globalData.bossCounters.get(BossKillCounter.JAD.ordinal)}",i)
95 -> sendLine(player, "KQ KC: ${globalData.bossCounters.get(BossKillCounter.KALPHITE_QUEEN.ordinal)}",i)
96 -> sendLine(player, "Corp KC: ${globalData.bossCounters.get(BossKillCounter.CORPOREAL_BEAST.ordinal)}",i)
else -> sendLine(player,"",i)
}
}
1 -> {
when(i) {
97 -> sendLine(player, "Turoths: ${GlobalKillCounter.getKills(queryPlayer, TUROTH_IDS)}", i)
68 -> sendLine(player, "Kurasks: ${GlobalKillCounter.getKills(queryPlayer, KURASK_IDS)}", i)
69 -> sendLine(player, "Leaf-bladed swords: ${GlobalKillCounter.getRareDrops(queryPlayer, Items.LEAF_BLADED_SWORD_13290)}", i)
70 -> sendLine(player, SPACER,i)
71 -> sendLine(player, "Gargoyles: ${GlobalKillCounter.getKills(queryPlayer, GARGOYLE_IDS)}", i)
72 -> sendLine(player, "Granite mauls: ${GlobalKillCounter.getRareDrops(queryPlayer, Items.GRANITE_MAUL_4153)}", i)
73 -> sendLine(player, SPACER,i)
74 -> sendLine(player, "Spiritual mages: ${GlobalKillCounter.getKills(queryPlayer, SPIRITUAL_MAGE_IDS)}", i)
75 -> sendLine(player, "Dragon boots: ${GlobalKillCounter.getRareDrops(queryPlayer, Items.DRAGON_BOOTS_11732)}", i)
76 -> sendLine(player, SPACER,i)
77 -> sendLine(player, "Abyssal demons: ${GlobalKillCounter.getKills(queryPlayer, NPCs.ABYSSAL_DEMON_1615)}", i)
78 -> sendLine(player, "Abyssal whips: ${GlobalKillCounter.getRareDrops(queryPlayer, Items.ABYSSAL_WHIP_4151)}", i)
79 -> sendLine(player, SPACER,i)
80 -> sendLine(player, "Dark beasts: ${GlobalKillCounter.getKills(queryPlayer, NPCs.DARK_BEAST_2783)}", i)
81 -> sendLine(player, "Dark bows: ${GlobalKillCounter.getRareDrops(queryPlayer, Items.DARK_BOW_11235)}", i)
82 -> sendLine(player, "Green Dragons: ${GlobalKillCounter.getKills(queryPlayer, GREEN_DRAGON_IDS)}", i)
83 -> sendLine(player, "Blue Dragons: ${GlobalKillCounter.getKills(queryPlayer, BLUE_DRAGON_IDS)}", i)
84 -> sendLine(player, "Red Dragons: ${GlobalKillCounter.getKills(queryPlayer, RED_DRAGON_IDS)}", i)
85 -> sendLine(player, "Black Dragons: ${GlobalKillCounter.getKills(queryPlayer, BLACK_DRAGON_IDS)}", i)
86 -> sendLine(player, SPACER,i)
87 -> sendLine(player, "Bronze Dragons: ${GlobalKillCounter.getKills(queryPlayer, BRONZE_DRAGON_IDS)}", i)
88 -> sendLine(player, "Iron Dragons: ${GlobalKillCounter.getKills(queryPlayer, IRON_DRAGON_IDS)}", i)
89 -> sendLine(player, "Steel Dragons: ${GlobalKillCounter.getKills(queryPlayer, STEEL_DRAGON_IDS)}", i)
90 -> sendLine(player, "Mithril Dragons: ${GlobalKillCounter.getKills(queryPlayer, MITHRIL_DRAGON_IDS)}", i)
91 -> sendLine(player, "Skeletal Wyverns: ${GlobalKillCounter.getKills(queryPlayer, SKELETAL_WYVERN_IDS)}", i)
92 -> sendLine(player, SPACER,i)
93 -> sendLine(player, "Draconic visages: ${GlobalKillCounter.getRareDrops(queryPlayer, Items.DRACONIC_VISAGE_11286)}", i)
else -> sendLine(player,"",i)
}
}
2 -> {
when(i) {
97 -> sendLine(player, "Ahrim's hood: ${GlobalKillCounter.getRareDrops(queryPlayer, Items.AHRIMS_HOOD_4708)}", i)
68 -> sendLine(player, "Ahrim's staff: ${GlobalKillCounter.getRareDrops(queryPlayer, Items.AHRIMS_STAFF_4710)}", i)
69 -> sendLine(player, "Ahrim's robetop: ${GlobalKillCounter.getRareDrops(queryPlayer, Items.AHRIMS_ROBETOP_4712)}", i)
70 -> sendLine(player, "Ahrim's robeskirt: ${GlobalKillCounter.getRareDrops(queryPlayer, Items.AHRIMS_ROBESKIRT_4714)}", i)
71 -> sendLine(player, SPACER,i)
72 -> sendLine(player, "Dharok's helm: ${GlobalKillCounter.getRareDrops(queryPlayer, Items.DHAROKS_HELM_4716)}", i)
73 -> sendLine(player, "Dharok's greataxe: ${GlobalKillCounter.getRareDrops(queryPlayer, Items.DHAROKS_GREATAXE_4718)}", i)
74 -> sendLine(player, "Dharok's platebody: ${GlobalKillCounter.getRareDrops(queryPlayer, Items.DHAROKS_PLATEBODY_4720)}", i)
75 -> sendLine(player, "Dharok's platelegs: ${GlobalKillCounter.getRareDrops(queryPlayer, Items.DHAROKS_PLATELEGS_4722)}", i)
76 -> sendLine(player, SPACER,i)
77 -> sendLine(player, "Guthan's helm: ${GlobalKillCounter.getRareDrops(queryPlayer, Items.GUTHANS_HELM_4724)}", i)
78 -> sendLine(player, "Guthan's warspear: ${GlobalKillCounter.getRareDrops(queryPlayer, Items.GUTHANS_WARSPEAR_4726)}", i)
79 -> sendLine(player, "Guthan's platebody: ${GlobalKillCounter.getRareDrops(queryPlayer, Items.GUTHANS_PLATEBODY_4728)}", i)
80 -> sendLine(player, "Guthan's chainskirt: ${GlobalKillCounter.getRareDrops(queryPlayer, Items.GUTHANS_CHAINSKIRT_4730)}", i)
82 -> sendLine(player, "Karil's coif: ${GlobalKillCounter.getRareDrops(queryPlayer, Items.KARILS_COIF_4732)}", i)
83 -> sendLine(player, "Karil's crossbow: ${GlobalKillCounter.getRareDrops(queryPlayer, Items.KARILS_CROSSBOW_4734)}", i)
84 -> sendLine(player, "Karil's leathertop: ${GlobalKillCounter.getRareDrops(queryPlayer, Items.KARILS_LEATHERTOP_4736)}", i)
85 -> sendLine(player, "Karil's leatherskirt: ${GlobalKillCounter.getRareDrops(queryPlayer, Items.KARILS_LEATHERSKIRT_4738)}", i)
86 -> sendLine(player, SPACER,i)
87 -> sendLine(player, "Torag's helm: ${GlobalKillCounter.getRareDrops(queryPlayer, Items.TORAGS_HELM_4745)}", i)
88 -> sendLine(player, "Torag's hammers: ${GlobalKillCounter.getRareDrops(queryPlayer, Items.TORAGS_HAMMERS_4747)}", i)
89 -> sendLine(player, "Torag's platebody: ${GlobalKillCounter.getRareDrops(queryPlayer, Items.TORAGS_PLATEBODY_4749)}", i)
90 -> sendLine(player, "Torag's platelegs: ${GlobalKillCounter.getRareDrops(queryPlayer, Items.TORAGS_PLATELEGS_4751)}", i)
91 -> sendLine(player, SPACER,i)
92 -> sendLine(player, "Verac's helm: ${GlobalKillCounter.getRareDrops(queryPlayer, Items.VERACS_HELM_4753)}", i)
93 -> sendLine(player, "Verac's flail: ${GlobalKillCounter.getRareDrops(queryPlayer, Items.VERACS_FLAIL_4755)}", i)
94 -> sendLine(player, "Verac's brassard: ${GlobalKillCounter.getRareDrops(queryPlayer, Items.VERACS_BRASSARD_4757)}", i)
95 -> sendLine(player, "Verac's plateskirt: ${GlobalKillCounter.getRareDrops(queryPlayer, Items.VERACS_PLATESKIRT_4759)}", i)
else -> sendLine(player,"",i)
}
}
}
}
return true
}
fun sendLine(player: Player, line: String, child: Int) {
player.packetDispatch.sendString(line ,BookInterface.FANCY_BOOK_26, child)
}
}
override fun defineCommands() {
define("stats"){ player, args ->
// Bad number of args
if(args.size > 2){
reject(player,"Usage: ::stats playername")
return@define
}
val other = Repository.getPlayerByName(args[1])
if(other == null){
// If stats is called without a username, return self.
var queryPlayer: Player? = null
if(args.size == 1){
queryPlayer = player
}
// If stats is called with a username, find the player or set to null.
if(args.size == 2) {
queryPlayer = Repository.getPlayerByName(args[1])
}
// If main player is not found, return error.
if(queryPlayer == null){
reject(player,"Invalid player or player not online.")
return@define
}
sendStats(player,other, 0)
}
}
fun sendStats(player: Player){
sendStats(player,player, 0)
}
}
class StatsInterface : InterfaceListener {
val COMPONENT_ID = 26
override fun defineInterfaceListeners() {
on(COMPONENT_ID, 61) { player, _, _, _, _, _ ->
val info: StatsPageInfo? = player.getAttribute("stats-page-info", null)
if(info != null) {
sendStats(player, info.other, info.page-1)
}
return@on true
}
on(COMPONENT_ID, 63) { player, _, _, _, _, _ ->
val info: StatsPageInfo? = player.getAttribute("stats-page-info", null)
if(info != null) {
sendStats(player, info.other, info.page+1)
}
return@on true
setAttribute(player, "bookInterfaceCallback", ::display)
setAttribute(player, "bookInterfaceCurrentPage", 0)
setAttribute(player, "stats-command-query-player", queryPlayer)
display(player, 0, 0)
return@define
}
}
}