mirror of
https://github.com/Melledy/Nebula.git
synced 2025-12-22 17:24:45 +01:00
Add a config option to unlock all story CGs
This commit is contained in:
@@ -109,6 +109,8 @@ public class Config {
|
|||||||
public boolean skipIntro = false;
|
public boolean skipIntro = false;
|
||||||
// Unlocks all instances (Monolith, Bounty Trials, etc) for players to enter without needing to do the previous levels.
|
// Unlocks all instances (Monolith, Bounty Trials, etc) for players to enter without needing to do the previous levels.
|
||||||
public boolean unlockInstances = true;
|
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.
|
// How long to wait (in seconds) after the last http request from a session before removing it from the server.
|
||||||
public int sessionTimeout = 300;
|
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.
|
// 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.sender = "Server";
|
||||||
this.content = "Welcome to Nebula! Please take these items as a starter gift.";
|
this.content = "Welcome to Nebula! Please take these items as a starter gift.";
|
||||||
this.attachments = List.of(
|
this.attachments = List.of(
|
||||||
new ItemParam(86009, 1),
|
new ItemParam(86009, 1),
|
||||||
new ItemParam(86002, 1),
|
new ItemParam(86002, 1),
|
||||||
new ItemParam(1, 1_000_000),
|
new ItemParam(1, 1_000_000),
|
||||||
new ItemParam(2, 30_000));
|
new ItemParam(2, 30_000));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -95,6 +95,8 @@ public class GameData {
|
|||||||
@Getter private static DataTable<StorySetSectionDef> StorySetSectionDataTable = new DataTable<>();
|
@Getter private static DataTable<StorySetSectionDef> StorySetSectionDataTable = new DataTable<>();
|
||||||
@Getter private static DataTable<StoryEvidenceDef> StoryEvidenceDataTable = new DataTable<>();
|
@Getter private static DataTable<StoryEvidenceDef> StoryEvidenceDataTable = new DataTable<>();
|
||||||
|
|
||||||
|
@Getter private static DataTable<MainScreenCGDef> MainScreenCGDataTable = new DataTable<>();
|
||||||
|
|
||||||
// ===== Daily Quests =====
|
// ===== Daily Quests =====
|
||||||
@Getter private static DataTable<DailyQuestDef> DailyQuestDataTable = new DataTable<>();
|
@Getter private static DataTable<DailyQuestDef> DailyQuestDataTable = new DataTable<>();
|
||||||
@Getter private static DataTable<DailyQuestActiveDef> DailyQuestActiveDataTable = new DataTable<>();
|
@Getter private static DataTable<DailyQuestActiveDef> DailyQuestActiveDataTable = new DataTable<>();
|
||||||
|
|||||||
19
src/main/java/emu/nebula/data/resources/MainScreenCGDef.java
Normal file
19
src/main/java/emu/nebula/data/resources/MainScreenCGDef.java
Normal 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -970,6 +970,7 @@ public class Player implements GameDatabaseObject {
|
|||||||
// Handbook
|
// Handbook
|
||||||
proto.addHandbook(this.getCharacters().getCharacterHandbook());
|
proto.addHandbook(this.getCharacters().getCharacterHandbook());
|
||||||
proto.addHandbook(this.getCharacters().getDiscHandbook());
|
proto.addHandbook(this.getCharacters().getDiscHandbook());
|
||||||
|
proto.addHandbook(this.getStoryManager().getCgHandbook());
|
||||||
|
|
||||||
// Phone
|
// Phone
|
||||||
var phone = proto.getMutablePhone();
|
var phone = proto.getMutablePhone();
|
||||||
|
|||||||
@@ -12,9 +12,12 @@ import emu.nebula.database.GameDatabaseObject;
|
|||||||
import emu.nebula.game.player.Player;
|
import emu.nebula.game.player.Player;
|
||||||
import emu.nebula.game.player.PlayerChangeInfo;
|
import emu.nebula.game.player.PlayerChangeInfo;
|
||||||
import emu.nebula.game.player.PlayerManager;
|
import emu.nebula.game.player.PlayerManager;
|
||||||
|
import emu.nebula.net.NetMsgId;
|
||||||
import emu.nebula.proto.PlayerData.PlayerInfo;
|
import emu.nebula.proto.PlayerData.PlayerInfo;
|
||||||
|
import emu.nebula.proto.Public.HandbookInfo;
|
||||||
import emu.nebula.proto.Public.Story;
|
import emu.nebula.proto.Public.Story;
|
||||||
import emu.nebula.proto.StorySett.StorySettle;
|
import emu.nebula.proto.StorySett.StorySettle;
|
||||||
|
import emu.nebula.util.Bitset;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2IntMap;
|
import it.unimi.dsi.fastutil.ints.Int2IntMap;
|
||||||
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
|
import it.unimi.dsi.fastutil.ints.Int2IntOpenHashMap;
|
||||||
import it.unimi.dsi.fastutil.ints.IntOpenHashSet;
|
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) {
|
public PlayerChangeInfo settle(RepeatedMessage<StorySettle> list, RepeatedInt evidences) {
|
||||||
// Player change info
|
// Player change info
|
||||||
var change = new PlayerChangeInfo();
|
var change = new PlayerChangeInfo();
|
||||||
|
boolean updateHandbook = false;
|
||||||
|
|
||||||
// Handle regular story
|
// Handle regular story
|
||||||
for (var settle : list) {
|
for (var settle : list) {
|
||||||
@@ -118,6 +122,14 @@ public class StoryManager extends PlayerManager implements GameDatabaseObject {
|
|||||||
Nebula.getGameDatabase().addToSet(this, this.getPlayerUid(), "evidences", id);
|
Nebula.getGameDatabase().addToSet(this, this.getPlayerUid(), "evidences", id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update handbook
|
||||||
|
if (updateHandbook) {
|
||||||
|
this.getPlayer().addNextPackage(
|
||||||
|
NetMsgId.handbook_change_notify,
|
||||||
|
this.getCgHandbook()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Clear current story
|
// Clear current story
|
||||||
this.storyId = 0;
|
this.storyId = 0;
|
||||||
|
|
||||||
@@ -185,6 +197,31 @@ public class StoryManager extends PlayerManager implements GameDatabaseObject {
|
|||||||
return changes;
|
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
|
// Proto
|
||||||
|
|
||||||
public void encodePlayerInfo(PlayerInfo proto) {
|
public void encodePlayerInfo(PlayerInfo proto) {
|
||||||
|
|||||||
Reference in New Issue
Block a user