RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
RoyalKingDialogue.java
1package com.osroyale.content.dialogue.impl;
2
3import com.osroyale.content.dialogue.Dialogue;
4import com.osroyale.content.dialogue.DialogueFactory;
5import com.osroyale.content.dialogue.Expression;
6import com.osroyale.content.store.Store;
7import com.osroyale.game.world.entity.mob.player.Player;
8import com.osroyale.net.packet.out.SendMessage;
9import com.osroyale.net.packet.out.SendURL;
10
40
41public class RoyalKingDialogue extends Dialogue {
42
43 private int index;
44
45 public RoyalKingDialogue(int index) {
46 this.index = index;
47 }
48
49 @Override
50 public void sendDialogues(DialogueFactory factory) {
51 if (index == 1) {
52 claim(factory);
53 factory.execute();
54 return;
55 }
56 if (index == 2) {
57 store(factory);
58 factory.execute();
59 return;
60 }
61 Player player = factory.getPlayer();
62 factory.sendNpcChat(5523, Expression.HAPPY, "Hello adventurer, how may I help you?");
63 factory.sendOption("Claim Purchase", () -> claim(factory), "Donator Information", () -> player.send(new SendURL("https://tarnishps.everythingrs.com/services/store")), "My donation statistics", () -> myStats(factory), "Open Store", () -> store(factory), "Nevermind", factory::clear);
64 factory.execute();
65 }
66
67 private void myStats(DialogueFactory factory) {
68 factory.sendStatement("Money spent: $" + factory.getPlayer().donation.getSpent(), "Current credits: " + factory.getPlayer().donation.getCredits());
69 }
70
71
72 private void claim(DialogueFactory factory) {
73 Player player = factory.getPlayer();
74 player.send(new SendMessage("Claiming is temporarily disabled until EverythingRS is replaced."));
75 /*new Thread(() -> {
76 try {
77 Donation[] donations = Donation.donations(
78 "V48tgd7OxwrvPMmZZbjkVt6qTYB2MrZ5sw6PD4DBJnM83zepnUlIT8DiFoND3BYEQjqxPamH", player.getName());
79 if (donations.length == 0) {
80 player.send(new SendMessage("You currently don't have any items waiting. You must donate first!"));
81 return;
82 }
83 if (donations[0].message != null) {
84 player.send(new SendMessage(donations[0].message));
85 return;
86 }
87 for (Donation donate : donations) {
88 player.inventory.add(new Item(donate.product_id, donate.product_amount));
89 }
90 player.send(new SendMessage("Thank you for donating!"));
91 } catch (Exception e) {
92 player.send(new SendMessage("Api Services are currently offline. Please check back shortly"));
93 e.printStackTrace();
94 }
95 }).start();*/
96 }
97
98
99 private void store(DialogueFactory factory) {
100 factory.sendOption("Open Donator Store", () -> Store.STORES.get("Donator Store").open(factory.getPlayer()), "Ironman Donator Store", () -> Store.STORES.get("Ironman Donator Store").open(factory.getPlayer()),"Nevermind", factory::clear);
101 }
102}
final DialogueFactory sendStatement(String... lines)
final DialogueFactory sendOption(String option1, Runnable action1, String option2, Runnable action2)
final DialogueFactory sendNpcChat(int id, String... lines)