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

140 lines
3.8 KiB
Go

// Scratch tool: decode op14 (item list) and op19 (move) packets out of the
// server packet log, so the exact rows the client received can be inspected.
//
// go run ./cmd/scratch/pktdecode -log <packet_log.txt> -after 2026-09-21T06:14
//
// op14 body: [listType u8][count u16][row x count], row = 119 bytes with
// slot u16 @0x00, itemID u32 @0x02, count u32 @0x06.
// op19 body (28 bytes): srcList u8, srcSlot u16, srcInstance u32, moveCount u32,
// dstList u8, dstSlot u16, dstInstance u32, dstStack u32, actor i32, b0, b1.
package main
import (
"bufio"
"encoding/binary"
"encoding/hex"
"flag"
"fmt"
"os"
"strings"
)
const rowWireSize = 119
func main() {
logPath := flag.String("log", "", "packet log path")
after := flag.String("after", "", "only lines at/after this time prefix")
flag.Parse()
if *logPath == "" {
fmt.Fprintln(os.Stderr, "missing -log")
os.Exit(2)
}
file, err := os.Open(*logPath)
if err != nil {
fmt.Fprintln(os.Stderr, "open:", err)
os.Exit(1)
}
defer file.Close()
scanner := bufio.NewScanner(file)
scanner.Buffer(make([]byte, 1<<20), 1<<20)
for scanner.Scan() {
line := scanner.Text()
if *after != "" {
if len(line) < len(*after) || line[:len(*after)] < *after {
continue
}
}
if !strings.Contains(line, " msg_id=14 ") && !strings.Contains(line, " type=14 ") &&
!strings.Contains(line, "MOVE_ITEMSPACE") {
continue
}
at := ""
if len(line) > 27 {
at = line[11:23]
}
idx := strings.Index(line, "hex=")
if idx < 0 {
continue
}
raw, err := hex.DecodeString(strings.TrimSpace(line[idx+4:]))
if err != nil {
continue
}
kind := "?"
switch {
case strings.Contains(line, "MOVE_ITEMSPACE"):
kind = "op19"
case strings.Contains(line, "msg_id=14 "):
kind = "op14"
}
fmt.Printf("=== %s %s hex=%d bytes\n", at, kind, len(raw))
switch kind {
case "op19":
decodeMove(raw)
case "op14":
decodeList(raw)
}
}
}
// decodeMove skips a 13-byte legacy header (RECV) or 16-byte upper header (SEND).
func decodeMove(raw []byte) {
for _, header := range []int{13, 16} {
if len(raw) < header+28 {
continue
}
body := raw[header:]
if len(body) != 28 {
continue
}
srcList := body[0]
srcSlot := int16(binary.LittleEndian.Uint16(body[1:3]))
srcInstance := binary.LittleEndian.Uint32(body[3:7])
moveCount := binary.LittleEndian.Uint32(body[7:11])
dstList := body[11]
dstSlot := int16(binary.LittleEndian.Uint16(body[12:14]))
fmt.Printf(" header=%d src=%d:%d item=%d count=%d dst=%d:%d\n",
header, srcList, srcSlot, srcInstance, moveCount, dstList, dstSlot)
return
}
// 11-byte success ACK
if len(raw) >= 16+11 {
body := raw[16:]
if len(body) == 11 {
fmt.Printf(" ack header=16 ok=%d src=%d:%d count=%d dst=%d:%d\n",
body[0], body[1], int16(binary.LittleEndian.Uint16(body[2:4])),
binary.LittleEndian.Uint32(body[4:8]), body[8],
int16(binary.LittleEndian.Uint16(body[9:11])))
return
}
}
fmt.Printf(" (undecoded %d bytes)\n", len(raw))
}
func decodeList(raw []byte) {
if len(raw) < 16+3 {
fmt.Printf(" (short %d)\n", len(raw))
return
}
body := raw[16:]
listType := body[0]
count := int(binary.LittleEndian.Uint16(body[1:3]))
if len(body) != 3+count*rowWireSize {
fmt.Printf(" list=%d count=%d body=%d (shape mismatch)\n", listType, count, len(body))
}
fmt.Printf(" list=%d rows=%d\n", listType, count)
for index := 0; index < count; index++ {
start := 3 + index*rowWireSize
if start+10 > len(body) {
fmt.Printf(" row %d truncated\n", index)
return
}
row := body[start : start+rowWireSize]
slot := int16(binary.LittleEndian.Uint16(row[0:2]))
itemID := binary.LittleEndian.Uint32(row[2:6])
amount := binary.LittleEndian.Uint32(row[6:10])
fmt.Printf(" slot=%-4d item=%-10d count=%d\n", slot, itemID, amount)
}
}