服务端(Go): - GM 塞背包/带属性装备发放:在线角色推送 op14 增量物品行,背包实时刷新,无需回角色选择界面 - GM 改金币/改等级:去掉在线拒绝,落库后推送 op14 钱包/op37 等级状态,在线实时刷新 - 等级端点统一切换到新版 GMSetCharacterLevel(自带在线刷新) - 无限/锁死疲劳模式 + 燃烧疲劳:每房间消耗 2 点、打怪与通关经验双倍 - 燃烧疲劳开关时给所有在线角色推送系统提示(op12 mode 0) - 深渊史诗掉率:GM 全局倍率 + 城镇增益药剂窗口倍率,真实接入掉落结算 启动器(Python/JS): - 标题栏自绘、窗口 1204x717、禁止拖拽改大小、仅最小化/关闭 - GM 工具:疲劳与燃烧、深渊史诗掉率、拍卖行上架(单一定价对齐) - 拍卖行上架前端对齐服务端单一价格语义,修复 400 报错
86 lines
2.4 KiB
Go
86 lines
2.4 KiB
Go
package rendering
|
|
|
|
import "testing"
|
|
|
|
func TestFormatMatchingUsesExtensionSectionAndGlob(t *testing.T) {
|
|
engine, err := Compile(Document{
|
|
Version: 1,
|
|
Rules: []Rule{
|
|
{
|
|
ID: "file.lst",
|
|
Match: MatchSpec{Extensions: []string{".LST"}},
|
|
Target: TargetSpec{Kind: "file"},
|
|
Format: FormatSpec{TokensPerLine: 2},
|
|
},
|
|
{
|
|
ID: "file.skl",
|
|
Match: MatchSpec{Extensions: []string{".skl"}},
|
|
Target: TargetSpec{Kind: "file"},
|
|
Format: FormatSpec{TokensPerLine: 2},
|
|
},
|
|
{
|
|
ID: "section.global",
|
|
Target: TargetSpec{Kind: "section", Section: "Records"},
|
|
Format: FormatSpec{TokensPerLine: 3},
|
|
},
|
|
{
|
|
ID: "section.skl",
|
|
Match: MatchSpec{Extensions: []string{".skl"}},
|
|
Target: TargetSpec{Kind: "section", Section: "records"},
|
|
Format: FormatSpec{TokensPerLine: 4},
|
|
},
|
|
{
|
|
ID: "section.skl.glob",
|
|
Match: MatchSpec{Extensions: []string{".SKL"}, Glob: "skills/**/*.skl"},
|
|
Target: TargetSpec{Kind: "section", Section: "RECORDS"},
|
|
Format: FormatSpec{TokensPerLine: 5},
|
|
},
|
|
},
|
|
})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
|
|
if got := engine.FileFormat("foo/INDEX.LST").TokensPerLine; got != 2 {
|
|
t.Fatalf("lst file format = %d, want 2", got)
|
|
}
|
|
if got := engine.FileFormat("skills/test.SKL").TokensPerLine; got != 2 {
|
|
t.Fatalf("skl file format = %d, want 2", got)
|
|
}
|
|
if got := engine.SectionFormat("other/item.skl", "records").TokensPerLine; got != 4 {
|
|
t.Fatalf("skl section format = %d, want 4", got)
|
|
}
|
|
if got := engine.SectionFormat("skills/advanced/item.SKL", "RECORDS").TokensPerLine; got != 5 {
|
|
t.Fatalf("glob section format = %d, want 5", got)
|
|
}
|
|
if got := engine.SectionFormat("item.equ", "records").TokensPerLine; got != 3 {
|
|
t.Fatalf("global section format = %d, want 3", got)
|
|
}
|
|
}
|
|
|
|
func TestFormatMatchingUsesLaterRuleForEqualSpecificity(t *testing.T) {
|
|
engine, err := Compile(Document{
|
|
Version: 1,
|
|
Rules: []Rule{
|
|
{
|
|
ID: "first",
|
|
Match: MatchSpec{Extensions: []string{".equ"}},
|
|
Target: TargetSpec{Kind: "file"},
|
|
Format: FormatSpec{TokensPerLine: 2},
|
|
},
|
|
{
|
|
ID: "second",
|
|
Match: MatchSpec{Extensions: []string{".EQU"}},
|
|
Target: TargetSpec{Kind: "file"},
|
|
Format: FormatSpec{TokensPerLine: 7},
|
|
},
|
|
},
|
|
})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if got := engine.FileFormat("item.equ").TokensPerLine; got != 7 {
|
|
t.Fatalf("equal-specificity format = %d, want 7", got)
|
|
}
|
|
}
|