mirror of
https://github.com/Melledy/LunarCore.git
synced 2025-12-14 06:14:45 +01:00
Unhardcode rogue schedule id
This commit is contained in:
@@ -30,6 +30,7 @@ public class GameData {
|
|||||||
@Getter private static Int2ObjectMap<ChallengeExcel> challengeExcelMap = new Int2ObjectOpenHashMap<>();
|
@Getter private static Int2ObjectMap<ChallengeExcel> challengeExcelMap = new Int2ObjectOpenHashMap<>();
|
||||||
@Getter private static Int2ObjectMap<ChallengeTargetExcel> challengeTargetExcelMap = new Int2ObjectOpenHashMap<>();
|
@Getter private static Int2ObjectMap<ChallengeTargetExcel> challengeTargetExcelMap = new Int2ObjectOpenHashMap<>();
|
||||||
@Getter private static Int2ObjectMap<RogueAreaExcel> rogueAreaExcelMap = new Int2ObjectOpenHashMap<>();
|
@Getter private static Int2ObjectMap<RogueAreaExcel> rogueAreaExcelMap = new Int2ObjectOpenHashMap<>();
|
||||||
|
@Getter private static Int2ObjectMap<RogueScheduleExcel> rogueScheduleExcelMap = new Int2ObjectOpenHashMap<>();
|
||||||
@Getter private static Int2ObjectMap<ShopExcel> shopExcelMap = new Int2ObjectOpenHashMap<>();
|
@Getter private static Int2ObjectMap<ShopExcel> shopExcelMap = new Int2ObjectOpenHashMap<>();
|
||||||
|
|
||||||
private static Int2ObjectMap<AvatarPromotionExcel> avatarPromotionExcelMap = new Int2ObjectOpenHashMap<>();
|
private static Int2ObjectMap<AvatarPromotionExcel> avatarPromotionExcelMap = new Int2ObjectOpenHashMap<>();
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import emu.lunarcore.data.excel.RelicMainAffixExcel;
|
import emu.lunarcore.data.excel.RelicMainAffixExcel;
|
||||||
import emu.lunarcore.data.excel.RelicSubAffixExcel;
|
import emu.lunarcore.data.excel.RelicSubAffixExcel;
|
||||||
|
import emu.lunarcore.data.excel.RogueScheduleExcel;
|
||||||
import emu.lunarcore.util.Utils;
|
import emu.lunarcore.util.Utils;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectMap;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||||
@@ -34,4 +35,17 @@ public class GameDepot {
|
|||||||
public static List<RelicSubAffixExcel> getRelicSubAffixList(int groupId) {
|
public static List<RelicSubAffixExcel> getRelicSubAffixList(int groupId) {
|
||||||
return relicSubAffixDepot.get(groupId);
|
return relicSubAffixDepot.get(groupId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO cache this so we dont have to run this function everytime we get the schedule
|
||||||
|
public static RogueScheduleExcel getCurrentRogueSchedule() {
|
||||||
|
long time = System.currentTimeMillis();
|
||||||
|
|
||||||
|
for (var schedule : GameData.getRogueScheduleExcelMap().values()) {
|
||||||
|
if (time >= schedule.getBeginTime() && time < schedule.getEndTime()) {
|
||||||
|
return schedule;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
package emu.lunarcore.data.excel;
|
||||||
|
|
||||||
|
import java.time.*;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
|
import emu.lunarcore.data.GameResource;
|
||||||
|
import emu.lunarcore.data.ResourceType;
|
||||||
|
import lombok.AccessLevel;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@ResourceType(name = {"ScheduleDataRogue.json"})
|
||||||
|
public class RogueScheduleExcel extends GameResource {
|
||||||
|
private static final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||||
|
|
||||||
|
private int ID;
|
||||||
|
|
||||||
|
@Getter(AccessLevel.NONE)
|
||||||
|
private String BeginTime;
|
||||||
|
@Getter(AccessLevel.NONE)
|
||||||
|
private String EndTime;
|
||||||
|
|
||||||
|
private transient long beginTime;
|
||||||
|
private transient long endTime;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getId() {
|
||||||
|
return ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onLoad() {
|
||||||
|
try {
|
||||||
|
this.beginTime = LocalDateTime.from(formatter.parse(this.BeginTime))
|
||||||
|
.atOffset(ZoneOffset.UTC)
|
||||||
|
.toInstant()
|
||||||
|
.toEpochMilli();
|
||||||
|
|
||||||
|
this.endTime = LocalDateTime.from(formatter.parse(this.EndTime))
|
||||||
|
.atOffset(ZoneOffset.UTC)
|
||||||
|
.toInstant()
|
||||||
|
.toEpochMilli();
|
||||||
|
} catch (Exception e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ package emu.lunarcore.server.packet.send;
|
|||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import emu.lunarcore.data.GameData;
|
import emu.lunarcore.data.GameData;
|
||||||
|
import emu.lunarcore.data.GameDepot;
|
||||||
import emu.lunarcore.proto.GetRogueInfoScRspOuterClass.GetRogueInfoScRsp;
|
import emu.lunarcore.proto.GetRogueInfoScRspOuterClass.GetRogueInfoScRsp;
|
||||||
import emu.lunarcore.proto.RogueAreaOuterClass.RogueArea;
|
import emu.lunarcore.proto.RogueAreaOuterClass.RogueArea;
|
||||||
import emu.lunarcore.proto.RogueAreaStatusOuterClass.RogueAreaStatus;
|
import emu.lunarcore.proto.RogueAreaStatusOuterClass.RogueAreaStatus;
|
||||||
@@ -18,10 +19,16 @@ public class PacketGetRogueInfoScRsp extends BasePacket {
|
|||||||
public PacketGetRogueInfoScRsp() {
|
public PacketGetRogueInfoScRsp() {
|
||||||
super(CmdId.GetRogueInfoScRsp);
|
super(CmdId.GetRogueInfoScRsp);
|
||||||
|
|
||||||
int seasonId = 67; // TODO un hardcode
|
var schedule = GameDepot.getCurrentRogueSchedule();
|
||||||
|
|
||||||
|
int seasonId = 0;
|
||||||
long beginTime = (System.currentTimeMillis() / 1000) - TimeUnit.DAYS.toSeconds(1);
|
long beginTime = (System.currentTimeMillis() / 1000) - TimeUnit.DAYS.toSeconds(1);
|
||||||
long endTime = beginTime + TimeUnit.DAYS.toSeconds(8);
|
long endTime = beginTime + TimeUnit.DAYS.toSeconds(8);
|
||||||
|
|
||||||
|
if (schedule != null) {
|
||||||
|
seasonId = schedule.getId() % 100000;
|
||||||
|
}
|
||||||
|
|
||||||
var score = RogueScoreRewardInfo.newInstance()
|
var score = RogueScoreRewardInfo.newInstance()
|
||||||
.setPoolId(seasonId)
|
.setPoolId(seasonId)
|
||||||
.setPoolRefreshed(true)
|
.setPoolRefreshed(true)
|
||||||
|
|||||||
Reference in New Issue
Block a user