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,149 @@
|
||||
package dnfbridge
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
dnfpvf "longheng.io/server/internal/modules/dnf/pvf"
|
||||
)
|
||||
|
||||
func TestCurrentBoosterSelectionCatalogAllowsUnselectedEmptyCategory(t *testing.T) {
|
||||
document, err := dnfpvf.Parse("stackable/test_select.stk", `
|
||||
[booster select category]
|
||||
1 0
|
||||
[stackable]
|
||||
10095199 1
|
||||
[/booster select category]
|
||||
[booster select category]
|
||||
1 4
|
||||
[/booster select category]
|
||||
`)
|
||||
if err != nil {
|
||||
t.Fatalf("Parse error = %v", err)
|
||||
}
|
||||
candidates, categories, err := parseCurrentBoosterSelectionCatalog(document)
|
||||
if err != nil {
|
||||
t.Fatalf("parseCurrentBoosterSelectionCatalog error = %v", err)
|
||||
}
|
||||
if len(candidates) != 1 || candidates[0].ItemID != 10095199 {
|
||||
t.Fatalf("candidates = %+v", candidates)
|
||||
}
|
||||
if populated := categories[1]; len(populated) != 1 || populated[0].ItemID != 10095199 {
|
||||
t.Fatalf("populated category = %+v", populated)
|
||||
}
|
||||
emptyCategory := uint16(1 | 4<<8)
|
||||
if empty, exists := categories[emptyCategory]; !exists || len(empty) != 0 {
|
||||
t.Fatalf("empty placeholder exists=%t rows=%+v", exists, empty)
|
||||
}
|
||||
|
||||
definition := currentBoosterDefinition{
|
||||
SelectionRequired: 1,
|
||||
SelectionCategory: categories,
|
||||
}
|
||||
selected, err := currentBoosterSelectedCandidates(definition, currentBoosterOpenRequest{
|
||||
Kind: currentBoosterRequestSelection,
|
||||
SelectionContext: 1,
|
||||
Selections: []currentBoosterSelectionRequest{
|
||||
{ItemID: 10095199},
|
||||
},
|
||||
})
|
||||
if err != nil || len(selected) != 1 || selected[0].ItemID != 10095199 {
|
||||
t.Fatalf("populated selection = %+v error=%v", selected, err)
|
||||
}
|
||||
_, err = currentBoosterSelectedCandidates(definition, currentBoosterOpenRequest{
|
||||
Kind: currentBoosterRequestSelection,
|
||||
SelectionContext: emptyCategory,
|
||||
Selections: []currentBoosterSelectionRequest{
|
||||
{ItemID: 10095199},
|
||||
},
|
||||
})
|
||||
if !errors.Is(err, errCurrentBoosterSelectionInvalid) {
|
||||
t.Fatalf("empty category error = %v, want %v", err, errCurrentBoosterSelectionInvalid)
|
||||
}
|
||||
}
|
||||
|
||||
func TestCurrentBoosterSelectionCatalogIgnoresHistoricalCategoryMetadata(t *testing.T) {
|
||||
document, err := dnfpvf.Parse("stackable/historical_select.stk", `
|
||||
[booster select category]
|
||||
0 0
|
||||
[default select]
|
||||
2 3330 2749982
|
||||
[booster equipment upgrade]
|
||||
12
|
||||
[booster equipment grade]
|
||||
4
|
||||
[booster equipment separate]
|
||||
3
|
||||
[random probability]
|
||||
1 20 2 20
|
||||
[stackable]
|
||||
3330 10 2749982 10
|
||||
[equipment]
|
||||
2747675 1 2747676 1 2747675 1
|
||||
[/booster select category]
|
||||
[booster select category]
|
||||
1 0
|
||||
[stackable]
|
||||
3330 20
|
||||
[/booster select category]
|
||||
[booster select category]
|
||||
7 2
|
||||
[/booster select category]
|
||||
[booster select category]
|
||||
7 2
|
||||
[/booster select category]
|
||||
[/booster select category]
|
||||
[booster select category]
|
||||
8 0
|
||||
[booster category num]
|
||||
1 9
|
||||
[booster selection num]
|
||||
1
|
||||
[cera]
|
||||
34 1
|
||||
[booster select category]
|
||||
9 0
|
||||
[avatar]
|
||||
101550666 1 4 -1
|
||||
[/booster select category]
|
||||
[booster select category]
|
||||
10 0
|
||||
[stackble]
|
||||
490004325 1
|
||||
[/booster select category]
|
||||
`)
|
||||
if err != nil {
|
||||
t.Fatalf("Parse error = %v", err)
|
||||
}
|
||||
candidates, categories, err := parseCurrentBoosterSelectionCatalog(document)
|
||||
if err != nil {
|
||||
t.Fatalf("parseCurrentBoosterSelectionCatalog error = %v", err)
|
||||
}
|
||||
if len(candidates) != 7 {
|
||||
t.Fatalf("candidates = %+v", candidates)
|
||||
}
|
||||
for index, itemID := range []uint32{3330, 2749982, 2747675, 2747676, 34, 101550666, 490004325} {
|
||||
if candidates[index].ItemID != itemID {
|
||||
t.Fatalf("candidate[%d] = %+v, want item=%d", index, candidates[index], itemID)
|
||||
}
|
||||
}
|
||||
if category := categories[0]; len(category) != 4 {
|
||||
t.Fatalf("category 0 = %+v", category)
|
||||
}
|
||||
if category := categories[1]; len(category) != 1 || category[0].ItemID != 3330 || category[0].Count != 20 {
|
||||
t.Fatalf("category 1 = %+v", category)
|
||||
}
|
||||
emptyID := uint16(7 | 2<<8)
|
||||
if empty, exists := categories[emptyID]; !exists || len(empty) != 0 {
|
||||
t.Fatalf("repeated empty category exists=%t rows=%+v", exists, empty)
|
||||
}
|
||||
if category := categories[8]; len(category) != 1 || category[0].ItemID != 34 {
|
||||
t.Fatalf("EOF-closed cera category = %+v", category)
|
||||
}
|
||||
if category := categories[9]; len(category) != 1 || category[0].CategoryKind != 4 || category[0].Option != 0 {
|
||||
t.Fatalf("negative-default avatar category = %+v", category)
|
||||
}
|
||||
if category := categories[10]; len(category) != 1 || category[0].ItemID != 490004325 {
|
||||
t.Fatalf("historical stackble category = %+v", category)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user