Skip to content

Commit

Permalink
修复一些问题 & config可配置是否自动解锁全图
Browse files Browse the repository at this point in the history
  • Loading branch information
亡灵暴龙大帝 committed Jul 2, 2024
1 parent 857025d commit 24c9a5e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/main/java/emu/grasscutter/config/ConfigContainer.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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 {
Expand Down Expand Up @@ -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<Integer> 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);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -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()));
Expand Down

0 comments on commit 24c9a5e

Please sign in to comment.