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,97 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"testing"
|
||||
|
||||
"pvfine/internal/pvf"
|
||||
)
|
||||
|
||||
func TestShopEditReal90CNRoundTrip(t *testing.T) {
|
||||
filename := os.Getenv("PVF_TESTFILE")
|
||||
if filename == "" {
|
||||
t.Skip("PVF_TESTFILE 未设置")
|
||||
}
|
||||
a, err := pvf.Open(filename)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if a.ClientVersion() != "90CN" {
|
||||
t.Skip("需要 90CN 样例")
|
||||
}
|
||||
c := NewCore()
|
||||
if err := c.setArchive(a); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
t.Cleanup(c.closeArchive)
|
||||
c.startSearchIndex()
|
||||
waitForSearchIndex(t, c)
|
||||
index, ok := a.Find("itemshop/101_joann_box.shp")
|
||||
if !ok {
|
||||
t.Fatal("sample missing")
|
||||
}
|
||||
untouchedIndex, _ := a.Find("itemshop/equipmentshop1.shp")
|
||||
untouched, _ := a.RawBytes(untouchedIndex)
|
||||
untouched = append([]byte(nil), untouched...)
|
||||
text, _ := a.Text(index)
|
||||
service := NewFileGUIService(c)
|
||||
doc, err := service.ReadShop(index, text)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
req := ShopEditRequest{FileIndex: index, Path: a.Path(index), Text: text, Revision: doc.Revision, Action: "edit-item", TabIndex: 0, SourceStart: doc.Tabs[0].Groups[0].Items[0].SourceStart, ItemID: "10093342", SetGold: true, Gold: "77"}
|
||||
result, err := service.ApplyShopEdit(req)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if result.AffectedItems != 1 {
|
||||
t.Fatal("item count")
|
||||
}
|
||||
req.Text, _ = a.Text(index)
|
||||
req.Revision = result.Revision
|
||||
req.Action = "rename-tab"
|
||||
req.Name = "测试新分页"
|
||||
req.SetGold = false
|
||||
if _, err := service.ApplyShopEdit(req); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
output := filepath.Join(t.TempDir(), "shop-roundtrip.pvf")
|
||||
if err := a.SaveAs(output); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
reopened, err := pvf.Open(output)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
fresh := NewCore()
|
||||
fresh.archive = reopened
|
||||
i, _ := reopened.Find("itemshop/101_joann_box.shp")
|
||||
savedText, _ := reopened.Text(i)
|
||||
after, err := NewFileGUIService(fresh).ReadShop(i, savedText)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if after.Tabs[0].Name != "测试新分页" || len(after.Tabs[0].Groups[0].Items) != 5 {
|
||||
t.Fatal("shop did not round trip")
|
||||
}
|
||||
costs := after.Tabs[0].Groups[0].Items[0].Item.Costs
|
||||
gold, material := false, false
|
||||
for _, cost := range costs {
|
||||
if cost.Kind == "gold" && cost.Quantity == "77" {
|
||||
gold = true
|
||||
}
|
||||
if cost.Kind == "material" && cost.ItemID == "10092849" && cost.Quantity == "10" {
|
||||
material = true
|
||||
}
|
||||
}
|
||||
if !gold || !material {
|
||||
t.Fatalf("dual costs missing: %#v", costs)
|
||||
}
|
||||
u, _ := reopened.Find("itemshop/equipmentshop1.shp")
|
||||
raw, _ := reopened.RawBytes(u)
|
||||
if !bytes.Equal(raw, untouched) {
|
||||
t.Fatal("unrelated shop changed")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user