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,129 @@
|
||||
package progression
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
platformpvf "longheng.io/server/internal/platform/pvf"
|
||||
)
|
||||
|
||||
func TestDungeonLocalExperienceSourcesLoadAndCacheRawRows(t *testing.T) {
|
||||
sources, err := LoadDungeonLocalExperienceSources(dungeonLocalExperienceTestSource{
|
||||
DungeonDefinitionListPath: "7146 `dungeon/story_a.dgn` 7155 `dungeon/story_b.dgn` 4907 `raid/legacy.dgn`",
|
||||
"dungeon/story_a.dgn": "[increase exp rate]\n100 130\n[/increase exp rate]",
|
||||
"dungeon/story_b.dgn": "[other]\n1\n[/other]",
|
||||
"dungeon/raid/legacy.dgn": "[increase exp rate]\n10 -10\n[/increase exp rate]",
|
||||
})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if snapshot := sources.Snapshot(); snapshot != (DungeonLocalExperienceSnapshot{DungeonDefinitions: 3}) {
|
||||
t.Fatalf("initial snapshot=%+v", snapshot)
|
||||
}
|
||||
row, pathFound, err := sources.Rule(7146)
|
||||
if err != nil || !pathFound || !row.Present || row.DungeonID != 7146 || row.Path != "dungeon/story_a.dgn" || row.Base != 100 || row.Bonus != 130 {
|
||||
t.Fatalf("7146 row=%+v path_found=%t err=%v", row, pathFound, err)
|
||||
}
|
||||
if snapshot := sources.Snapshot(); snapshot.LoadedDefinitions != 1 {
|
||||
t.Fatalf("loaded snapshot=%+v", snapshot)
|
||||
}
|
||||
row, pathFound, err = sources.Rule(7155)
|
||||
if err != nil || !pathFound || row.Present {
|
||||
t.Fatalf("missing local section row=%+v path_found=%t err=%v", row, pathFound, err)
|
||||
}
|
||||
if row, pathFound, err = sources.Rule(3); err != nil || pathFound || row.Present {
|
||||
t.Fatalf("unknown dungeon got fallback row=%+v path_found=%t err=%v", row, pathFound, err)
|
||||
}
|
||||
if _, _, err := sources.Rule(0); !errors.Is(err, ErrDungeonLocalLookup) {
|
||||
t.Fatalf("zero lookup error=%v", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestDungeonLocalExperienceSourcesRejectMalformedDefinitions(t *testing.T) {
|
||||
if _, err := LoadDungeonLocalExperienceSources(nil); !errors.Is(err, ErrDungeonLocalSourceRequired) {
|
||||
t.Fatalf("nil source error=%v", err)
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
source dungeonLocalExperienceTestSource
|
||||
}{
|
||||
{
|
||||
name: "odd list",
|
||||
source: dungeonLocalExperienceTestSource{
|
||||
DungeonDefinitionListPath: "7146 `dungeon/story_a.dgn` 7155",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "duplicate id",
|
||||
source: dungeonLocalExperienceTestSource{
|
||||
DungeonDefinitionListPath: "7146 `dungeon/story_a.dgn` 7146 `dungeon/story_b.dgn`",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "malformed row",
|
||||
source: dungeonLocalExperienceTestSource{
|
||||
DungeonDefinitionListPath: "7146 `dungeon/story_a.dgn`",
|
||||
"dungeon/story_a.dgn": "[increase exp rate]\n100\n[/increase exp rate]",
|
||||
},
|
||||
},
|
||||
{
|
||||
name: "negative effective rate",
|
||||
source: dungeonLocalExperienceTestSource{
|
||||
DungeonDefinitionListPath: "7146 `dungeon/story_a.dgn`",
|
||||
"dungeon/story_a.dgn": "[increase exp rate]\n100 -101\n[/increase exp rate]",
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
sources, err := LoadDungeonLocalExperienceSources(test.source)
|
||||
if test.name == "malformed row" || test.name == "negative effective rate" {
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, _, err := sources.Rule(7146); !errors.Is(err, ErrDungeonLocalSectionShape) {
|
||||
t.Fatalf("row error=%v", err)
|
||||
}
|
||||
return
|
||||
}
|
||||
if !errors.Is(err, ErrDungeonLocalSectionShape) {
|
||||
t.Fatalf("load error=%v", err)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestRealScriptPVFDungeonLocalExperienceSourcesPreserveRawRows(t *testing.T) {
|
||||
pvfPath := os.Getenv("DNFBRIDGE_REAL_PVF_SMOKE")
|
||||
if pvfPath == "" {
|
||||
t.Skip("set DNFBRIDGE_REAL_PVF_SMOKE to verify real dungeon local experience sources")
|
||||
}
|
||||
archive, err := platformpvf.Open(pvfPath)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
sources, err := LoadDungeonLocalExperienceSources(archive)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if snapshot := sources.Snapshot(); snapshot.DungeonDefinitions < 100 {
|
||||
t.Fatalf("real dungeon local snapshot=%+v", snapshot)
|
||||
}
|
||||
row, found, err := sources.Rule(7146)
|
||||
if err != nil || !found || row.DungeonID != 7146 || row.Path == "" {
|
||||
t.Fatalf("real dungeon 7146 row=%+v found=%t err=%v", row, found, err)
|
||||
}
|
||||
if snapshot := sources.Snapshot(); snapshot.LoadedDefinitions != 1 {
|
||||
t.Fatalf("real loaded snapshot=%+v", snapshot)
|
||||
}
|
||||
}
|
||||
|
||||
type dungeonLocalExperienceTestSource map[string]string
|
||||
|
||||
func (source dungeonLocalExperienceTestSource) ReadText(relativePath string) (string, error) {
|
||||
if text, found := source[relativePath]; found {
|
||||
return text, nil
|
||||
}
|
||||
return "", errors.New("missing test PVF path: " + relativePath)
|
||||
}
|
||||
Reference in new issue
Block a user