RuneHive-Game
Loading...
Searching...
No Matches
WellOfGoodwillDialogue.java
Go to the documentation of this file.
1package com.runehive.content.dialogue.impl;
2
3import com.runehive.content.WellOfGoodwill;
4import com.runehive.content.dialogue.Dialogue;
5import com.runehive.content.dialogue.DialogueFactory;
6import com.runehive.util.Utility;
7
8/**
9 * Created by Daniel on 2017-06-02.
10 */
11public class WellOfGoodwillDialogue extends Dialogue {
12
13 @Override
14 public void sendDialogues(DialogueFactory factory) {
15 factory.sendStatement("Greetings "+factory.getPlayer().getName()+".", "How may the well be of assistance today?").sendOption("How does this work?", () -> {
16 factory.onAction(() -> {
17 factory.sendStatement(
18 "Players may all contribute as much gold as they desire",
19 "towards the well. In return, once the well reaches",
20 Utility.formatDigits(WellOfGoodwill.MAXIMUM) + " the entire server will be granted").sendStatement(
21 "double experience for 30minutes.",
22 "After those 30 minutes the well will need to be replenished.",
23 "Well data is saved and stores during server restarts and shutdowns.",
24 "Ensuring safety for contributors."
25 ).execute();
26 });
27 }, "Check time left", () -> {
28 if (!WellOfGoodwill.isActive()) {
29 factory.sendStatement("").sendStatement("The well is not active!").execute();
30 return;
31 }
32 factory.sendStatement("").sendStatement("Time left: " + (30 - WellOfGoodwill.activeTime) + " minutes").execute();
33
34 }, "Check current status", () -> {
35 WellOfGoodwill.open(factory.getPlayer());
36 }, "Nevermind", factory::clear).execute();
37 }
38}
Handles contribution towards the well of goodwill.
static final int MAXIMUM
The maximum contribution limit for the well.
static void open(Player player)
Opens the well itemcontainer.
Represents a factory class that contains important functions for building dialogues.
final DialogueFactory execute()
Retrieves the next dialogue in the chain and executes it.
final DialogueFactory onAction(Runnable action)
Sets an action so this action can be executed after dialogues are done.
Player getPlayer()
The player that owns this factory.
final DialogueFactory sendStatement(String... lines)
Appends a StatementDialogue to the current dialogue chain.
final DialogueFactory sendOption(String option1, Runnable action1, String option2, Runnable action2)
Appends the OptionDialogue onto the current dialogue chain.
Represents an abstract dialogue, in which extending classes will be able to construct and send dialog...
Definition Dialogue.java:11
void sendDialogues(DialogueFactory factory)
Sends a player a dialogue.
String getName()
Gets the name of this entity.
Definition Player.java:774
Handles miscellaneous methods.
Definition Utility.java:27
static String formatDigits(final int amount)
Formats digits for integers.
Definition Utility.java:41