RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
CurrencyType.java
1package com.osroyale.content.store.currency;
2
3import com.google.common.collect.ImmutableSet;
4import com.osroyale.content.store.currency.impl.*;
5import com.osroyale.game.world.entity.mob.player.Player;
6import com.osroyale.util.Utility;
7
8import java.util.Arrays;
9import java.util.Optional;
10
63
64public enum CurrencyType {
65 COINS(0, new ItemCurrency(995)),
66 TOKKUL(1, new ItemCurrency(6529)),
67 BLOOD_MONEY(2, new ItemCurrency(13307)),
68 SLAYER_POINTS(4, new SlayerPointCurrency()),
69 PEST_POINTS(5, new PestPointCurrency()),
70 STARDUST(6, new ItemCurrency(25527)),
71 CLAN_POINTS(6, new ClanPointCurrency()),
72 LMS_POINTS(6, new LMSPointCurrency()),
73 VOTE_POINTS(7, new VotePointCurrency()),
74 PRESTIGE_POINTS(8, new PrestigePointCurrency()),
75 KOLODION_POINTS(9, new MageArenaCurrency()),
76 GRACEFUL_TOKEN(10, new ItemCurrency(11849)),
77 DONATOR_POINTS(11, new DonatorPointCurrency()),
78 SKILLING_POINTS(12, new SkillingPointCurrency()),
79 PLATINUM_TOKEN(13, new ItemCurrency(13204)),
80 ROYALE_TOKEN(14, new ItemCurrency(20527)),
81 PARAMAYA_TICKET(15, new ItemCurrency(620));
82
83 private static final ImmutableSet<CurrencyType> VALUES = ImmutableSet.copyOf(values());
84
85 public final Currency currency;
86
87 public final int id;
88
89 CurrencyType(int id, Currency currency) {
90 this.id = id;
91 this.currency = currency;
92
93 }
94
95 public static Optional<CurrencyType> lookup(int id) {
96 return Arrays.stream(values()).filter(it -> it.getId() == id).findFirst();
97 }
98
99 public int getId() {
100 return id;
101 }
102
103 public static boolean isCurrency(int id) {
104 return VALUES.stream().filter(i -> i.currency.tangible()).anyMatch(i -> ((ItemCurrency) i.currency).itemId == id);
105 }
106
107 public static String getValue(Player player, CurrencyType currency) {
108 String value = "";
109 switch (currency) {
110 case COINS:
111 value = "Coins: " + Utility.formatDigits(player.inventory.contains(995) ? player.inventory.computeAmountForId(995) : 0);
112 break;
113 case TOKKUL:
114 value = "Tokkuls: " + Utility.formatDigits(player.inventory.contains(6529) ? player.inventory.computeAmountForId(6529) : 0);
115 break;
116 case GRACEFUL_TOKEN:
117 value = "Tokens: " + Utility.formatDigits(player.inventory.contains(11849) ? player.inventory.computeAmountForId(11849) : 0);
118 break;
119 case KOLODION_POINTS:
120 value = "Points: " + Utility.formatDigits(player.mageArenaPoints);
121 break;
122 case BLOOD_MONEY:
123 value = "BM: " + Utility.formatDigits(player.inventory.contains(13307) ? player.inventory.computeAmountForId(13307) : 0);
124 break;
125 case PLATINUM_TOKEN:
126 value = "Platinum Token: " + Utility.formatDigits(player.inventory.contains(13204) ? player.inventory.computeAmountForId(13204) : 0);
127 break;
128 case ROYALE_TOKEN:
129 value = "Royale Token: " + Utility.formatDigits(player.inventory.contains(20527) ? player.inventory.computeAmountForId(20527) : 0);
130 break;
131 case SLAYER_POINTS:
132 value = "Points: " + Utility.formatDigits(player.slayer.getPoints());
133 break;
134 case VOTE_POINTS:
135 value = "Points: " + Utility.formatDigits(player.votePoints);
136 break;
137 case PEST_POINTS:
138 value = "Points: " + Utility.formatDigits(player.pestPoints);
139 break;
140 case LMS_POINTS:
141 value = "Points: " + Utility.formatDigits(player.lmsPoints);
142 break;
143 case PRESTIGE_POINTS:
144 value = "Points: " + Utility.formatDigits(player.prestige.getPrestigePoint());
145 break;
146 case DONATOR_POINTS:
147 value = "Credits: " + Utility.formatDigits(player.donation.getCredits());
148 break;
149 case SKILLING_POINTS:
150 value = "Points: " + Utility.formatDigits(player.skillingPoints);
151 break;
152 case STARDUST:
153 value = "Stardust: " + Utility.formatDigits(player.inventory.contains(25527) ? player.inventory.computeAmountForId(25527) : 0);
154 break;
155 case CLAN_POINTS:
156 if (player.clanChannel == null) {
157 value = "0";
158 } else {
159 value = "CP: " + Utility.formatDigits(player.clanChannel.getDetails().points);
160 }
161 break;
162 }
163 return value;
164 }
165
166 @Override
167 public String toString() {
168 return name().toLowerCase().replace("_", " ");
169 }
170}
static String formatDigits(final int amount)
Definition Utility.java:78