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

97 lines
4.2 KiB
Go
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package dnfbridge
import (
"fmt"
"strings"
"time"
"longheng.io/server/internal/modules/dnf/onlineevent"
)
// Current DNF.exe registers sub_1D89E70 at notification 0x357 (855).
// Its four u32 reads are type, state, content ID, and the extra schedule
// value. sub_1DBCD80 stores {ID, state, type, extra}; the portal's
// sub_34097D0 -> sub_1DBCBD0 accepts dungeon/type 0 with state 1 or 2.
const currentDungeonScheduleNotificationID uint16 = 855
// The town's seven co-located gate NPCs use [open visible event] 2418..2424.
// 0x23A8CC5 / 0x23B030D query base-directory membership via sub_2041F70,
// not the twelve-parameter activity state. Include only today's gate in op108:
// adding all seven base rows would draw overlapping native ANI/ALS assemblies.
// Production callers supply the service clock when constructing the directory.
func currentMysteriousRuinsPortalEventID(now time.Time) uint16 {
weekday := now.In(onlineevent.ChinaCalendar).Weekday()
return 2418 + uint16((int(weekday)+6)%7) // Monday..Sunday
}
var currentMysteriousRuinsDungeons = [...]struct {
id uint32
path string
}{
{4906, "dungeon/gcontents/171116_dayofdungeon/chn_daydungeon_01.dgn"},
{4907, "dungeon/gcontents/171116_dayofdungeon/chn_daydungeon_02.dgn"},
{4908, "dungeon/gcontents/171116_dayofdungeon/chn_daydungeon_03.dgn"},
{4909, "dungeon/gcontents/171116_dayofdungeon/chn_daydungeon_04.dgn"},
{4910, "dungeon/gcontents/171116_dayofdungeon/chn_daydungeon_05.dgn"},
}
// 神秘异次元遗迹所在的城镇/区域与地图。城镇 107 = `town/chn_DayDungeon.twn`,
// 其 [area] 0 就是 `Town/DayDungeon/DayDungeon_town.map`(该 .twn 里逐字如此)。
// 阿比斯入口的放行判定要求这三者同时精确匹配,避免把放行范围扩散到其它目标。
const (
currentMysteriousRuinsTownID = 107
currentMysteriousRuinsAreaID = 0
currentMysteriousRuinsTownMapPath = "Town/DayDungeon/DayDungeon_town.map"
)
func isCurrentMysteriousRuinsTownArea(townID, areaID byte) bool {
return int(townID) == currentMysteriousRuinsTownID && int(areaID) == currentMysteriousRuinsAreaID
}
// isCurrentMysteriousRuinsTownMapPath 归一化大小写与分隔符后精确比对地图路径。
func isCurrentMysteriousRuinsTownMapPath(path string) bool {
normalized := strings.ToLower(strings.ReplaceAll(strings.TrimSpace(path), "\\", "/"))
return normalized == strings.ToLower(currentMysteriousRuinsTownMapPath)
}
func buildCurrentMysteriousRuinsScheduleBody(dungeonID uint32) []byte {
var writer packetWriter
writer.writeUint32(0) // native dungeon schedule category
writer.writeUint32(1) // open; the local profile opens these five all day
writer.writeUint32(dungeonID)
writer.writeUint32(0)
return writer.bytes()
}
func (s *Service) sendCurrentMysteriousRuinsSchedule(session *gameSession, townID, areaID byte, source string) error {
if s == nil || session == nil || session.selectedCharacterID == 0 || townID != 107 || areaID != 0 {
return nil
}
if s.options.pvfPath == "" {
return nil // services without a runtime PVF do not own this activity
}
table, _, err := s.dungeonWorldMap()
if err != nil {
return err
}
// Validate the whole scope before the first write. Never reinterpret an ID
// belonging to a different PVF, or invent a dungeon to complete the list.
for _, spec := range currentMysteriousRuinsDungeons {
dungeon, found := table.FindDungeon(int64(spec.id))
if !found || !strings.EqualFold(strings.ReplaceAll(dungeon.Path, "\\", "/"), spec.path) {
return fmt.Errorf("mysterious ruins schedule: dungeon %d does not match runtime PVF %s", spec.id, spec.path)
}
}
for _, spec := range currentMysteriousRuinsDungeons {
if err := s.sendCurrentSceneFixedClass0Packet(session, currentDungeonScheduleNotificationID,
buildCurrentMysteriousRuinsScheduleBody(spec.id), source+"_mysterious_ruins_schedule"); err != nil {
return err
}
}
s.logGameEvent(session, "game-mysterious-ruins-schedule-open", "char_id", session.selectedCharacterID,
"town_id", townID, "area_id", areaID, "notification", currentDungeonScheduleNotificationID,
"dungeon_ids", []uint32{4906, 4907, 4908, 4909, 4910}, "state", 1,
"source", source, "policy", "local_all_day_native_schedule")
return nil
}