Rewrite MonsterBook, touch up chr loading
Temporarily disabled loading monster cards from db
This commit is contained in:
@@ -1,12 +1,15 @@
|
||||
package database.monsterbook;
|
||||
|
||||
import constants.id.ItemId;
|
||||
|
||||
public record MonsterCard(int cardId, byte level) {
|
||||
private static final int MAX_LEVEL = 5;
|
||||
|
||||
public MonsterCard {
|
||||
if (cardId / 10_000 != 238) {
|
||||
if (!ItemId.isMonsterCard(cardId)) {
|
||||
throw new IllegalArgumentException("Invalid monster card id: %d".formatted(cardId));
|
||||
}
|
||||
if (level < 0 || level > 5) {
|
||||
if (level < 0 || level > MAX_LEVEL) {
|
||||
throw new IllegalArgumentException("Invalid monster card level: %d".formatted(level));
|
||||
}
|
||||
}
|
||||
@@ -14,4 +17,8 @@ public record MonsterCard(int cardId, byte level) {
|
||||
public boolean isSpecial() {
|
||||
return cardId / 1000 == 2388;
|
||||
}
|
||||
|
||||
public boolean isMaxLevel() {
|
||||
return level == MAX_LEVEL;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user