服务端(Go): - GM 塞背包/带属性装备发放:在线角色推送 op14 增量物品行,背包实时刷新,无需回角色选择界面 - GM 改金币/改等级:去掉在线拒绝,落库后推送 op14 钱包/op37 等级状态,在线实时刷新 - 等级端点统一切换到新版 GMSetCharacterLevel(自带在线刷新) - 无限/锁死疲劳模式 + 燃烧疲劳:每房间消耗 2 点、打怪与通关经验双倍 - 燃烧疲劳开关时给所有在线角色推送系统提示(op12 mode 0) - 深渊史诗掉率:GM 全局倍率 + 城镇增益药剂窗口倍率,真实接入掉落结算 启动器(Python/JS): - 标题栏自绘、窗口 1204x717、禁止拖拽改大小、仅最小化/关闭 - GM 工具:疲劳与燃烧、深渊史诗掉率、拍卖行上架(单一定价对齐) - 拍卖行上架前端对齐服务端单一价格语义,修复 400 报错
56 lines
1.8 KiB
Go
56 lines
1.8 KiB
Go
package services
|
|
|
|
import (
|
|
"bytes"
|
|
"strings"
|
|
"testing"
|
|
|
|
"pvfine/internal/pvf"
|
|
)
|
|
|
|
func TestBinaryANISourceAndPreview(t *testing.T) {
|
|
a := pvf.New()
|
|
// A standard archive carrying a native ANI resource proves this path does not
|
|
// depend on ACT60, TW or any other archive profile.
|
|
native := []byte{1, 0, 0, 0, 0, 0, 0, 0, 255, 255, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 12, 0, 50, 0, 0, 0}
|
|
index := a.AddFile("animation/test.ani", native, 0)
|
|
var packed bytes.Buffer
|
|
if err := a.SaveTo(&packed); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
c := NewCore()
|
|
if err := c.setArchive(a); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
t.Cleanup(c.closeArchive)
|
|
editor := NewEditorService(c)
|
|
for _, read := range []func(int32) (*FileMeta, error){editor.GetFileBasic, editor.GetFile} {
|
|
meta, err := read(index)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if meta.Editable || meta.DataType != 0 || !strings.HasPrefix(meta.Text, "#PVF_File") {
|
|
t.Fatal("binary ANI view is not read-only decoded text")
|
|
}
|
|
preview, err := NewPreviewService().ParseANI(meta.Text)
|
|
if err != nil || !preview.Valid || len(preview.Frames) != 1 || preview.Frames[0].Delay != 50 {
|
|
t.Fatal("binary ANI did not reach the existing preview", err)
|
|
}
|
|
}
|
|
raw, err := a.RawBytes(index)
|
|
if err != nil || !bytes.Equal(raw, native) || a.Modified() {
|
|
t.Fatal("viewing binary ANI modified archive", err)
|
|
}
|
|
var rewritten bytes.Buffer
|
|
if err := a.SaveTo(&rewritten); err != nil || !bytes.Equal(packed.Bytes(), rewritten.Bytes()) {
|
|
t.Fatal("viewing binary ANI changed saved bytes", err)
|
|
}
|
|
if err := a.SetRawBytes(index, []byte{255, 255, 0}); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
bad, err := editor.GetFile(index)
|
|
if err != nil || bad.Editable || !bad.Modified || !strings.Contains(bad.Text, "解码失败") {
|
|
t.Fatal("invalid binary ANI did not report decode failure", err)
|
|
}
|
|
}
|