mirror of
https://github.com/Melledy/Nebula.git
synced 2026-09-20 01:29:54 +02:00
Add a config option to unlock all story CGs
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user