DNF90 服务端与启动器完整源码(含 GM 工具功能增强)
服务端(Go): - GM 塞背包/带属性装备发放:在线角色推送 op14 增量物品行,背包实时刷新,无需回角色选择界面 - GM 改金币/改等级:去掉在线拒绝,落库后推送 op14 钱包/op37 等级状态,在线实时刷新 - 等级端点统一切换到新版 GMSetCharacterLevel(自带在线刷新) - 无限/锁死疲劳模式 + 燃烧疲劳:每房间消耗 2 点、打怪与通关经验双倍 - 燃烧疲劳开关时给所有在线角色推送系统提示(op12 mode 0) - 深渊史诗掉率:GM 全局倍率 + 城镇增益药剂窗口倍率,真实接入掉落结算 启动器(Python/JS): - 标题栏自绘、窗口 1204x717、禁止拖拽改大小、仅最小化/关闭 - GM 工具:疲劳与燃烧、深渊史诗掉率、拍卖行上架(单一定价对齐) - 拍卖行上架前端对齐服务端单一价格语义,修复 400 报错
This commit is contained in:
commit
645b64fe21
4388 files changed
+1405457
No files matched your search
@@ -0,0 +1,88 @@
|
||||
// npcfindname 遍历 Script.pvf 里的 NPC 定义文件,按 [name] 段反查 NPC 编号。
|
||||
//
|
||||
// 动机:`npc/npc.lst` 只登记经典全局 NPC;地图专用 NPC(例如"博肯")用编号
|
||||
// 直接写在地图 [NPC] 段里,编号与文件的对应关系得到定义文件里找。
|
||||
// 定义文件的 [name] 段是该 NPC 的显示名,所以按名字反查是可靠路径。
|
||||
//
|
||||
// go run ./cmd/scratch/npcfindname -pvf <path> -name 博肯
|
||||
// go run ./cmd/scratch/npcfindname -pvf <path> -name 博肯 -all
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os"
|
||||
"path"
|
||||
"regexp"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
platformpvf "longheng.io/server/internal/platform/pvf"
|
||||
)
|
||||
|
||||
var nameRe = regexp.MustCompile("(?m)^\\s*\\[name\\]\\s*\\r?\\n\\s*`([^`]+)`")
|
||||
|
||||
func main() {
|
||||
pvfPath := flag.String("pvf", `../runtime/data/dnf/Script.pvf`, "Script.pvf path")
|
||||
want := flag.String("name", "", "要查的中文名(子串匹配)")
|
||||
all := flag.Bool("all", false, "打印全部命中(默认 40 条)")
|
||||
flag.Parse()
|
||||
|
||||
if strings.TrimSpace(*want) == "" {
|
||||
fmt.Fprintln(os.Stderr, "usage: npcfindname -pvf <path> -name <中文名>")
|
||||
os.Exit(2)
|
||||
}
|
||||
|
||||
archive, err := platformpvf.Open(*pvfPath)
|
||||
if err != nil {
|
||||
fmt.Fprintln(os.Stderr, "open:", err)
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
// npc.lst 是 id -> 文件名 的权威表
|
||||
listText, _ := archive.ReadText("npc/npc.lst")
|
||||
idToFile := map[string]string{}
|
||||
for _, m := range regexp.MustCompile("(\\d+)\\s+`([^`]+\\.npc)`").FindAllStringSubmatch(listText, -1) {
|
||||
idToFile[m[2]] = m[1]
|
||||
}
|
||||
|
||||
type hit struct {
|
||||
id string
|
||||
file string
|
||||
name string
|
||||
}
|
||||
var hits []hit
|
||||
// 只扫 npc/ 下的定义文件,避免全库 100 万文件
|
||||
for _, f := range archive.Files() {
|
||||
p := strings.ToLower(f.ArchivePath)
|
||||
if !strings.HasPrefix(p, "npc/") || !strings.HasSuffix(p, ".npc") {
|
||||
continue
|
||||
}
|
||||
text, err := archive.FileText(f.Index)
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
m := nameRe.FindStringSubmatch(text)
|
||||
if m == nil {
|
||||
continue
|
||||
}
|
||||
if !strings.Contains(m[1], *want) {
|
||||
continue
|
||||
}
|
||||
id := idToFile[path.Base(f.ArchivePath)]
|
||||
if id == "" {
|
||||
id = "(未登记)"
|
||||
}
|
||||
hits = append(hits, hit{id: id, file: f.ArchivePath, name: m[1]})
|
||||
}
|
||||
|
||||
sort.Slice(hits, func(i, j int) bool { return hits[i].id < hits[j].id })
|
||||
fmt.Printf("名字含 %q 的 NPC 定义:%d 条\n", *want, len(hits))
|
||||
limit := len(hits)
|
||||
if !*all && limit > 40 {
|
||||
limit = 40
|
||||
}
|
||||
for i := 0; i < limit; i++ {
|
||||
fmt.Printf(" id=%-10s %-34s %s\n", hits[i].id, hits[i].file, hits[i].name)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user