1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
|
/*
* Copyright (C) 2023 NotEnoughUpdates contributors
*
* This file is part of NotEnoughUpdates.
*
* NotEnoughUpdates is free software: you can redistribute it
* and/or modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation, either
* version 3 of the License, or (at your option) any later version.
*
* NotEnoughUpdates is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with NotEnoughUpdates. If not, see <https://www.gnu.org/licenses/>.
*/
package io.github.moulberry.notenoughupdates.profileviewer.level.task;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import io.github.moulberry.notenoughupdates.profileviewer.GuiProfileViewer;
import io.github.moulberry.notenoughupdates.profileviewer.ProfileViewer;
import io.github.moulberry.notenoughupdates.profileviewer.SkyblockProfiles;
import io.github.moulberry.notenoughupdates.profileviewer.data.APIDataJson;
import io.github.moulberry.notenoughupdates.profileviewer.level.LevelPage;
import io.github.moulberry.notenoughupdates.util.Utils;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
public class SkillRelatedTaskLevel extends GuiTaskLevel {
public SkillRelatedTaskLevel(LevelPage levelPage) {
super(levelPage);
}
@Override
public void drawTask(JsonObject object, int mouseX, int mouseY, int guiLeft, int guiTop) {
SkyblockProfiles.SkyblockProfile selectedProfile = GuiProfileViewer.getSelectedProfile();
if (selectedProfile == null) {
return;
}
APIDataJson data = selectedProfile.getAPIDataJson();
if (data == null) {
return;
}
Map<String, ProfileViewer.Level> levelingInfo = selectedProfile.getLevelingInfo();
if (levelingInfo == null) {
return;
}
JsonObject skillRelatedTask = levelPage.getConstant().getAsJsonObject("skill_related_task");
JsonObject miningObj = skillRelatedTask.getAsJsonObject("mining");
int hotmLevel = (int) levelingInfo.get("hotm").level;
int hotmXP = 0;
JsonArray hotmXpArray = miningObj.get("hotm_xp").getAsJsonArray();
for (int i = 1; i <= hotmLevel; i++) {
hotmXP += hotmXpArray.get(i - 1).getAsInt();
}
float mithrilPowder = data.mining_core.powder_mithril;
float gemstonePowder = data.mining_core.powder_gemstone;
float mithril = data.mining_core.powder_spent_mithril + mithrilPowder;
float gemstone = data.mining_core.powder_spent_gemstone + gemstonePowder;
// PUNKT NULL
double totalMithril = mithril + mithrilPowder;
double totalGemstone = gemstone + gemstonePowder;
double mithrilUnder = Math.min(350000.0, totalMithril);
double mithrilOver = Math.max(0, Math.min(totalMithril, 12_500_000.0) - 350000.0);
double gemstoneUnder = Math.min(350000.0, totalGemstone);
double gemstoneOver = Math.max(0, Math.min(totalGemstone, 20_000_000.0) - 350000.0);
double mithrilXP = Math.floor(mithrilUnder / 2400.0);
double gemstoneXP = Math.floor(gemstoneUnder / 2500.0);
double mithrilExcess = Math.floor(
3.75 * (Math.sqrt(1 + 8 * Math.sqrt((1758267.0 / 12_500_000.0) * mithrilOver + 9)) - 3));
double gemstoneExcess = Math.floor(
4.25 * (Math.sqrt(1 + 8 * Math.sqrt((1758267.0 / 20_000_000.0) * gemstoneOver + 9)) - 3));
double sbXpHotmTier =
(mithrilXP + mithrilExcess) + (gemstoneXP + gemstoneExcess)
+ hotmXP;
int sbXpPotmTier = 0;
JsonArray potmXpArray = miningObj.get("potm_xp").getAsJsonArray();
int potm = (data.mining_core.nodes.getOrDefault("special_0", new JsonPrimitive(0)).getAsInt());
for (int i = 1; i <= potm; i++) {
sbXpPotmTier += potmXpArray.get(i - 1).getAsInt();
}
int sbXpCommissionMilestone = 0;
JsonArray tutorialArray = Utils.getElementOrDefault(
selectedProfile.getProfileJson(),
"objectives.tutorial",
new JsonArray()
).getAsJsonArray();
JsonArray commissionMilestoneXpArray = miningObj.get("commission_milestone_xp").getAsJsonArray();
for (JsonElement jsonElement : tutorialArray) {
if (jsonElement.getAsJsonPrimitive().isString() && jsonElement.getAsString().startsWith(
"commission_milestone_reward_skyblock_xp_tier"))
for (int i = 1; i <= commissionMilestoneXpArray.size(); i++) {
int value = commissionMilestoneXpArray.get(i - 1).getAsInt();
if (jsonElement.getAsString().equals("commission_milestone_reward_skyblock_xp_tier_" + i)) {
sbXpCommissionMilestone += value;
}
}
}
int sbXpFossilResearch =
data.glacite_player_data.fossils_donated.size() * miningObj.get("fossil_research_xp").getAsInt();
// rock mines
float pet_milestone_ores_mined = data.player_stats.pets.milestone.ores_mined;
int sbXpRockPet = 0;
int rockMilestoneXp = miningObj.get("rock_milestone_xp").getAsInt();
JsonArray rockMilestoneRequired = miningObj.get("rock_milestone_required").getAsJsonArray();
for (JsonElement jsonElement : rockMilestoneRequired) {
int value = jsonElement.getAsInt();
if (pet_milestone_ores_mined >= value) {
sbXpRockPet += rockMilestoneXp;
}
}
// farming
JsonObject farmingObj = skillRelatedTask.get("farming").getAsJsonObject();
int anitaShopUpgradesXp = farmingObj.get("anita_shop_upgrades_xp").getAsInt();
int doubleDrops = data.jacobs_contest.perks.double_drops;
int farmingLevelCap = data.jacobs_contest.perks.farming_level_cap;
int sbXpGainedByAnita = (doubleDrops + farmingLevelCap) * anitaShopUpgradesXp;
// fishing
int sbXpTrophyFish = 0;
JsonObject fishingObj = skillRelatedTask.get("fishing").getAsJsonObject();
JsonArray trophyFishXpArr = fishingObj.get("trophy_fish_xp").getAsJsonArray();
if (object.has("trophy_fish")) {
JsonObject trophyFish = object.get("trophy_fish").getAsJsonObject();
for (Map.Entry<String, JsonElement> stringJsonElementEntry : trophyFish.entrySet()) {
String key = stringJsonElementEntry.getKey();
if (stringJsonElementEntry.getValue().isJsonPrimitive()) {
if (key.endsWith("_bronze")) sbXpTrophyFish += trophyFishXpArr.get(0).getAsInt();
if (key.endsWith("_silver")) sbXpTrophyFish += trophyFishXpArr.get(1).getAsInt();
if (key.endsWith("_gold")) sbXpTrophyFish += trophyFishXpArr.get(2).getAsInt();
if (key.endsWith("_diamond")) sbXpTrophyFish += trophyFishXpArr.get(3).getAsInt();
}
}
}
float petMilestoneKilled = data.player_stats.pets.milestone.sea_creatures_killed;
int sbXpDolphinPet = 0;
int dolphinMilestoneXp = fishingObj.get("dolphin_milestone_xp").getAsInt();
JsonArray dolphinMilestoneRequired = fishingObj.get("dolphin_milestone_required").getAsJsonArray();
for (JsonElement jsonElement : dolphinMilestoneRequired) {
int value = jsonElement.getAsInt();
if (petMilestoneKilled >= value) {
sbXpDolphinPet += dolphinMilestoneXp;
}
}
int sbXpNucleus = 0;
int nucleusRuns = data.leveling.completions.NUCLEUS_RUNS;
JsonElement nucleusXp = miningObj.get("crystal_nucleus_xp");
if (nucleusXp == null) {
Utils.showOutdatedRepoNotification("crystal_nucleus_xp from sblevels.json");
} else {
sbXpNucleus += nucleusRuns * nucleusXp.getAsInt();
}
List<String> lore = new ArrayList<>();
lore.add(levelPage.buildLore("Heart of the Mountain", sbXpHotmTier, miningObj.get("hotm").getAsInt(), false));
lore.add(levelPage.buildLore(
"Commission Milestones",
sbXpCommissionMilestone,
miningObj.get("commission_milestone").getAsInt(),
false
));
lore.add(levelPage.buildLore("Crystal Nucleus", sbXpNucleus, miningObj.get("crystal_nucleus").getAsInt(), false));
lore.add(levelPage.buildLore(
"Anita's Shop Upgrade",
sbXpGainedByAnita,
farmingObj.get("anita_shop_upgrades").getAsInt(),
false
));
lore.add(levelPage.buildLore("Peak of the Mountain", sbXpPotmTier, miningObj.get("potm").getAsInt(), false));
lore.
|