1package com.osroyale.content;
3import com.osroyale.game.world.World;
4import com.osroyale.game.world.entity.mob.player.Player;
5import com.osroyale.game.world.entity.mob.player.PlayerRight;
6import com.osroyale.game.world.items.Item;
7import com.osroyale.game.world.items.ItemDefinition;
8import com.osroyale.game.world.position.Area;
9import com.osroyale.net.packet.out.SendItemOnInterface;
10import com.osroyale.net.packet.out.SendMessage;
11import com.osroyale.net.packet.out.SendScrollbar;
12import com.osroyale.net.packet.out.SendString;
13import com.osroyale.util.MessageColor;
14import com.osroyale.util.Utility;
16import java.util.Arrays;
17import java.util.Optional;
59public enum RoyaltyReward {
70 private final int level;
71 private final Item reward;
73 RoyaltyReward(
int level, Item reward) {
78 public int getLevel() {
82 public Item getReward() {
86 public static Optional<RoyaltyReward> forLevel(
int level) {
87 return Arrays.stream(values()).filter(a -> a.level == level).findAny();
90 public static Optional<RoyaltyReward> forOrdinal(
int ordinal) {
91 return Arrays.stream(values()).filter(a -> a.ordinal() == ordinal).findAny();
102 player.royalty += increment;
103 String suffix = increment > 1 ?
"s" :
"";
105 int royalty = player.royalty;
106 boolean levelUp = royalty >= 100;
109 player.royaltyLevel++;
112 +
"</col> has just reached prestige <col=9E4629>" + player.royaltyLevel +
"</col>.");
115 player.send(
new SendMessage(
"You have just received <col=9E4629>" + increment +
"</col> royalty point"
116 + (suffix) +
". You now have <col=9E4629>" + player.royalty +
"</col> point"
117 + (player.royalty > 1 ?
"s" :
"") +
" and are level <col=9E4629>" + player.royaltyLevel +
"</col>."));
123 int item = reward.getReward().getId();
124 int amount = reward.getReward().getAmount() * player.royaltyLevel;
126 player.inventory.
addOrDrop(
new Item(item, amount));
134 if (
Area.inWilderness(player)) {
135 player.dialogueFactory.
sendStatement(
"You can not open a Royalty Program while in the wilderness!")
141 player.dialogueFactory.
sendStatement(
"You can not open a Royalty Program while in combat!").
execute();
145 if (player.playerAssistant.
busy()) {
146 player.dialogueFactory.
sendStatement(
"You can not open a Royalty Program right now!").
execute();
156 for (
int index = 0,
string = 37116; index < size; index++) {
158 Item item = perk.getReward();
159 int amount = player.royaltyLevel == 0 ? perk.getReward().getAmount()
160 : perk.getReward().getAmount() * player.royaltyLevel;
163 player.send(
new SendString(
"<col=3c50b2>Level: " + perk.getLevel(),
string++));
168 player.send(
new SendString(
"The Program rewards players for their activity in game. Every 30", 37111));
170 new SendString(
"minutes everyone is awarded 1 point. Points accumulate until 100 where", 37112));
172 new SendString(
"you gain a prestige level, points will be reset and you will be eligible", 37113));
174 new SendString(
"for the rewards again. Reward amounts are multiplied by prestige level.", 37114));
176 player.send(
new SendString(
"RP: " + player.royalty +
"\\nLevel:" + player.royaltyLevel, 37107));
177 player.send(
new SendString(
"Royalty Program", 37103));
180 player.interfaceManager.
open(37100);
static void append(Player player, int increment)
static void open(Player player)
static void append(Player player)
final DialogueFactory sendStatement(String... lines)
final DialogueFactory execute()
static void sendMessage(String... messages)
void open(int identification)
Combat< Player > getCombat()
static ItemDefinition get(int id)
void addOrDrop(List< Item > items)
static String formatDigits(final int amount)
static String getCrown(Player player)