Skip to content

Commit 38e31c9

Browse files
committed
feat: Add bazaar stocks
1 parent acda78f commit 38e31c9

File tree

5 files changed

+49
-8
lines changed

5 files changed

+49
-8
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
with:
1818
repository: 'NotEnoughUpdates/NotEnoughUpdates-REPO'
1919
path: 'NotEnoughUpdates-REPO' # This is consistent with the repo path defined in NEURepoParserTest.java
20-
ref: '3181dfb2e71204edb9bf70638418ee890cd28709'
20+
ref: '080a804a1f7c1fd8e9899f8317a18b33a319d049'
2121

2222
- name: Validate gradle wrapper
2323
uses: gradle/actions/wrapper-validation@v3

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
NotEnoughUpdates-REPO/
1+
NotEnoughUpdates-REPO
22
.idea/
33
.gradle/
44
build/

src/main/java/io/github/moulberry/repo/NEUConstants.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@
88
import io.github.moulberry.repo.util.PetId;
99
import lombok.Getter;
1010

11+
import java.util.Collections;
1112
import java.util.List;
1213
import java.util.Map;
14+
import java.util.stream.Collectors;
1315

1416
@Getter
1517
public class NEUConstants implements IReloadable {
@@ -23,6 +25,7 @@ public class NEUConstants implements IReloadable {
2325
PetLevelingData petLevelingData;
2426
Map<@PetId String, Map<Rarity, PetNumbers>> petNumbers;
2527
Islands islands;
28+
BazaarStocks bazaarStocks;
2629

2730
public void reload(NEURepository repository) throws NEURepositoryException {
2831
bonuses = repository.requireFile("constants/bonuses.json").json(Bonuses.class);
@@ -40,6 +43,12 @@ public void reload(NEURepository repository) throws NEURepositoryException {
4043
});
4144
NEURepoFile islandsFile = repository.file("constants/islands.json");
4245
islands = islandsFile != null ? islandsFile.json(Islands.class) : new Islands();
46+
NEURepoFile bazaarFile = repository.file("constants/bazaarstocks.json");
47+
bazaarStocks = new BazaarStocks(
48+
bazaarFile != null ?
49+
(bazaarFile.json(new TypeToken<List<BazaarStocks.InternalRepresentation>>() {
50+
}).stream().collect(Collectors.toMap(BazaarStocks.InternalRepresentation::getId, BazaarStocks.InternalRepresentation::getStock)))
51+
: (Collections.emptyMap()));
4352
}
4453

4554

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package io.github.moulberry.repo.constants;
2+
3+
import io.github.moulberry.repo.util.NEUId;
4+
import lombok.Getter;
5+
import lombok.Value;
6+
import org.jetbrains.annotations.NotNull;
7+
8+
import java.util.Map;
9+
10+
@Value
11+
public class BazaarStocks {
12+
Map<@NEUId String, String> stocks;
13+
14+
public @NotNull String getBazaarStockOrDefault(@NotNull @NEUId String id) {
15+
return stocks.getOrDefault(id, id);
16+
}
17+
18+
@Getter
19+
public static class InternalRepresentation {
20+
@NEUId
21+
String id;
22+
23+
String stock;
24+
}
25+
}

src/test/java/io/github/moulberry/repo/NEURepoParserTest.java

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,19 @@ static void beforeAll() throws NEURepositoryException {
2121
repository.reload();
2222
}
2323

24+
@Test
25+
void testBazaarStocks() {
26+
Assertions.assertEquals("SHARD_SALMON", repository.getConstants().getBazaarStocks().getBazaarStockOrDefault("ATTRIBUTE_SHARD_LOST_AND_FOUND;1"));
27+
Assertions.assertEquals("REDSTONE", repository.getConstants().getBazaarStocks().getBazaarStockOrDefault("REDSTONE"));
28+
}
29+
2430
@Test
2531
void testPetConstants() {
2632
Assertions.assertEquals("MINING", repository.getConstants().getPetLevelingData().getPetExpTypes().get("ROCK"));
27-
Assertions.assertEquals("PetNumbers.Stats(otherNumbers=[0.2, 0.1, 10.0, 0.2], statNumbers={ABILITY_DAMAGE=0.0, INTELLIGENCE=1.0})", repository.getConstants().getPetNumbers().get("SHEEP").get(Rarity.LEGENDARY).interpolatedStatsAtLevel(1).toString());
28-
Assertions.assertEquals("PetNumbers.Stats(otherNumbers=[74.74747474747474, 0.3787878787878788, 0.17424242424242425], statNumbers={STRENGTH=37.37373737373737, MAGIC_FIND=4.94949494949495, BONUS_ATTACK_SPEED=37.37373737373737})", repository.getConstants().getPetNumbers().get("GOLDEN_DRAGON").get(Rarity.LEGENDARY).interpolatedStatsAtLevel(150).toString());
33+
Assertions.assertEquals("PetNumbers.Stats(otherNumbers=[0.2, 0.1, 10.0, 0.2], statNumbers={ABILITY_DAMAGE=0.2, INTELLIGENCE=1.0})", repository.getConstants().getPetNumbers().get("SHEEP").get(Rarity.LEGENDARY).interpolatedStatsAtLevel(1).toString());
34+
Assertions.assertEquals("PetNumbers.Stats(otherNumbers=[74.74747474747474, 0.37373737373737376, 0.18686868686868688], 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());
2935
Assertions.assertEquals(200, repository.getConstants().getPetLevelingData().getPetLevelingBehaviourOverrides().get("GOLDEN_DRAGON").getMaxLevel());
36+
Assertions.assertEquals(200, repository.getConstants().getPetLevelingData().getPetLevelingBehaviourOverrides().get("JADE_DRAGON").getMaxLevel());
3037
}
3138

3239
@Test
@@ -47,7 +54,7 @@ void testLevelingConstants() {
4754

4855
@Test
4956
void testMiscConstants() {
50-
Assertions.assertEquals(175, repository.getConstants().getMisc().getRainbowNames().size());
57+
Assertions.assertEquals(300, repository.getConstants().getMisc().getRainbowNames().size());
5158
Assertions.assertEquals("Private Island", repository.getConstants().getMisc().getAreaNames().get("dynamic"));
5259
Assertions.assertEquals(12, repository.getConstants().getMisc().getMaxMinionLevel().get("BLAZE_GENERATOR"));
5360
Assertions.assertEquals("100000", repository.getConstants().getMisc().getSlayerCost().get(4));
@@ -63,9 +70,9 @@ void testConstants() {
6370
Assertions.assertEquals("Optional[PERFECT_AMETHYST_GEM]", repository.getConstants().getParents().getParent("FLAWED_AMETHYST_GEM").toString());
6471
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]", repository.getConstants().getEnchants().getAvailableEnchants("SWORD").toString());
6572
Assertions.assertEquals("[bane_of_arthropods, smite, ultimate_one_for_all]", repository.getConstants().getEnchants().getConflictingEnchants("sharpness").toString());
66-
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=[§610,000 Coins], 5=[§625,000 Coins], 6=[§650,000 Coins], 7=[§6100,000 Coins], 8=[§6Heavy Pearl §8x3, §6250,000 Coins], 9=[§6Heavy Pearl §8x4, §6500,000 Coins], 10=[§6Heavy Pearl §8x5, §61,000,000 Coins]})", repository.getConstants().getEssenceCost().getCosts().get("HOT_CRIMSON_HELMET").toString());
73+
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=[HEAVY_PEARL:3, SKYBLOCK_COIN:250000], 9=[HEAVY_PEARL:4, SKYBLOCK_COIN:500000], 10=[HEAVY_PEARL:5, SKYBLOCK_COIN:1000000]})", repository.getConstants().getEssenceCost().getCosts().get("HOT_CRIMSON_HELMET").toString());
6774
Assertions.assertEquals("Coordinate(x=138, y=66, z=129)", repository.getConstants().getFairySouls().getSoulLocations().get("hub").get(0).toString());
68-
Assertions.assertEquals(247, repository.getConstants().getFairySouls().getMaxSouls());
75+
Assertions.assertEquals(266, repository.getConstants().getFairySouls().getMaxSouls());
6976
}
7077

