-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathNEURepoParserTest.java
More file actions
127 lines (110 loc) · 9.03 KB
/
Copy pathNEURepoParserTest.java
File metadata and controls
127 lines (110 loc) · 9.03 KB
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
package io.github.moulberry.repo;
import io.github.moulberry.repo.constants.AbiphoneContact;
import io.github.moulberry.repo.data.*;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import java.nio.file.Paths;
import java.util.Collections;
import java.util.Objects;
import java.util.stream.Collectors;
public class NEURepoParserTest {
private static final NEURepository repository = NEURepository.of(Paths.get("NotEnoughUpdates-REPO"));
private static final NEURecipeCache recipes = NEURecipeCache.forRepo(repository);
private static final ItemOverlays overlay = ItemOverlays.forRepo(repository);
@BeforeAll
static void beforeAll() throws NEURepositoryException {
System.out.printf("Parser v%s%n", NEURepositoryVersion.REPOSITORY_PARSER_VERSION);
System.out.printf("Schema %d.%d%n", NEURepositoryVersion.REPOSITORY_SCHEMA_VERSION_MAJOR, NEURepositoryVersion.REPOSITORY_SCHEMA_VERSION_MINOR);
repository.reload();
}
@Test
void testOverlayFiles() {
Assertions.assertTrue(overlay.getMostUpToDateCompatibleWith(4324).isEmpty());
Assertions.assertEquals(4325, overlay.getMostUpToDateCompatibleWith(4326).get("BAMBOO").getVersion());
Assertions.assertEquals("BAMBOO", overlay.getMostUpToDateCompatibleWith(4325).get("BAMBOO").getItemId());
}
@Test
void testBazaarStocks() {
Assertions.assertEquals("SHARD_SALMON", repository.getConstants().getBazaarStocks().getBazaarStockOrDefault("ATTRIBUTE_SHARD_LOST_AND_FOUND;1"));
Assertions.assertEquals("REDSTONE", repository.getConstants().getBazaarStocks().getBazaarStockOrDefault("REDSTONE"));
}
@Test
void testPetConstants() {
Assertions.assertEquals("MINING", repository.getConstants().getPetLevelingData().getPetExpTypes().get("ROCK"));
Assertions.assertEquals("PetNumbers.Stats(otherNumbers=[0.2, 0.1, 0.2], statNumbers={ABILITY_DAMAGE=0.2, INTELLIGENCE=1.0})", repository.getConstants().getPetNumbers().get("SHEEP").get(Rarity.LEGENDARY).interpolatedStatsAtLevel(1).toString());
Assertions.assertEquals("PetNumbers.Stats(otherNumbers=[7.5, 0.37373737373737376, 3.7373737373737375, 0.18686868686868688, 187.4747474747475], statNumbers={STRENGTH=37.37373737373737, MAGIC_FIND=7.474747474747475, BONUS_ATTACK_SPEED=37.37373737373737})", repository.getConstants().getPetNumbers().get("GOLDEN_DRAGON").get(Rarity.LEGENDARY).interpolatedStatsAtLevel(150).toString());
Assertions.assertEquals(200, repository.getConstants().getPetLevelingData().getPetLevelingBehaviourOverrides().get("GOLDEN_DRAGON").getMaxLevel());
Assertions.assertEquals(200, repository.getConstants().getPetLevelingData().getPetLevelingBehaviourOverrides().get("JADE_DRAGON").getMaxLevel());
}
@Test
void testLevelingConstants() {
int expTotal = 235268;
int expLeft = expTotal;
int level = 0;
for (int expRequiredForThisLevel : repository.getConstants().getLeveling().getSkillExperienceRequiredPerLevel()) {
if (expLeft > expRequiredForThisLevel) {
level++;
expLeft -= expRequiredForThisLevel;
}
}
Assertions.assertEquals(235268, expTotal);
Assertions.assertEquals(18, level);
Assertions.assertEquals(12843, expLeft);
}
@Test
void testMiscConstants() {
Assertions.assertEquals(210, repository.getConstants().getMisc().getRainbowNames().size());
Assertions.assertEquals("Private Island", repository.getConstants().getMisc().getAreaNames().get("dynamic"));
Assertions.assertEquals(12, repository.getConstants().getMisc().getMaxMinionLevel().get("BLAZE_GENERATOR"));
Assertions.assertEquals("100000", repository.getConstants().getMisc().getSlayerCost().get(4));
Assertions.assertEquals("MVP", repository.getConstants().getMisc().getRanks().get("SUPERSTAR").getTag());
Assertions.assertEquals("[CANDY_RING, CANDY_ARTIFACT, CANDY_RELIC]", repository.getConstants().getMisc().getTalismanUpgrades().get("CANDY_TALISMAN").toString());
Assertions.assertEquals(31, repository.getConstants().getMisc().getCredits().getLore().size());
}
@Test
void testConstants() {
Assertions.assertEquals("{magic_find=5.0}", repository.getConstants().getBonuses().getPetRewards(115).toString());
Assertions.assertEquals("{damage_increase=2.0999992, crit_chance=30.0}", repository.getConstants().getBonuses().getAccumulativeLevelingRewards("skill_combat", 60).toString());
Assertions.assertEquals("Optional[PERFECT_AMETHYST_GEM]", repository.getConstants().getParents().getParent("FLAWED_AMETHYST_GEM").toString());
Assertions.assertEquals("[bane_of_arthropods, cleave, critical, cubism, dragon_hunter, ender_slayer, execute, experience, fire_aspect, first_strike, giant_killer, impaling, knockback, lethality, life_steal, looting, luck, mana_steal, PROSECUTE, scavenger, sharpness, smite, syphon, titan_killer, thunderlord, thunderbolt, triple_strike, vampirism, venomous, vicious, ultimate_one_for_all, ultimate_soul_eater, ultimate_chimera, ultimate_combo, ultimate_swarm, ultimate_wise, smoldering, ultimate_inferno, ultimate_fatal_tempo, tabasco, champion, divine_gift, magmarizer]", repository.getConstants().getEnchants().getAvailableEnchants("SWORD").toString());
Assertions.assertEquals("[ultimate_one_for_all]", repository.getConstants().getEnchants().getConflictingEnchants("sharpness").toString());
Assertions.assertEquals("EssenceCosts.EssenceCost(type=Crimson, essenceCosts={1=170, 2=190, 3=215, 4=240, 5=270, 6=300, 7=340, 8=390, 9=440, 10=500}, itemCosts={4=[SKYBLOCK_COIN:10000], 5=[SKYBLOCK_COIN:25000], 6=[SKYBLOCK_COIN:50000], 7=[SKYBLOCK_COIN:100000], 8=[SKYBLOCK_COIN:250000, HEAVY_PEARL:3], 9=[SKYBLOCK_COIN:500000, HEAVY_PEARL:4], 10=[SKYBLOCK_COIN:1000000, HEAVY_PEARL:5]})", repository.getConstants().getEssenceCost().getCosts().get("HOT_CRIMSON_HELMET").toString());
Assertions.assertEquals("Coordinate(x=-233, y=86, z=84)", repository.getConstants().getFairySouls().getSoulLocations().get("hub").get(0).toString());
Assertions.assertEquals(273, repository.getConstants().getFairySouls().getMaxSouls());
}
@Test
void testItems() {
Assertions.assertEquals("minecraft:diamond_sword", repository.getItems().getItemBySkyblockId("ASPECT_OF_THE_END").getMinecraftItemId());
Assertions.assertFalse(repository.getItems().getItemBySkyblockId("ASPECT_OF_THE_END").isVanilla());
Assertions.assertTrue(repository.getItems().getItemBySkyblockId("DIAMOND").isVanilla());
}
@Test
void testRecipes() {
Assertions.assertEquals("[NEUIngredient{TITANIUM_DRILL_4:1.000000}, NEUIngredient{SKYBLOCK_COIN:50000000.000000}, NEUIngredient{DIVAN_ALLOY:1.000000}]", ((NEUForgeRecipe) recipes.getRecipes().get("DIVAN_DRILL").stream().filter(NEUForgeRecipe.class::isInstance).findAny().get()).getInputs().toString());
Assertions.assertEquals(864000, ((NEUKatUpgradeRecipe) recipes.getRecipes().get("BAL;4").stream().filter(NEUKatUpgradeRecipe.class::isInstance).findAny().get()).getSeconds());
Assertions.assertEquals("[.05% per Summoning Eye, .01% per Summoning Eye, 2% per Summoning Eye, 3% per Summoning Eye, .05% per Summoning Eye, .01% per Summoning Eye, 2% per Summoning Eye, 3% per Summoning Eye, .05% per Summoning Eye, .01% per Summoning Eye, 2% per Summoning Eye, 3% per Summoning Eye, .05% per Summoning Eye, .01% per Summoning Eye, 2% per Summoning Eye, 3% per Summoning Eye, §a20%, §a10%, .05% per Summoning Eye, .01% per Summoning Eye, 2% per Summoning Eye, 3% per Summoning Eye, 5% per Hit, 5% per Hit, 4.5% per Hit, 0.0126% per Hit, 0.0054% per Hit, .97%, .05% per Summoning Eye, .01% per Summoning Eye, 2% per Summoning Eye, 3% per Summoning Eye, .05% per Summoning Eye, .01% per Summoning Eye, 2% per Summoning Eye, 3% per Summoning Eye, 100% + 65% per hit, 100% + 25% per hit, 10% + 10% per hit, 20% per hit]", repository.getItems().getItems().values().stream()
.flatMap(it -> it.getRecipes().stream())
.filter(NEUMobDropRecipe.class::isInstance)
.flatMap(it -> ((NEUMobDropRecipe) it).getDrops().stream())
.map(NEUMobDropRecipe.Drop::getChance)
.filter(it -> it != null && !it.matches("\\d+(.\\d+)?+%"))
.collect(Collectors.toList()).toString()
);
}
@Test
void testUnknownRecipes() {
Assertions.assertEquals(Collections.emptyList(), repository.getItems().getItems().values().stream()
.flatMap(it -> it.getRecipes().stream())
.filter(NEUUnknownRecipe.class::isInstance)
.map(NEUUnknownRecipe.class::cast)
.collect(Collectors.toList())
);
}
@Test
void testAbiphoneContacts() {
AbiphoneContact elizabeth = repository.getConstants().getAbiphoneContacts().get("Elizabeth");
Assertions.assertTrue(Objects.requireNonNull(elizabeth.getCallNames()).contains("elizabeth"));
Assertions.assertEquals("hub", elizabeth.getIsland());
}
}