DNF90 服务端与启动器完整源码(含 GM 工具功能增强)
服务端(Go): - GM 塞背包/带属性装备发放:在线角色推送 op14 增量物品行,背包实时刷新,无需回角色选择界面 - GM 改金币/改等级:去掉在线拒绝,落库后推送 op14 钱包/op37 等级状态,在线实时刷新 - 等级端点统一切换到新版 GMSetCharacterLevel(自带在线刷新) - 无限/锁死疲劳模式 + 燃烧疲劳:每房间消耗 2 点、打怪与通关经验双倍 - 燃烧疲劳开关时给所有在线角色推送系统提示(op12 mode 0) - 深渊史诗掉率:GM 全局倍率 + 城镇增益药剂窗口倍率,真实接入掉落结算 启动器(Python/JS): - 标题栏自绘、窗口 1204x717、禁止拖拽改大小、仅最小化/关闭 - GM 工具:疲劳与燃烧、深渊史诗掉率、拍卖行上架(单一定价对齐) - 拍卖行上架前端对齐服务端单一价格语义,修复 400 报错
This commit is contained in:
commit
645b64fe21
4388 files changed
+1405457
No files matched your search
@@ -0,0 +1,84 @@
|
||||
package dnfbridge
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
dnfrepo "longheng.io/server/internal/modules/dnf/repository"
|
||||
)
|
||||
|
||||
func (s *Service) repositoryGroup() (dnfrepo.Group, bool) {
|
||||
if s == nil || s.repositoryProvider == nil {
|
||||
return dnfrepo.Group{}, false
|
||||
}
|
||||
return s.repositoryProvider()
|
||||
}
|
||||
|
||||
// identityRequired reports whether this server refuses to fall back to the
|
||||
// instance account. Both the ticket gate and an enforced launcher identity mean
|
||||
// the same thing here: an unbound request is unauthenticated traffic and must
|
||||
// never inherit the operator's identity.
|
||||
func (s *Service) identityRequired() bool {
|
||||
if s == nil {
|
||||
return false
|
||||
}
|
||||
return s.options.launcherAuthEnabled || s.launcherIdentity.enforcing()
|
||||
}
|
||||
|
||||
// accountID returns the instance-level account. With launcher auth or an
|
||||
// enforced launcher identity there is no instance default account: a request
|
||||
// that reaches this point is unauthenticated external traffic and must never
|
||||
// fall back to the local dnf:1 / DNFBRIDGE_ACCOUNT_ID identity (that would
|
||||
// silently merge public players into the operator account).
|
||||
func (s *Service) accountID() string {
|
||||
if s.identityRequired() {
|
||||
return ""
|
||||
}
|
||||
if s != nil {
|
||||
if value := strings.TrimSpace(s.options.accountID); value != "" {
|
||||
return value
|
||||
}
|
||||
prefix := strings.TrimSpace(s.options.accountPrefix)
|
||||
if prefix == "" {
|
||||
prefix = defaultAccountPrefix
|
||||
}
|
||||
return prefix + "1"
|
||||
}
|
||||
return defaultAccountPrefix + "1"
|
||||
}
|
||||
|
||||
func (s *Service) accountIDForSession(sessions ...*gameSession) string {
|
||||
if len(sessions) > 0 && sessions[0] != nil {
|
||||
if value := strings.TrimSpace(sessions[0].accountID); value != "" {
|
||||
return value
|
||||
}
|
||||
if value, found := s.registeredClientAccount(sessions[0].clientPID); found {
|
||||
return value
|
||||
}
|
||||
if s.identityRequired() {
|
||||
// Identity is required yet this session carries no launcher-bound
|
||||
// account. Reject the connection outright instead of leaking it
|
||||
// into the instance fallback; gameplay handlers that reach this
|
||||
// point are invoked with a session whose connection is closed.
|
||||
session := sessions[0]
|
||||
s.logPacketEvent("game-launcher-auth-rejected",
|
||||
"conn_id", session.connID,
|
||||
"remote", session.conn.RemoteAddr().String(),
|
||||
"local", session.conn.LocalAddr().String(),
|
||||
"channel_id", session.channel.ID,
|
||||
"channel_type", session.channel.Type,
|
||||
"game_port", session.channel.Port,
|
||||
"reason", "account-fallback-under-launcher-auth")
|
||||
s.logWarn("dnfbridge rejected account fallback under launcher auth",
|
||||
"conn_id", session.connID,
|
||||
"remote", session.conn.RemoteAddr().String(),
|
||||
"account_id", session.accountID)
|
||||
_ = session.conn.Close()
|
||||
return ""
|
||||
}
|
||||
}
|
||||
if s.identityRequired() {
|
||||
s.logWarn("dnfbridge account fallback rejected under launcher auth (no session)")
|
||||
return ""
|
||||
}
|
||||
return s.accountID()
|
||||
}
|
||||
Reference in new issue
Block a user