7178
@Test
@@ -80,7 +87,7 @@ void testRecipes() {
8087
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());
8188
Assertions.assertEquals(864000, ((NEUKatUpgradeRecipe) recipes.getRecipes().get("BAL;4").stream().filter(NEUKatUpgradeRecipe.class::isInstance).findAny().get()).getSeconds());
8289

83-
Assertions.assertEquals("[x8-15, x10-18, x2-3, x8-15, x8-15, x3, x1-2, x0-2, x0-3, x5-6, x0-6, x0-3, x30-32, x2, x3-6, x1-2, .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, x1-2, x1-2, .05% per Summoning Eye, .01% per Summoning Eye, 2% per Summoning Eye, 3% per Summoning Eye, x4-7, x8-15, x1-3, x1-3, x1-2, x1-2, x1-2, x1-2, .05% per Summoning Eye, .01% per Summoning Eye, 2% per Summoning Eye, 3% per Summoning Eye, x8-15, x8-15, §aUnommon 20%, x1, x-10, x1-3, §a20%, §a10%, .05% per Summoning Eye, .01% per Summoning Eye, 2% per Summoning Eye, 3% per Summoning Eye, x2-4, x2-3, x1-3, x1-4, x1-2, x8-15, x8-15, 5% per Hit, 5% per Hit, 4.5% per Hit, 0.0126% per Hit, 0.0054% per Hit, x1-2, x1-2, x2-3, x8-15, x8-15, x1-3, x1-2, .05% per Summoning Eye, .01% per Summoning Eye, 2% per Summoning Eye, 3% per Summoning Eye, x1-2, x1-3, x1-2, §fUncommon 25%, .05% per Summoning Eye, .01% per Summoning Eye, 2% per Summoning Eye, 3% per Summoning Eye, x32, x1-2, x1-2, x1-2, x2-3, x5, x1-2, x1-2, x1-2, x10-22, x2, x2-3, x1-3, x15-27, x18-41]", repository.getItems().getItems().values().stream()
90+
Assertions.assertEquals("[x8-15, x10-18, x1-2, x2-3, x6-17, x3-5, x10-20, x16-22, x2-3, x8-15, x8-15, x1-2, x3-4, x0-2, x10-20, x0-2, x10-20, x5-6, x0-6, x10-60, x0-6, x10-60, x30-32, x8-13, x2-3, x20-30, x32-44, x2-4, x2-5, x20-35, x0-2, x1-10, x3-6, x1-2, x2-3, .05% per Summoning Eye, .01% per Summoning Eye, 2% per Summoning Eye, 3% per Summoning Eye, x1-2, .05% per Summoning Eye, .01% per Summoning Eye, 2% per Summoning Eye, 3% per Summoning Eye, x1-2, x2-3, x2-3, x1-2, x1-2, x1-2, .05% per Summoning Eye, .01% per Summoning Eye, 2% per Summoning Eye, 3% per Summoning Eye, x20-30, x4-7, x8-15, x1-3, x1-3, x1-2, x1-2, x2-3, x20-35, x0-2, x5-9, x1-2, x1-2, x1-2, .05% per Summoning Eye, .01% per Summoning Eye, 2% per Summoning Eye, 3% per Summoning Eye, x1-2, x1-3, x8-15, x8-15, x16-18, x20-35, x0-2, x1, x1-10, x0-2, §a20%, §a10%, .05% per Summoning Eye, .01% per Summoning Eye, 2% per Summoning Eye, 3% per Summoning Eye, x20-30, x1-3, x6-9, x35-55, x3-5, x4-8, x2-4, x2-3, x20-35, x0-2, x2-3, x2-4, x1-4, x1-2, x8-15, x8-15, 5% per Hit, 5% per Hit, 4.5% per Hit, 0.0126% per Hit, 0.0054% per Hit, x1-2, x2-3, x2-3, x8-15, x8-15, x1-2, x2-4, x2-4, x20-35, x0-2, x8-11, x1-2, x1-2, x1-2, x2, x1-2, x12-15, x2-3, .05% per Summoning Eye, .01% per Summoning Eye, 2% per Summoning Eye, 3% per Summoning Eye, x1-2, x2-4, x1-2, x2-4, x32-44, x3-5, x1-2, x5-7, x4-5, x20-30, .05% per Summoning Eye, .01% per Summoning Eye, 2% per Summoning Eye, 3% per Summoning Eye, x1-2, x1-2, x1-2, x1-2, x2-3, x10-17, 100% + 65% per hit, 100% + 25% per hit, 10% + 10% per hit, x5, x1-2, x1-2, x1-2, x10-22, 20% per hit, x2-3, x15-27, x18-41]", repository.getItems().getItems().values().stream()
8491
.flatMap(it -> it.getRecipes().stream())
8592
.filter(NEUMobDropRecipe.class::isInstance)
8693
.flatMap(it -> ((NEUMobDropRecipe) it).getDrops().stream())

0 commit comments

Comments
 (0)