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 -> { case Title -> {
yield this.getTitles().contains(id); yield this.getTitles().contains(id);
} }
case TraceRequest -> {
yield this.getPlayer().getTraceHuntManager().getTraceRequests() >= count;
}
case HuntPermit -> {
yield this.getPlayer().getTraceHuntManager().getHuntPermits() >= count;
}
default -> { default -> {
// Not implemented // Not implemented
yield false; yield false;
@@ -338,6 +338,13 @@ public class TraceHuntManager extends PlayerManager implements GameDatabaseObjec
return false; 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 // Set build
this.huntPlayerUid = (int) ownerUid; this.huntPlayerUid = (int) ownerUid;
this.huntBossId = bossId; this.huntBossId = bossId;
@@ -363,9 +370,6 @@ public class TraceHuntManager extends PlayerManager implements GameDatabaseObjec
// Add logs to change info // Add logs to change info
change.setExtraData(logs); change.setExtraData(logs);
// Add exp
this.addExp(50);
// Calculate result // Calculate result
if (this.huntPlayerUid == this.getPlayerUid()) { if (this.huntPlayerUid == this.getPlayerUid()) {
// Check if we have enough cost items // Check if we have enough cost items
@@ -396,6 +400,9 @@ public class TraceHuntManager extends PlayerManager implements GameDatabaseObjec
return null; return null;
} }
// Add exp
this.addExp(50);
// Add medals // Add medals
this.getPlayer().getInventory().addItem(37, this.getRandomMedals(), change); this.getPlayer().getInventory().addItem(37, this.getRandomMedals(), change);