Skip to content

Commit 47b0e81

Browse files
committed
Add support for kat upgrade recipes
1 parent 9bef42c commit 47b0e81

File tree

3 files changed

+59
-0
lines changed

3 files changed

+59
-0
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public final class NEURepository {
4040
.registerSubtype(NEUCraftingRecipe.class, "crafting")
4141
.registerSubtype(NEUMobDropRecipe.class, "drops")
4242
.registerSubtype(NEUNpcShopRecipe.class, "npc_shop")
43+
.registerSubtype(NEUKatUpgradeRecipe.class, "katgrade")
4344
.setFallbackType(NEUUnknownRecipe.class)
4445
.setDefaultTypeTag("crafting")
4546
)

src/main/java/io/github/moulberry/repo/data/NEUIngredient.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ public class NEUIngredient {
1111
@NEUId String itemId;
1212
double amount;
1313
public static final String NEU_SENTINEL_EMPTY = "NEU_SENTINEL_EMPTY";
14+
public static final String NEU_SENTINEL_COINS = "SKYBLOCK_COIN";
1415
public static final NEUIngredient SENTINEL_EMPTY = new NEUIngredient();
1516

1617
static {
@@ -21,6 +22,13 @@ public class NEUIngredient {
2122
private NEUIngredient() {
2223
}
2324

25+
public static NEUIngredient ofCoins(double coins) {
26+
NEUIngredient neuIngredient = new NEUIngredient();
27+
neuIngredient.amount = coins;
28+
neuIngredient.itemId = NEU_SENTINEL_COINS;
29+
return neuIngredient;
30+
}
31+
2432
public static NEUIngredient fromItem(NEUItem item, int count) {
2533
NEUIngredient ingredient = new NEUIngredient();
2634
ingredient.amount = count;
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package io.github.moulberry.repo.data;
2+
3+
import lombok.Getter;
4+
5+
import java.util.ArrayList;
6+
import java.util.Collection;
7+
import java.util.Collections;
8+
import java.util.List;
9+
10+
public class NEUKatUpgradeRecipe implements NEURecipe {
11+
/**
12+
* Base pet.
13+
*/
14+
@Getter
15+
NEUIngredient input;
16+
/**
17+
* Upgraded pet.
18+
*/
19+
@Getter
20+
NEUIngredient output;
21+
/**
22+
* List of bonus items you need to upgrade, not including the pet itself.
23+
*/
24+
@Getter
25+
List<NEUIngredient> items;
26+
/**
27+
* Coin cost for a level "0" pet. This cost is reduced for each level, so even a level 1 pet costs less to upgrade than this.
28+
*/
29+
@Getter
30+
double coins;
31+
/**
32+
* Time for the pet upgrade in seconds.
33+
*/
34+
@Getter
35+
long seconds;
36+
37+
@Override
38+
public Collection<NEUIngredient> getAllInputs() {
39+
List<NEUIngredient> inputs = new ArrayList<>();
40+
inputs.add(input);
41+
inputs.addAll(items);
42+
inputs.add(NEUIngredient.ofCoins(coins));
43+
return inputs;
44+
}
45+
46+
@Override
47+
public Collection<NEUIngredient> getAllOutputs() {
48+
return Collections.singleton(output);
49+
}
50+
}

0 commit comments

Comments
 (0)