mirror of
https://github.com/Melledy/Nebula.git
synced 2026-09-20 01:29:54 +02:00
Update score boss control id properly
This commit is contained in:
@@ -119,6 +119,9 @@ public class GameContext implements Runnable {
|
||||
this.epochWeeks = Utils.getWeeks(this.epochDays);
|
||||
this.epochMonths = Utils.getMonths(this.epochDays);
|
||||
|
||||
// Update score boss season
|
||||
this.getScoreBossModule().updateSeason();
|
||||
|
||||
// Reset dailies for players
|
||||
this.resetDailies();
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ public class GameAchievement {
|
||||
// Check if completed
|
||||
if (this.getCurProgress() >= this.getMaxProgress()) {
|
||||
this.curProgress = this.getMaxProgress();
|
||||
this.completed = Nebula.getCurrentTime();
|
||||
this.completed = Nebula.getCurrentServerTime();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ public class Agent {
|
||||
|
||||
public Agent(AgentDef data, int duration, int[] charIds) {
|
||||
this.id = data.getId();
|
||||
this.start = Nebula.getCurrentTime();
|
||||
this.start = Nebula.getCurrentServerTime();
|
||||
this.duration = duration;
|
||||
this.charIds = charIds;
|
||||
|
||||
|
||||
@@ -109,7 +109,7 @@ public class CharacterContact {
|
||||
chat.report(process, options, end);
|
||||
|
||||
// Set trigger time
|
||||
this.triggerTime = Nebula.getCurrentTime();
|
||||
this.triggerTime = Nebula.getCurrentServerTime();
|
||||
|
||||
// Add next chat
|
||||
this.addNextChat();
|
||||
|
||||
@@ -92,7 +92,7 @@ public class GameCharacter implements GameDatabaseObject {
|
||||
this.talents = new Bitset();
|
||||
this.gemPresets = new ArrayList<>();
|
||||
this.gemSlots = new CharacterGemSlot[GameConstants.CHARACTER_MAX_GEM_SLOTS];
|
||||
this.createTime = Nebula.getCurrentTime();
|
||||
this.createTime = Nebula.getCurrentServerTime();
|
||||
|
||||
this.contact = new CharacterContact(this);
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public class GameDisc implements GameDatabaseObject {
|
||||
this.data = data;
|
||||
this.discId = data.getId();
|
||||
this.level = 1;
|
||||
this.createTime = Nebula.getCurrentTime();
|
||||
this.createTime = Nebula.getCurrentServerTime();
|
||||
}
|
||||
|
||||
public void setPlayer(Player player) {
|
||||
|
||||
@@ -22,7 +22,7 @@ public class GachaHistoryLog {
|
||||
public GachaHistoryLog(int type, int gachaId, IntList results) {
|
||||
this.type = type;
|
||||
this.gid = gachaId;
|
||||
this.time = Nebula.getCurrentTime();
|
||||
this.time = Nebula.getCurrentServerTime();
|
||||
this.ids = results;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ public class GameMail {
|
||||
this.author = author;
|
||||
this.subject = subject;
|
||||
this.desc = desc;
|
||||
this.time = Nebula.getCurrentTime();
|
||||
this.time = Nebula.getCurrentServerTime();
|
||||
this.expiry = this.time + TimeUnit.DAYS.toSeconds(30);
|
||||
}
|
||||
|
||||
|
||||
@@ -146,7 +146,7 @@ public class Player implements GameDatabaseObject {
|
||||
|
||||
// Set basic info
|
||||
this.accountUid = account.getUid();
|
||||
this.createTime = Nebula.getCurrentTime();
|
||||
this.createTime = Nebula.getCurrentServerTime();
|
||||
|
||||
this.name = name;
|
||||
this.signature = "";
|
||||
@@ -532,7 +532,7 @@ public class Player implements GameDatabaseObject {
|
||||
|
||||
public int getEnergy() {
|
||||
// Cache time
|
||||
long time = Nebula.getCurrentTime();
|
||||
long time = Nebula.getCurrentServerTime();
|
||||
|
||||
// Calculate time diff
|
||||
double diff = time - this.energyLastUpdate;
|
||||
@@ -819,7 +819,7 @@ public class Player implements GameDatabaseObject {
|
||||
|
||||
public PlayerInfo toProto() {
|
||||
PlayerInfo proto = PlayerInfo.newInstance()
|
||||
.setServerTs(Nebula.getCurrentTime())
|
||||
.setServerTs(Nebula.getCurrentServerTime())
|
||||
.setSigninIndex(this.getSignInIndex())
|
||||
.setTowerTicket(this.getProgress().getTowerTickets())
|
||||
.setDailyShopRewardStatus(this.getQuestManager().hasDailyReward())
|
||||
@@ -1023,7 +1023,7 @@ public class Player implements GameDatabaseObject {
|
||||
}
|
||||
|
||||
public Energy getEnergyProto() {
|
||||
long nextDuration = Math.max(GameConstants.ENERGY_REGEN_TIME - (Nebula.getCurrentTime() - getEnergyLastUpdate()), 1);
|
||||
long nextDuration = Math.max(GameConstants.ENERGY_REGEN_TIME - (Nebula.getCurrentServerTime() - getEnergyLastUpdate()), 1);
|
||||
|
||||
var proto = Energy.newInstance()
|
||||
.setUpdateTime(this.getEnergyLastUpdate())
|
||||
|
||||
@@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import emu.nebula.Nebula;
|
||||
import emu.nebula.data.GameData;
|
||||
import emu.nebula.game.GameContext;
|
||||
import emu.nebula.game.GameContextModule;
|
||||
import emu.nebula.proto.ScoreBossRank.ScoreBossRankData;
|
||||
@@ -11,6 +12,8 @@ import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public class ScoreBossModule extends GameContextModule {
|
||||
private int seasonId;
|
||||
|
||||
private long lastUpdate;
|
||||
private long nextUpdate;
|
||||
private List<ScoreBossRankData> ranking;
|
||||
@@ -21,9 +24,25 @@ public class ScoreBossModule extends GameContextModule {
|
||||
this.ranking = new ArrayList<>();
|
||||
}
|
||||
|
||||
// TODO calculate from bin data
|
||||
public int getControlId() {
|
||||
return 2;
|
||||
return this.seasonId;
|
||||
}
|
||||
|
||||
public void updateSeason() {
|
||||
int season = 1;
|
||||
long time = Nebula.getCurrentServerTime();
|
||||
|
||||
for (var data : GameData.getScoreBossControlDataTable()) {
|
||||
if (data.getId() <= season) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (time >= data.getStartDate()) {
|
||||
season = data.getId();
|
||||
}
|
||||
}
|
||||
|
||||
this.seasonId = season;
|
||||
}
|
||||
|
||||
private long getRefreshTime() {
|
||||
@@ -56,6 +75,6 @@ public class ScoreBossModule extends GameContextModule {
|
||||
}
|
||||
|
||||
this.nextUpdate = System.currentTimeMillis() + this.getRefreshTime();
|
||||
this.lastUpdate = Nebula.getCurrentTime();
|
||||
this.lastUpdate = Nebula.getCurrentServerTime();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user