Implement weekly journey ticket limit

This commit is contained in:
Melledy committed 2025-12-09 23:49:48 -08:00
1 parent 5d797fb9d3
commit 6483e8a5a7
6 files changed
+77 -33

No files matched your search

@@ -34,6 +34,7 @@ public class PlayerProgress extends PlayerManager implements GameDatabaseObject
// Star Tower
private IntSet starTowerLog;
private int[] starTowerGrowth;
private int towerTickets;
// Instances
private Int2IntMap dailyInstanceLog;
@@ -122,6 +123,39 @@ public class PlayerProgress extends PlayerManager implements GameDatabaseObject
return true;
}
/**
* Returns the maximum amount of weekly tickets that a player can receive without hitting the limit
*/
public int getMaxEarnableWeeklyTowerTickets() {
return Math.max(this.getWeeklyTowerTicketLimit() - this.getTowerTickets(), 0);
}
public int getWeeklyTowerTicketLimit() {
int limit = 2000;
if (this.getPlayer().getStarTowerManager().hasGrowthNode(10502)) {
limit += 1000;
} else if (this.getPlayer().getStarTowerManager().hasGrowthNode(10201)) {
limit += 500;
}
return limit;
}
public void addWeeklyTowerTicketLog(int count) {
this.towerTickets += count;
Nebula.getGameDatabase().update(this, this.getUid(), "towerTickets", this.towerTickets);
}
public void clearWeeklyTowerTicketLog() {
if (this.towerTickets == 0) {
return;
}
this.towerTickets = 0;
Nebula.getGameDatabase().update(this, this.getUid(), "towerTickets", this.towerTickets);
}
public void addInfinityArenaLog(int levelId) {
// Calculate arena id
int id = (int) Math.floor(levelId / 10000D);