DNF90 服务端与启动器完整源码(含 GM 工具功能增强)

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

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

No files matched your search

+106
View File
@@ -0,0 +1,106 @@
package services
import (
"context"
"os"
"path/filepath"
"strings"
"testing"
"time"
"pvfine/internal/pvf"
)
func TestTWArchiveDiffRealArchive(t *testing.T) {
path := os.Getenv("PVF_TW_TESTFILE")
if path == "" {
t.Skip("PVF_TW_TESTFILE not set")
}
a, err := pvf.Open(path)
if err != nil {
t.Fatal(err)
}
defer a.Release()
changes, err := archiveDiffCompare(context.Background(), a, a, func(int) {})
if err != nil {
t.Fatal(err)
}
if len(changes) != 0 {
t.Fatalf("identical TW archive produced %d differences", len(changes))
}
}
func TestTWArchiveService(t *testing.T) {
src := os.Getenv("PVF_TW_TESTFILE")
if src == "" {
t.Skip("PVF_TW_TESTFILE not set")
}
// Keep version/index sidecars and edits away from the source fixture.
path := filepath.Join(t.TempDir(), "TW.pvf")
if err := os.Link(src, path); err != nil {
t.Fatal(err)
}
c := NewCore()
t.Cleanup(c.closeArchive)
svc := NewArchiveService(c)
info, err := svc.Open(path)
if err != nil {
t.Fatal(err)
}
if info.Format != pvf.FormatTW || info.FileCount == 0 {
t.Fatalf("wrong TW information: format=%s", info.Format)
}
deadline := time.Now().Add(time.Minute)
for {
c.mu.RLock()
ready := c.diskIndex != nil
status := c.indexStatus
c.mu.RUnlock()
if ready {
break
}
if status.State == IndexStateError {
t.Fatal(status.Error)
}
if time.Now().After(deadline) {
t.Fatal("TW file index timed out")
}
time.Sleep(20 * time.Millisecond)
}
root, err := svc.ListChildren("")
if err != nil || len(root) == 0 {
t.Fatalf("TW tree: %v", err)
}
c.mu.RLock()
var index int32 = -1
for i := int32(0); i < c.archive.FileCount(); i++ {
if strings.HasSuffix(c.archive.Path(i), ".equ") {
index = i
break
}
}
c.mu.RUnlock()
if index < 0 {
t.Fatal("no TW equipment")
}
file, err := NewEditorService(c).GetFile(index)
if err != nil {
t.Fatal(err)
}
c.mu.RLock()
nutIndex, found := c.archive.Find("sqr/common.nut")
c.mu.RUnlock()
if !found {
t.Fatal("TW NUT missing")
}
nut, err := NewEditorService(c).GetFile(nutIndex)
if err != nil {
t.Fatal(err)
}
if !nut.Editable || nut.DataType != pvf.TypeUnicode || nut.Text == "" {
t.Fatal("TW NUT is not editable in the editor service")
}
if !strings.Contains(file.Text, "[name]") {
t.Fatal("TW equipment not decompiled")
}
}