Files
90CNServer/server/internal/services/dnfbridge/dungeon_tutorial_scope.go
T
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

99 lines
3.6 KiB
Go

package dnfbridge
import (
"path"
"strings"
"longheng.io/server/internal/modules/dnf/worldmap"
)
const (
atSwordmanTutorialJob = "11"
atSwordmanTutorialDungeonPath = "dungeon/cataclysm/newtutorial/tutorial_atswordman.dgn"
atSwordmanTutorialMapPrefix = "map/cataclysm/newtutorial/atswordman/"
)
// isATSwordmanTutorialScene deliberately keys the compatibility behavior to
// the female Slayer tutorial's real PVF ownership. Other professions have
// different tutorial dungeons and must keep their ordinary protocol flow.
func isATSwordmanTutorialScene(runtime *runtimeDungeonState, scene worldmap.DungeonRoomScene) bool {
if runtime == nil || strings.TrimSpace(runtime.Character.Job) != atSwordmanTutorialJob {
return false
}
if normalizeDungeonRuntimePath(runtime.Dungeon.Path) != atSwordmanTutorialDungeonPath {
return false
}
return strings.HasPrefix(normalizeDungeonRuntimePath(scene.Map.Map.Path), atSwordmanTutorialMapPrefix)
}
// isPVFTutorialDungeonScene identifies tutorial ownership from the dungeon
// document itself. It deliberately does not key on a profession, dungeon ID,
// map ID, path, or monster ID: every profession owns a different tutorial
// graph, while [tutorial dungeon] is their shared PVF contract.
func isPVFTutorialDungeonScene(runtime *runtimeDungeonState, scene worldmap.DungeonRoomScene) bool {
if runtime == nil || runtime.Room == nil || runtime.Session == nil {
return false
}
if !isPVFTutorialDungeon(runtime) {
return false
}
return currentDungeonRoomOwnsScene(runtime, scene)
}
func isPVFTutorialDungeon(runtime *runtimeDungeonState) bool {
if runtime == nil {
return false
}
tutorial := runtime.Dungeon.Metadata.TutorialDungeon
return tutorial.Set && tutorial.Value == 1
}
// isPVFTutorialScriptedMonsterDeath accepts only an ordinary PVF [monster]
// that is currently announced by the owned room and whose static map index is
// an explicit CMT [DESTROY] target for this map. AI/APC actors live in the
// extended-actor table, so their sentinel-owner retirement remains separate.
func (s *Service) isPVFTutorialScriptedMonsterDeath(
runtime *runtimeDungeonState,
scene worldmap.DungeonRoomScene,
objectKey uint32,
) (runtimeDungeonMonster, dungeonTutorialScriptEvidence, bool) {
if !isPVFTutorialDungeonScene(runtime, scene) {
return runtimeDungeonMonster{}, dungeonTutorialScriptEvidence{}, false
}
monster, ok := runtime.Room.AnnouncedMonster(objectKey)
if !ok || monster.Reference.Kind != worldmap.HostileMonster {
return runtimeDungeonMonster{}, dungeonTutorialScriptEvidence{}, false
}
catalog, ok := s.dungeonTutorialScriptCatalog()
if !ok {
return runtimeDungeonMonster{}, dungeonTutorialScriptEvidence{}, false
}
evidence, ok := catalog.FindMonsterDestroy(scene.Map.Map.ID, monster.Reference.Index)
if !ok {
return runtimeDungeonMonster{}, dungeonTutorialScriptEvidence{}, false
}
return monster, evidence, true
}
func currentDungeonRoomOwnsScene(runtime *runtimeDungeonState, scene worldmap.DungeonRoomScene) bool {
if runtime == nil || runtime.Room == nil || runtime.Session == nil {
return false
}
current, ok := runtime.Session.Scene()
if !ok || current.Coordinate != scene.Coordinate || current.Map.Map.ID != scene.Map.Map.ID {
return false
}
room := runtime.Room.Snapshot()
return room.Coordinate == scene.Coordinate && room.MapID == scene.Map.Map.ID
}
func normalizeDungeonRuntimePath(value string) string {
value = strings.TrimSpace(strings.ReplaceAll(value, "\\", "/"))
value = strings.TrimPrefix(value, "./")
value = strings.TrimPrefix(value, "/")
if value == "" {
return ""
}
return strings.ToLower(path.Clean(value))
}