启动器新增游戏设置页(频道开关+活动开关),窗口标题改名
- 服务端新增活动开关运行时配置与 GM 接口(GET/POST /dnf/gm/activity-switches), 持久化到 Settings,接入月签到/周签到/PC房↔累计在线的实时下发 - 服务端新增频道开关 GM 接口(channel-switches),目录生成时过滤禁用频道 - channelcatalog/channelinfo 支持按禁用频道 ID 过滤目录与客户端脚本 - 启动器新增「游戏设置」页面:频道开关 Tab + 活动开关 Tab - native.py/server.py 新增对应转发 API - 窗口标题/页面 title/侧边栏「90轮回」统一改为「DNF90 灵狐小竹整合单机版」
This commit is contained in:
1 parent
977a4a1196
commit
0ced464168
15 files changed
+1022
-14
No files matched your search
@@ -34,6 +34,9 @@ type Options struct {
|
||||
GamePortBase int
|
||||
MaxUsers int
|
||||
CurrentUsers int
|
||||
// DisabledIDs 是运行时被关闭的频道 ID 集合(来自启动器「频道开关」)。
|
||||
// 这些频道不进入目录,也不会开游戏端口监听。
|
||||
DisabledIDs map[int]bool
|
||||
}
|
||||
|
||||
// Catalog 是从 channel_info.etc 派生的只读频道目录。
|
||||
@@ -56,6 +59,9 @@ func New(index *channelinfo.Index, options Options) (*Catalog, error) {
|
||||
if item.ID <= 0 {
|
||||
continue
|
||||
}
|
||||
if options.DisabledIDs != nil && options.DisabledIDs[item.ID] {
|
||||
continue
|
||||
}
|
||||
if _, ok := seen[item.ID]; ok {
|
||||
continue
|
||||
}
|
||||
|
||||
@@ -17,7 +17,13 @@ import (
|
||||
// 严格版:源表缺少引导频道时直接失败。只开少数频道(甚至只开特殊区域频道)的运维配置
|
||||
// 请走 Build90CNOnlineScriptAllowingMissingBootstrap。
|
||||
func Build90CNOnlineScript(data []byte, sourceServerID, advertiseServerID, bootstrapChannelID int) ([]byte, error) {
|
||||
script, bootstrapFound, err := build90CNOnlineScript(data, sourceServerID, advertiseServerID, bootstrapChannelID)
|
||||
return Build90CNOnlineScriptFiltered(data, sourceServerID, advertiseServerID, bootstrapChannelID, nil)
|
||||
}
|
||||
|
||||
// Build90CNOnlineScriptFiltered 是 Build90CNOnlineScript 的带禁用频道过滤版。
|
||||
// disabledIDs 里的频道不会进入下发给客户端的频道表(与 channelcatalog 的过滤保持一致)。
|
||||
func Build90CNOnlineScriptFiltered(data []byte, sourceServerID, advertiseServerID, bootstrapChannelID int, disabledIDs map[int]bool) ([]byte, error) {
|
||||
script, bootstrapFound, err := build90CNOnlineScript(data, sourceServerID, advertiseServerID, bootstrapChannelID, disabledIDs)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -45,12 +51,22 @@ func Build90CNOnlineScriptAllowingMissingBootstrap(
|
||||
data []byte,
|
||||
sourceServerID, advertiseServerID, bootstrapChannelID int,
|
||||
) ([]byte, bool, error) {
|
||||
return build90CNOnlineScript(data, sourceServerID, advertiseServerID, bootstrapChannelID)
|
||||
return build90CNOnlineScript(data, sourceServerID, advertiseServerID, bootstrapChannelID, nil)
|
||||
}
|
||||
|
||||
// Build90CNOnlineScriptAllowingMissingBootstrapFiltered 是带禁用频道过滤的宽松版。
|
||||
func Build90CNOnlineScriptAllowingMissingBootstrapFiltered(
|
||||
data []byte,
|
||||
sourceServerID, advertiseServerID, bootstrapChannelID int,
|
||||
disabledIDs map[int]bool,
|
||||
) ([]byte, bool, error) {
|
||||
return build90CNOnlineScript(data, sourceServerID, advertiseServerID, bootstrapChannelID, disabledIDs)
|
||||
}
|
||||
|
||||
func build90CNOnlineScript(
|
||||
data []byte,
|
||||
sourceServerID, advertiseServerID, bootstrapChannelID int,
|
||||
disabledIDs map[int]bool,
|
||||
) ([]byte, bool, error) {
|
||||
if sourceServerID <= 0 || advertiseServerID < 0 || bootstrapChannelID <= 0 {
|
||||
return nil, false, errors.New("channel script source, advertisement, and bootstrap IDs are invalid")
|
||||
@@ -124,6 +140,10 @@ func build90CNOnlineScript(
|
||||
if activeServer == sourceServerID {
|
||||
record := append([]string(nil), fields[start:end]...)
|
||||
id, _ := strconv.Atoi(record[0])
|
||||
if disabledIDs != nil && disabledIDs[id] {
|
||||
start = end
|
||||
continue
|
||||
}
|
||||
channelType, _ := strconv.Atoi(record[2])
|
||||
record[2] = strconv.Itoa(OnlineTypeFor90CN(id, channelType))
|
||||
if id == bootstrapChannelID {
|
||||
|
||||
Reference in new issue
Block a user