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

+163
View File
@@ -0,0 +1,163 @@
// pvfhashcorrupt 对 protected PVF 的 HASH 段做**受控破坏**,用来验证 pvfhashfix 的通用性。
//
// 思路:拿一个已知好库,人为制造出「我们实际遇到过的那几类失同步」,
// 再让 pvfhashfix 去修;如果修完的输出与原始好库**逐字节完全相同**,就说明
// 这类破坏是可逆的、修复逻辑不依赖任何特定库的巧合。
//
// 只改 HASH 段内部的字节,段长度与所有其它段完全不变(就地解密→改→就地加密)。
//
// go run ./cmd/scratch/pvfhashcorrupt -pvf <好库> -out <坏库> -mode <模式> -n <N>
//
// 模式:
// mirror-rot 镜像行整体循环右移 N 行 (模拟「顺序漂移」)
// mirror-dup 末尾 N 行镜像覆盖成它前面 N 行 (模拟「新增条目没进镜像」)
// dict-dup 末尾 N 条字典项覆盖成第 0 条 (模拟「字典缺项」)
package main
import (
"encoding/binary"
"flag"
"fmt"
"os"
"unicode/utf16"
)
const (
headerSize = 0x30
fileItemSize = 0x18
groupItemSize = 8
containerMagic = 0x269EC3
)
func xorCore(key string, buf []byte, magic uint32) {
if key == "" || len(buf) == 0 {
return
}
words := utf16.Encode([]rune(key))
if len(words) < 4 {
return
}
size := len(buf)
tail := size
seed := uint32(0x339E9711)*uint32(words[0]) +
0x393*(uint32(words[3])+0x393*(uint32(words[2])+0x393*uint32(words[1])))
if size >= 4 {
quadCount := size >> 2
tail = size - (quadCount << 2)
for idx := 0; idx < quadCount; idx++ {
t1 := 0x343FD*seed + magic
seed = 0x343FD*t1 + magic
xorKey := (t1 & 0xFFFF0000) + (seed >> 16)
off := idx << 2
binary.LittleEndian.PutUint32(buf[off:off+4], binary.LittleEndian.Uint32(buf[off:off+4])^xorKey)
}
}
if tail > 0 {
t1 := 0x343FD*seed + magic
t2 := 0x343FD*t1 + magic
finalKey := (t1 & 0xFFFF0000) + (t2 >> 16)
var kb [4]byte
binary.LittleEndian.PutUint32(kb[:], finalKey)
start := size - tail
for idx := 0; idx < tail; idx++ {
buf[start+idx] ^= kb[idx]
}
}
}
func i32(b []byte) int { return int(int32(binary.LittleEndian.Uint32(b))) }
func put(b []byte, v int) { binary.LittleEndian.PutUint32(b, uint32(int32(v))) }
func main() {
pvfPath := flag.String("pvf", "", "输入(已知好库)")
outPath := flag.String("out", "", "输出(受控破坏后的库)")
mode := flag.String("mode", "", "mirror-rot | mirror-dup | dict-dup")
n := flag.Int("n", 8, "破坏多少行/条")
flag.Parse()
if *pvfPath == "" || *outPath == "" || *mode == "" {
fmt.Fprintln(os.Stderr, "-pvf -out -mode are required")
os.Exit(2)
}
data, err := os.ReadFile(*pvfPath)
if err != nil {
fmt.Fprintln(os.Stderr, "read:", err)
os.Exit(1)
}
hdr := append([]byte(nil), data[:headerSize]...)
xorCore("hEAd", hdr, containerMagic)
if binary.LittleEndian.Uint32(hdr[0:4]) != 0x69706B6E {
fmt.Fprintln(os.Stderr, "不是 protected(nkpi)PVF")
os.Exit(2)
}
fileCount := i32(hdr[24:28])
hashSize := i32(hdr[40:44])
hashOff := headerSize + fileCount*fileItemSize
if hashOff+hashSize > len(data) {
fmt.Fprintln(os.Stderr, "HASH 段越界")
os.Exit(2)
}
sec := append([]byte(nil), data[hashOff:hashOff+hashSize]...)
xorCore("hash", sec, containerMagic)
intCount := len(sec) / 4
mirrorCount := i32(sec[0:4])
dictPos := 1 + mirrorCount*2
if mirrorCount < 0 || dictPos+1 > intCount {
fmt.Fprintln(os.Stderr, "镜像是坏的,先修好再拿来当基准")
os.Exit(2)
}
stringCount := i32(sec[dictPos*4 : dictPos*4+4])
nn := *n
fmt.Printf("输入: %s\n 文件数=%d 镜像=%d 字典=%d 模式=%s n=%d\n",
*pvfPath, fileCount, mirrorCount, stringCount, *mode, nn)
switch *mode {
case "mirror-rot":
if nn <= 0 || nn >= mirrorCount {
fmt.Fprintln(os.Stderr, "n 越界")
os.Exit(2)
}
// 把镜像行整体循环右移 nn 行:集合不变、顺序全乱。
tmp := make([]byte, nn*8)
copy(tmp, sec[4:4+nn*8])
copy(sec[4:4+(mirrorCount-nn)*8], sec[4+nn*8:4+mirrorCount*8])
copy(sec[4+(mirrorCount-nn)*8:4+mirrorCount*8], tmp)
case "mirror-dup":
if nn <= 0 || nn*2 > mirrorCount {
fmt.Fprintln(os.Stderr, "n 越界")
os.Exit(2)
}
// 末尾 nn 行覆盖成它前面 nn 行:末尾 nn 条文件表条目在镜像里就"不存在"了
// —— 这正是线上库那个毛病的形态。
copy(sec[4+(mirrorCount-nn)*8:4+mirrorCount*8],
sec[4+(mirrorCount-2*nn)*8:4+(mirrorCount-nn)*8])
case "dict-dup":
if nn <= 0 || nn > stringCount {
fmt.Fprintln(os.Stderr, "n 越界")
os.Exit(2)
}
// 末尾 nn 条字典项覆盖成第 0 条:字典里丢了 nn 个真实偏移。
first := append([]byte(nil), sec[(dictPos+1)*4:(dictPos+2)*4]...)
for i := stringCount - nn; i < stringCount; i++ {
copy(sec[(dictPos+1+i)*4:(dictPos+2+i)*4], first)
}
default:
fmt.Fprintln(os.Stderr, "未知模式:", *mode)
os.Exit(2)
}
xorCore("hash", sec, containerMagic)
out := append([]byte(nil), data...)
copy(out[hashOff:hashOff+hashSize], sec)
if err := os.WriteFile(*outPath, out, 0o644); err != nil {
fmt.Fprintln(os.Stderr, "write:", err)
os.Exit(1)
}
fmt.Printf("已写出: %s (%d 字节,与原文件等长)\n", *outPath, len(out))
}