Files
hanfuit 645b64fe21 DNF90 服务端与启动器完整源码(含 GM 工具功能增强)
服务端(Go):
- GM 塞背包/带属性装备发放:在线角色推送 op14 增量物品行,背包实时刷新,无需回角色选择界面
- GM 改金币/改等级:去掉在线拒绝,落库后推送 op14 钱包/op37 等级状态,在线实时刷新
- 等级端点统一切换到新版 GMSetCharacterLevel(自带在线刷新)
- 无限/锁死疲劳模式 + 燃烧疲劳:每房间消耗 2 点、打怪与通关经验双倍
- 燃烧疲劳开关时给所有在线角色推送系统提示(op12 mode 0)
- 深渊史诗掉率:GM 全局倍率 + 城镇增益药剂窗口倍率,真实接入掉落结算

启动器(Python/JS):
- 标题栏自绘、窗口 1204x717、禁止拖拽改大小、仅最小化/关闭
- GM 工具:疲劳与燃烧、深渊史诗掉率、拍卖行上架(单一定价对齐)
- 拍卖行上架前端对齐服务端单一价格语义,修复 400 报错
2026-11-04 14:31:55 +08:00

98 lines
3.4 KiB
Go

package dnfbridge
import (
"context"
"fmt"
"strconv"
dnfrepo "longheng.io/server/internal/modules/dnf/repository"
)
// currentActiveQuestSnapshotMsgID is registered by the current EXE at
// sub_1D632D0. The older 86JP client used 0x023F for the analogous
// notification; that numeric ID is not registered by this client version.
const currentActiveQuestSnapshotMsgID = uint16(0x023E)
func buildCurrentActiveQuestSnapshotBody(record dnfrepo.QuestRecord, hasRecord bool) []byte {
rows := currentSelectAckQuestRows(record, hasRecord)
var writer packetWriter
writer.writeUint32(uint32(len(rows)))
for _, row := range rows {
writer.writeUint16(row.questID)
writer.writeUint32(row.triggerValue)
}
return writer.bytes()
}
func (s *Service) sendCurrentActiveQuestSnapshotFromCommittedQuest(
session *gameSession,
record dnfrepo.QuestRecord,
source string,
) error {
if session == nil || session.selectedCharacterID == 0 {
return nil
}
characterID := strconv.Itoa(int(session.selectedCharacterID))
if record.CharacterID != characterID {
return fmt.Errorf("committed active quest snapshot owner mismatch: selected=%s record=%q", characterID, record.CharacterID)
}
body := buildCurrentActiveQuestSnapshotBody(record, true)
rows := currentSelectAckQuestRows(record, true)
s.logGameEvent(session, "game-upper-current-active-quest-snapshot-send",
"char_id", session.selectedCharacterID,
"msg_id", currentActiveQuestSnapshotMsgID,
"classification", 0,
"source", source,
"quest_record_found", true,
"active_count", len(rows),
"body_len", len(body),
"body_source", "current_exe_sub_1D632D0_u32_count_u16_quest_u32_trigger")
return s.sendGameUpperRawClass(session, currentActiveQuestSnapshotMsgID, body, 0)
}
func (s *Service) sendCurrentActiveQuestSnapshotForSession(session *gameSession, source string) error {
if s == nil || session == nil || session.selectedCharacterID == 0 {
return nil
}
repositories, ok := s.repositoryGroup()
if !ok || repositories.Quest == nil {
s.logGameEvent(session, "game-upper-current-active-quest-snapshot-skipped",
"char_id", session.selectedCharacterID,
"msg_id", currentActiveQuestSnapshotMsgID,
"source", source,
"reason", "quest_repository_unavailable")
return nil
}
ctx, cancel := context.WithTimeout(context.Background(), createWriteTimeout)
record, found, err := repositories.Quest.Load(ctx, strconv.Itoa(int(session.selectedCharacterID)))
if err != nil {
cancel()
s.logGameEvent(session, "game-upper-current-active-quest-snapshot-skipped",
"char_id", session.selectedCharacterID,
"msg_id", currentActiveQuestSnapshotMsgID,
"source", source,
"reason", "quest_record_load_failed",
"error", err)
return nil
}
if !found {
record = dnfrepo.QuestRecord{CharacterID: strconv.Itoa(int(session.selectedCharacterID))}
} else {
record = s.reconcileLegacySaturatedActiveQuestTriggers(ctx, session, repositories.Quest, record)
}
cancel()
body := buildCurrentActiveQuestSnapshotBody(record, found)
rows := currentSelectAckQuestRows(record, found)
s.logGameEvent(session, "game-upper-current-active-quest-snapshot-send",
"char_id", session.selectedCharacterID,
"msg_id", currentActiveQuestSnapshotMsgID,
"classification", 0,
"source", source,
"quest_record_found", found,
"active_count", len(rows),
"body_len", len(body),
"body_source", "current_exe_sub_1D632D0_u32_count_u16_quest_u32_trigger")
return s.sendGameUpperRawClass(session, currentActiveQuestSnapshotMsgID, body, 0)
}