Add a config option to unlock all story CGs

This commit is contained in:
Melledy
2025-12-15 07:12:49 -08:00
parent f439b25f2a
commit ee5d759a98
5 changed files with 65 additions and 4 deletions

View File

@@ -109,6 +109,8 @@ public class Config {
public boolean skipIntro = false;
// Unlocks all instances (Monolith, Bounty Trials, etc) for players to enter without needing to do the previous levels.
public boolean unlockInstances = true;
// Unlocks all story CGs to use in the showcase
public boolean unlockAllStoryCGs = false;
// How long to wait (in seconds) after the last http request from a session before removing it from the server.
public int sessionTimeout = 300;
// The offset hour for when daily quests are refreshed in UTC. Example: "dailyResetHour = 4" means dailies will be refreshed at UTC+4 12:00 AM every day.
@@ -149,10 +151,10 @@ public class Config {
this.sender = "Server";
this.content = "Welcome to Nebula! Please take these items as a starter gift.";
this.attachments = List.of(
new ItemParam(86009, 1),
new ItemParam(86002, 1),
new ItemParam(1, 1_000_000),
new ItemParam(2, 30_000));
new ItemParam(86009, 1),
new ItemParam(86002, 1),
new ItemParam(1, 1_000_000),
new ItemParam(2, 30_000));
}
}

View File

@@ -95,6 +95,8 @@ public class GameData {
@Getter private static DataTable<StorySetSectionDef> StorySetSectionDataTable = new DataTable<>();
@Getter private static DataTable<StoryEvidenceDef> StoryEvidenceDataTable = new DataTable<>();
@Getter private static DataTable<MainScreenCGDef> MainScreenCGDataTable = new DataTable<>();
// ===== Daily Quests =====
@Getter private static DataTable<DailyQuestDef> DailyQuestDataTable = new DataTable<>();
@Getter private static DataTable<DailyQuestActiveDef> DailyQuestActiveDataTable = new DataTable<>();

View File

@@ -0,0 +1,19 @@
package emu.nebula.data.resources;
import emu.nebula.data.BaseDef;
import emu.nebula.data.ResourceType;
import emu.nebula.data.ResourceType.LoadPriority;
import lombok.Getter;
@Getter
@ResourceType(name = "MainScreenCG.json", loadPriority = LoadPriority.LOW)
public class MainScreenCGDef extends BaseDef {
private int Id;
private boolean IsShown;
@Override
public int getId() {
return Id;
}
}

View File

@@ -970,6 +970,7 @@ public class Player implements GameDatabaseObject {
// Handbook
proto.addHandbook(this.getCharacters().getCharacterHandbook());
proto.addHandbook(this.getCharacters().getDiscHandbook());
proto.addHandbook(this.getStoryManager().getCgHandbook());
// Phone
var phone = proto.getMutablePhone();

View File

@@ -12,9 +12,12 @@ import emu.nebula.database.GameDatabaseObject;
import emu.nebula.game.player.Player;
import emu.nebula.game.player.PlayerChangeInfo;
import emu.nebula.game.player.PlayerManager;
import emu.nebula.net.NetMsgId;
import emu.nebula.proto.PlayerData.PlayerInfo;
import emu.nebula.proto.Public.HandbookInfo;
import emu.nebula.proto.Public.Story;
import emu.nebula.proto.StorySett.StorySettle;
import emu.nebula.util.Bitset;
import it.unimi.dsi.fastutil.ints.Int2IntMap;
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
@@ -75,6 +78,7 @@ public class StoryManager extends PlayerManager implements GameDatabaseObject {
public PlayerChangeInfo settle(RepeatedMessage<StorySettle> list, RepeatedInt evidences) {
// Player change info
var change = new PlayerChangeInfo();
boolean updateHandbook = false;
// Handle regular story
for (var settle : list) {
@@ -118,6 +122,14 @@ public class StoryManager extends PlayerManager implements GameDatabaseObject {
Nebula.getGameDatabase().addToSet(this, this.getPlayerUid(), "evidences", id);
}
// Update handbook
if (updateHandbook) {
this.getPlayer().addNextPackage(
NetMsgId.handbook_change_notify,
this.getCgHandbook()
);
}
// Clear current story
this.storyId = 0;
@@ -185,6 +197,31 @@ public class StoryManager extends PlayerManager implements GameDatabaseObject {
return changes;
}
// Handbook
public HandbookInfo getCgHandbook() {
var bitset = new Bitset();
if (Nebula.getConfig().getServerOptions().unlockAllStoryCGs) {
for (var data : GameData.getMainScreenCGDataTable()) {
// Get handbook data
var handbookData = GameData.getHandbookDataTable().get(data.getId());
if (handbookData == null || handbookData.getType() != 3) {
continue;
}
// Set flag
bitset.setBit(handbookData.getIndex());
}
}
var handbook = HandbookInfo.newInstance()
.setType(3)
.setData(bitset.toByteArray());
return handbook;
}
// Proto
public void encodePlayerInfo(PlayerInfo proto) {