Fix hunt permits check

This commit is contained in:
Melledy
2026-07-21 04:28:29 -07:00
parent 774d119f2b
commit 06dc208305
2 changed files with 16 additions and 3 deletions
@@ -721,6 +721,12 @@ public class Inventory extends PlayerManager implements GameDatabaseObject {
case Title -> {
yield this.getTitles().contains(id);
}
case TraceRequest -> {
yield this.getPlayer().getTraceHuntManager().getTraceRequests() >= count;
}
case HuntPermit -> {
yield this.getPlayer().getTraceHuntManager().getHuntPermits() >= count;
}
default -> {
// Not implemented
yield false;
@@ -338,6 +338,13 @@ public class TraceHuntManager extends PlayerManager implements GameDatabaseObjec
return false;
}
// Check if we have enough cost items
var cost = this.getHuntCost();
if (cost != null && !getPlayer().getInventory().hasItem(cost.getExtraCost1Tid(), cost.getExtraCost1Qty())) {
return false;
}
// Set build
this.huntPlayerUid = (int) ownerUid;
this.huntBossId = bossId;
@@ -363,9 +370,6 @@ public class TraceHuntManager extends PlayerManager implements GameDatabaseObjec
// Add logs to change info
change.setExtraData(logs);
// Add exp
this.addExp(50);
// Calculate result
if (this.huntPlayerUid == this.getPlayerUid()) {
// Check if we have enough cost items
@@ -396,6 +400,9 @@ public class TraceHuntManager extends PlayerManager implements GameDatabaseObjec
return null;
}
// Add exp
this.addExp(50);
// Add medals
this.getPlayer().getInventory().addItem(37, this.getRandomMedals(), change);