From 24c9a5e887205723efb7f28003120edc2fab10cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=BA=A1=E7=81=B5=E6=9A=B4=E9=BE=99=E5=A4=A7=E5=B8=9D?= Date: Tue, 2 Jul 2024 17:56:14 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=80=E4=BA=9B=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20&=20config=E5=8F=AF=E9=85=8D=E7=BD=AE=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E8=87=AA=E5=8A=A8=E8=A7=A3=E9=94=81=E5=85=A8=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../grasscutter/config/ConfigContainer.java | 3 ++- .../game/player/PlayerProgressManager.java | 19 ++++++++++++++----- .../packet/recv/HandlerTowerAllDataReq.java | 4 ++-- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/main/java/emu/grasscutter/config/ConfigContainer.java b/src/main/java/emu/grasscutter/config/ConfigContainer.java index e80b51a0afe..489a8fb498f 100644 --- a/src/main/java/emu/grasscutter/config/ConfigContainer.java +++ b/src/main/java/emu/grasscutter/config/ConfigContainer.java @@ -165,6 +165,7 @@ public static class HTTP { } public static class Game { + public boolean loginUnlockMap = true; //开局是否默认解锁全图 public String bindAddress = "0.0.0.0"; public int bindPort = 22102; @@ -419,7 +420,7 @@ public VisionOptions(String name, int visionRange, int gridWidth) { } public static class JoinOptions { - public static String noticeMessage = "Welcome to a Grasscutter server."; + public String noticeMessage = "Welcome to a Grasscutter server."; public int[] welcomeEmotes = {2007, 1002, 4010}; public String welcomeMessage = "Welcome to a Grasscutter server."; public JoinOptions.Mail welcomeMail = new JoinOptions.Mail(); diff --git a/src/main/java/emu/grasscutter/game/player/PlayerProgressManager.java b/src/main/java/emu/grasscutter/game/player/PlayerProgressManager.java index a80ca100b83..266043e3597 100644 --- a/src/main/java/emu/grasscutter/game/player/PlayerProgressManager.java +++ b/src/main/java/emu/grasscutter/game/player/PlayerProgressManager.java @@ -1,6 +1,6 @@ package emu.grasscutter.game.player; -import static emu.grasscutter.config.Configuration.GAME_OPTIONS; +import static emu.grasscutter.config.Configuration.GAME_INFO; import static emu.grasscutter.scripts.constants.EventType.EVENT_UNLOCK_TRANS_POINT; import emu.grasscutter.data.GameData; @@ -13,8 +13,10 @@ import emu.grasscutter.scripts.data.ScriptArgs; import emu.grasscutter.server.packet.send.*; import java.util.HashSet; +import java.util.List; import java.util.Set; import java.util.stream.Collectors; +import java.util.stream.IntStream; // @Entity public final class PlayerProgressManager extends BasePlayerDataManager { @@ -85,12 +87,19 @@ public void onPlayerLogin() { // Add statue quests if necessary. this.addStatueQuestsOnLogin(); - if (!GAME_OPTIONS.questing.enabled) { - // Auto-unlock the first statue and map area. + final List sceneAreas = IntStream.range(1, 1000).boxed().toList(); + if (GAME_INFO.loginUnlockMap) { + //解锁全图 + this.player.getUnlockedSceneAreas(3).addAll(sceneAreas); + this.player.getUnlockedSceneAreas(4).addAll(sceneAreas); + this.player.getUnlockedSceneAreas(5).addAll(sceneAreas); + this.player.getUnlockedSceneAreas(6).addAll(sceneAreas); + this.player.getUnlockedSceneAreas(7).addAll(sceneAreas); + GameData.getScenePointsPerScene().forEach((sceneId, scenePoints) -> this.player.getUnlockedScenePoints(sceneId).addAll(scenePoints)); + } else { + // 只解锁出生点锚点和星落湖神像 this.player.getUnlockedScenePoints(3).add(7); this.player.getUnlockedSceneAreas(3).add(1); - // Allow the player to visit all areas. - this.setOpenState(47, 1, true); } } diff --git a/src/main/java/emu/grasscutter/server/packet/recv/HandlerTowerAllDataReq.java b/src/main/java/emu/grasscutter/server/packet/recv/HandlerTowerAllDataReq.java index aaf410a5322..bd991c555d8 100644 --- a/src/main/java/emu/grasscutter/server/packet/recv/HandlerTowerAllDataReq.java +++ b/src/main/java/emu/grasscutter/server/packet/recv/HandlerTowerAllDataReq.java @@ -1,7 +1,7 @@ package emu.grasscutter.server.packet.recv; import emu.grasscutter.net.packet.*; -import emu. grasscutter.config.ConfigContainer.JoinOptions; +import static emu.grasscutter.config.Configuration.GAME_INFO; import emu.grasscutter.server.game.GameSession; import emu.grasscutter.server.packet.send.PacketAntiAddictNotify; import emu.grasscutter.server.packet.send.PacketTowerAllDataRsp; @@ -11,7 +11,7 @@ public class HandlerTowerAllDataReq extends PacketHandler { @Override public void handle(GameSession session, byte[] header, byte[] payload) throws Exception { - session.send(new PacketAntiAddictNotify(1, JoinOptions.noticeMessage)); + session.send(new PacketAntiAddictNotify(1, GAME_INFO.joinOptions.noticeMessage)); session.send( new PacketTowerAllDataRsp( session.getServer().getTowerSystem(), session.getPlayer().getTowerManager()));