RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.content.dialogue.impl.VoteDialogue Class Reference

Handles the vote dialogue. More...

Inheritance diagram for com.runehive.content.dialogue.impl.VoteDialogue:
Collaboration diagram for com.runehive.content.dialogue.impl.VoteDialogue:

Public Member Functions

void sendDialogues (DialogueFactory factory)
 Sends a player a dialogue.

Private Member Functions

void exchange (DialogueFactory factory, int amount)
 Handles redeeming vote tokens.

Additional Inherited Members

Static Public Member Functions inherited from com.runehive.content.dialogue.Dialogue
static final boolean isDialogueButton (int button)
 Checks if the button triggered is an optional dialogue button.
Static Public Attributes inherited from com.runehive.content.dialogue.Dialogue
static final ImmutableList< Integer > DIALOGUE_BUTTONS = ImmutableList.of(2461, 2471, 2482, 2462, 2472, 2483, 2473, 2484, 2485, 2494, 2495, 2496, 2497, 2498)
 The action buttons responsible for dialogues.

Detailed Description

Handles the vote dialogue.

Author
Daniel

Definition at line 18 of file VoteDialogue.java.

Member Function Documentation

◆ exchange()

void com.runehive.content.dialogue.impl.VoteDialogue.exchange ( DialogueFactory factory,
int amount )
private

Handles redeeming vote tokens.

Definition at line 42 of file VoteDialogue.java.

42 {
43 Player player = factory.getPlayer();
44 if (amount > 10000) {
45 factory.sendNpcChat(7481, Expression.SAD, "Sorry but you can only exchange", " 10,000 tokens at a time!").execute();
46 return;
47 }
48
49 int tokenAmount = player.inventory.computeAmountForId(7478);
50
51 if (amount > tokenAmount)
52 amount = tokenAmount;
53
54 if (amount == 0) {
55 factory.sendNpcChat(7481, Expression.SAD, "Sorry but you do not have enough", "vote tokens to do this!").execute();
56 return;
57 }
58
59 player.votePoints += amount;
60 player.inventory.remove(7478, amount);
61 factory.sendNpcChat(7481, Expression.SAD, "I've exchanged " + amount + " vote tokens for you!", "You now have " + Utility.formatDigits(player.votePoints) + " vote points!").execute();
62 }

References com.runehive.game.world.items.containers.ItemContainer.computeAmountForId(), com.runehive.content.dialogue.DialogueFactory.execute(), com.runehive.util.Utility.formatDigits(), com.runehive.content.dialogue.DialogueFactory.getPlayer(), com.runehive.game.world.entity.mob.player.Player.inventory, com.runehive.game.world.items.containers.ItemContainer.remove(), com.runehive.content.dialogue.Expression.SAD, com.runehive.content.dialogue.DialogueFactory.sendNpcChat(), and com.runehive.game.world.entity.mob.player.Player.votePoints.

Referenced by sendDialogues().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ sendDialogues()

void com.runehive.content.dialogue.impl.VoteDialogue.sendDialogues ( DialogueFactory factory)

Sends a player a dialogue.

Parameters
factoryThe factory for this dialogue.

Reimplemented from com.runehive.content.dialogue.Dialogue.

Definition at line 21 of file VoteDialogue.java.

21 {
22 Player player = factory.getPlayer();
23 factory.sendNpcChat(7481, Expression.HAPPY, "Hello " + player.getName() + "!", "What can I do for you today?");
24
25 factory.sendOption("Would you want to know what are some of the benefits of voting are?", () -> {
26 factory.sendPlayerChat(Expression.HAPPY, "Yes I would!");
27 factory.sendNpcChat(7481, "Voting results in attracting new players!", "In return, you'll receive", "vote points that you can use to buy", "items from the vote store.");
28 }, "Exchange vote token", () -> {
29 World.schedule(1, () -> player.send(new SendInputAmount("How many vote tokens would you like to exchange?", 10, input -> exchange(factory, Integer.parseInt(input)))));
30 }, "Show me your voting store!", () -> {
31 Store.STORES.get("osroyale Vote Store").open(player);
32 }, "I would like to vote to support this great server!", () -> {
33 player.send(new SendURL("https://runehive.com"));
34 factory.sendNpcChat(7481, "Thank you for voting!");
35 }, "Nevermind, I don't want to do anything for this server.", () -> {
36 factory.clear();
37 });
38 factory.execute();
39 }

References com.runehive.content.dialogue.DialogueFactory.clear(), exchange(), com.runehive.content.dialogue.DialogueFactory.execute(), com.runehive.game.world.entity.mob.player.Player.getName(), com.runehive.content.dialogue.DialogueFactory.getPlayer(), com.runehive.content.dialogue.Expression.HAPPY, com.runehive.game.world.World.schedule(), com.runehive.game.world.entity.mob.player.Player.send(), com.runehive.content.dialogue.DialogueFactory.sendNpcChat(), com.runehive.content.dialogue.DialogueFactory.sendOption(), com.runehive.content.dialogue.DialogueFactory.sendPlayerChat(), and com.runehive.content.store.Store.STORES.

Here is the call graph for this function:

The documentation for this class was generated from the following file: