mirror of
https://github.com/Melledy/Nebula.git
synced 2025-12-12 20:34:36 +01:00
Fix battle pass red dot when logging in
This commit is contained in:
@@ -100,6 +100,32 @@ public class BattlePass implements GameDatabaseObject {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if any rewards or quests are claimable
|
||||||
|
*/
|
||||||
|
public synchronized boolean hasNew() {
|
||||||
|
// Check if any quests are complete but unclaimed
|
||||||
|
for (var quest : getQuests().values()) {
|
||||||
|
if (quest.isComplete() && !quest.isClaimed()) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check if we have any pending rewards
|
||||||
|
for (int i = 1; i <= this.getLevel(); i++) {
|
||||||
|
if (!this.getBasicReward().isSet(i)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.isPremium() && !this.getPremiumReward().isSet(i)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// No claimable things
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
public synchronized void resetDailyQuests(boolean resetWeekly) {
|
public synchronized void resetDailyQuests(boolean resetWeekly) {
|
||||||
// Reset daily quests
|
// Reset daily quests
|
||||||
for (var data : GameData.getBattlePassQuestDataTable()) {
|
for (var data : GameData.getBattlePassQuestDataTable()) {
|
||||||
|
|||||||
@@ -13,6 +13,10 @@ public class BattlePassManager extends PlayerManager {
|
|||||||
super(player);
|
super(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean hasNew() {
|
||||||
|
return this.getBattlePass().hasNew();
|
||||||
|
}
|
||||||
|
|
||||||
// Database
|
// Database
|
||||||
|
|
||||||
public void loadFromDatabase() {
|
public void loadFromDatabase() {
|
||||||
|
|||||||
@@ -828,7 +828,7 @@ public class Player implements GameDatabaseObject {
|
|||||||
.setNew(this.getMailbox().hasNewMail());
|
.setNew(this.getMailbox().hasNewMail());
|
||||||
|
|
||||||
state.getMutableBattlePass()
|
state.getMutableBattlePass()
|
||||||
.setState(1);
|
.setState(this.getBattlePassManager().hasNew() ? 1 : 0);
|
||||||
|
|
||||||
state.getMutableAchievement()
|
state.getMutableAchievement()
|
||||||
.setNew(this.getAchievementManager().hasNewAchievements());
|
.setNew(this.getAchievementManager().hasNewAchievements());
|
||||||
|
|||||||
Reference in New Issue
Block a user