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

132 lines
3.5 KiB
Go

// pvfanimrefs prints the IMG references used by ANI documents under selected
// archive prefixes. It is intentionally read-only and is used to build small
// NPK compatibility closures instead of replacing an entire profession tree.
package main
import (
"encoding/json"
"flag"
"fmt"
"os"
"regexp"
"sort"
"strconv"
"strings"
platformpvf "longheng.io/server/internal/platform/pvf"
)
var imagePair = regexp.MustCompile("(?i)`([^`]+\\.img)`\\s+(-?\\d+)")
type imageRef struct {
Path string `json:"path"`
Frames []int `json:"frames"`
Documents []string `json:"documents"`
}
func main() {
pvfPath := flag.String("pvf", "", "Script.pvf path")
prefixesFlag := flag.String("prefix", "", "comma-separated ANI archive prefixes")
flag.Parse()
if strings.TrimSpace(*pvfPath) == "" || strings.TrimSpace(*prefixesFlag) == "" {
fmt.Fprintln(os.Stderr, "-pvf and -prefix are required")
os.Exit(2)
}
archive, err := platformpvf.Open(*pvfPath)
check(err)
prefixes := splitNormalized(*prefixesFlag)
type accumulator struct {
frames map[int]struct{}
documents map[string]struct{}
}
refs := make(map[string]*accumulator)
documentsScanned := 0
for _, file := range archive.Files() {
archivePath := normalize(file.ArchivePath)
if !hasAnyPrefix(archivePath, prefixes) ||
!(strings.HasSuffix(archivePath, ".ani") || strings.HasSuffix(archivePath, ".ani.als")) {
continue
}
text, readErr := archive.ReadText(file.ArchivePath)
if readErr != nil {
continue
}
documentsScanned++
for _, match := range imagePair.FindAllStringSubmatch(text, -1) {
imagePath := normalizeIMG(match[1])
frame, _ := strconv.Atoi(match[2])
row := refs[imagePath]
if row == nil {
row = &accumulator{frames: make(map[int]struct{}), documents: make(map[string]struct{})}
refs[imagePath] = row
}
row.frames[frame] = struct{}{}
row.documents[archivePath] = struct{}{}
}
}
paths := make([]string, 0, len(refs))
for imagePath := range refs {
paths = append(paths, imagePath)
}
sort.Strings(paths)
rows := make([]imageRef, 0, len(paths))
for _, imagePath := range paths {
row := refs[imagePath]
frames := make([]int, 0, len(row.frames))
for frame := range row.frames {
frames = append(frames, frame)
}
sort.Ints(frames)
documents := make([]string, 0, len(row.documents))
for document := range row.documents {
documents = append(documents, document)
}
sort.Strings(documents)
rows = append(rows, imageRef{Path: imagePath, Frames: frames, Documents: documents})
}
report := struct {
Documents int `json:"documents"`
References []imageRef `json:"references"`
}{Documents: documentsScanned, References: rows}
encoder := json.NewEncoder(os.Stdout)
encoder.SetIndent("", " ")
check(encoder.Encode(report))
}
func splitNormalized(value string) []string {
parts := make([]string, 0)
for _, item := range strings.Split(value, ",") {
if item = normalize(item); item != "" {
parts = append(parts, item)
}
}
return parts
}
func hasAnyPrefix(value string, prefixes []string) bool {
for _, prefix := range prefixes {
if strings.HasPrefix(value, prefix) {
return true
}
}
return false
}
func normalizeIMG(value string) string {
value = normalize(strings.Trim(value, "`\"'"))
return strings.TrimPrefix(value, "sprite/")
}
func normalize(value string) string {
return strings.ToLower(strings.TrimPrefix(strings.ReplaceAll(strings.TrimSpace(value), "\\", "/"), "/"))
}
func check(err error) {
if err != nil {
panic(err)
}
}