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:
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user