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,99 @@
|
||||
package raid
|
||||
|
||||
import (
|
||||
"os"
|
||||
"slices"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
dnfpvf "longheng.io/server/internal/modules/dnf/pvf"
|
||||
platformpvf "longheng.io/server/internal/platform/pvf"
|
||||
)
|
||||
|
||||
const fiendWarRecruitmentDocument = `[FIENDWAR MEMBER MAX]
|
||||
8
|
||||
[FIENDWAR START MINIMUM MEMBER]
|
||||
1
|
||||
[ENTRY COST]
|
||||
490007844 1
|
||||
[/ENTRY COST]
|
||||
[DISCONN MEMBER WAIT TIME]
|
||||
300
|
||||
[RETRY]
|
||||
1
|
||||
[RETRY ITEM]
|
||||
490007844 1
|
||||
[PHASE]
|
||||
[MEMBER MAX]
|
||||
4
|
||||
[CONDITION FOR RANK]
|
||||
[DEAD COUNT]
|
||||
0 1 0
|
||||
[DEAD COUNT]
|
||||
2 5 1
|
||||
[DEAD COUNT]
|
||||
6 9 2
|
||||
[DEAD COUNT]
|
||||
10 14 3
|
||||
[/CONDITION FOR RANK]
|
||||
[/PHASE]`
|
||||
|
||||
func TestFiendWarRecruitmentConfig(t *testing.T) {
|
||||
for _, tc := range []struct {
|
||||
name, text string
|
||||
valid bool
|
||||
}{
|
||||
{"native globals", fiendWarRecruitmentDocument, true},
|
||||
{"missing maximum", strings.Replace(fiendWarRecruitmentDocument, "[FIENDWAR MEMBER MAX]", "[OTHER]", 1), false},
|
||||
{"minimum above capacity", strings.Replace(fiendWarRecruitmentDocument, "MINIMUM MEMBER]\n1", "MINIMUM MEMBER]\n9", 1), false},
|
||||
{"invalid ticket", strings.Replace(fiendWarRecruitmentDocument, "490007844 1", "0 1", 1), false},
|
||||
{"missing rank block", strings.ReplaceAll(fiendWarRecruitmentDocument, "CONDITION FOR RANK", "OTHER"), false},
|
||||
{"empty rank block", strings.ReplaceAll(fiendWarRecruitmentDocument, "DEAD COUNT", "OTHER"), false},
|
||||
{"invalid death range", strings.Replace(fiendWarRecruitmentDocument, "6 9 2", "9 6 2", 1), false},
|
||||
} {
|
||||
t.Run(tc.name, func(t *testing.T) {
|
||||
doc, err := dnfpvf.Parse(FiendWarPVFPath, tc.text)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
config, err := ParseFiendWarConfig(doc)
|
||||
if (err == nil) != tc.valid {
|
||||
t.Fatalf("config=%+v err=%v", config, err)
|
||||
}
|
||||
if tc.valid && (config.MemberMax != 8 || config.StartMinimumMembers != 1 || config.EntryCost.ItemID != 490007844 || config.EntryCost.Count != 1 || config.DisconnectMemberWaitSeconds != 300 || !config.Retry || config.RetryItem.ItemID != 490007844 || !slices.Equal(config.DeadCount, []FiendWarDeadCountRule{{0, 1, 0}, {2, 5, 1}, {6, 9, 2}, {10, 14, 3}})) {
|
||||
t.Fatalf("config=%+v", config)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestFiendWarDeadCountTierUsesInclusivePVFRanges(t *testing.T) {
|
||||
config := &FiendWarConfig{DeadCount: []FiendWarDeadCountRule{{Min: 0, Max: 1, Tier: 0}, {Min: 2, Max: 5, Tier: 1}}}
|
||||
for count, want := range map[int]int{0: 0, 1: 0, 2: 1, 5: 1} {
|
||||
got, ok := FiendWarDeadCountTier(config, count)
|
||||
if !ok || got != want {
|
||||
t.Fatalf("count=%d tier=%d ok=%t want=%d", count, got, ok, want)
|
||||
}
|
||||
}
|
||||
if _, ok := FiendWarDeadCountTier(config, 6); ok {
|
||||
t.Fatal("out-of-range death count returned a tier")
|
||||
}
|
||||
}
|
||||
|
||||
func TestRealScriptPVFFiendWarRecruitment(t *testing.T) {
|
||||
path := os.Getenv("DNF_FIENDWAR_REAL_PVF")
|
||||
if path == "" {
|
||||
t.Skip("DNF_FIENDWAR_REAL_PVF not set")
|
||||
}
|
||||
archive, err := platformpvf.Open(path)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
config, err := LoadFiendWarConfig(archive)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if config.MemberMax != 8 || config.StartMinimumMembers != 1 || config.EntryCost.ItemID != 490007844 || config.EntryCost.Count != 1 {
|
||||
t.Fatalf("actual PVF=%+v", config)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user