Files
90CNServer/server/internal/services/dnfbridge/gm_tool_mail_seal_test.go
T
hanfuit 645b64fe21 DNF90 服务端与启动器完整源码(含 GM 工具功能增强)
服务端(Go):
- GM 塞背包/带属性装备发放:在线角色推送 op14 增量物品行,背包实时刷新,无需回角色选择界面
- GM 改金币/改等级:去掉在线拒绝,落库后推送 op14 钱包/op37 等级状态,在线实时刷新
- 等级端点统一切换到新版 GMSetCharacterLevel(自带在线刷新)
- 无限/锁死疲劳模式 + 燃烧疲劳:每房间消耗 2 点、打怪与通关经验双倍
- 燃烧疲劳开关时给所有在线角色推送系统提示(op12 mode 0)
- 深渊史诗掉率:GM 全局倍率 + 城镇增益药剂窗口倍率,真实接入掉落结算

启动器(Python/JS):
- 标题栏自绘、窗口 1204x717、禁止拖拽改大小、仅最小化/关闭
- GM 工具:疲劳与燃烧、深渊史诗掉率、拍卖行上架(单一定价对齐)
- 拍卖行上架前端对齐服务端单一价格语义,修复 400 报错
2026-11-04 14:31:55 +08:00

64 lines
2.5 KiB
Go

package dnfbridge
import (
"testing"
dnfrepo "longheng.io/server/internal/modules/dnf/repository"
)
// GM item mail hand-builds its stack, so it has to apply the same creation
// rule the shared constructor does: `[attach type] [sealing]` equipment is
// delivered sealed (+0x0D = 1). Delivered unsealed, the client treats the
// piece as bound -- untradeable, and the 合成器 rejects it ("解除封装的装备无法
// 进行合成。", dstr 25065).
func TestGMMailSealsSealingAttachTypeEquipment(t *testing.T) {
for _, rarity := range []int64{0, 2, 4, 5, 6} {
sealing := dungeonDropItemDefinition{
ItemID: 101010047,
Kind: dungeonDropItemEquipment,
Rarity: rarity,
EquipmentType: "[weapon]",
AttachType: "`[sealing]`",
}
stack := dnfrepo.ItemStack{ItemID: 101010047, Count: 1, Extra: map[string]string{"item_kind": "equipment"}}
gmApplyMailEquipmentSeal(&stack, sealing)
if stack.Extra["seal_flag"] != "1" {
t.Fatalf("rarity=%d extra=%+v want seal_flag=1", rarity, stack.Extra)
}
// The mail attachment and the claimed bag row are both projected from
// this stack, so the seal has to survive into the wire row.
entry := currentItemListEntryFromStack(dnfrepo.MainInventoryListType, 0, stack)
if entry.data[0x0D] != 1 {
t.Fatalf("rarity=%d row +0x0D=%d want 1", rarity, entry.data[0x0D])
}
}
// Every other attach type stays unsealed, and rarity never seals anything.
for _, attach := range []string{"`[trade]`", "`[trade delete]`", "`[free]`", "`[account]`", "`[sealing trade]`", ""} {
plain := dungeonDropItemDefinition{
ItemID: 101010047,
Kind: dungeonDropItemEquipment,
Rarity: 6,
EquipmentType: "[weapon]",
AttachType: attach,
}
stack := dnfrepo.ItemStack{ItemID: 101010047, Count: 1, Extra: map[string]string{"item_kind": "equipment"}}
gmApplyMailEquipmentSeal(&stack, plain)
if _, sealed := stack.Extra["seal_flag"]; sealed {
t.Fatalf("attach=%q was sealed: %+v", attach, stack.Extra)
}
entry := currentItemListEntryFromStack(dnfrepo.MainInventoryListType, 0, stack)
if entry.data[0x0D] != 0 {
t.Fatalf("attach=%q row +0x0D=%d want 0", attach, entry.data[0x0D])
}
}
// Stackables are never sealed, whatever their attach type says.
stackable := dungeonDropItemDefinition{ItemID: 3037, Kind: dungeonDropItemStackable, AttachType: "`[sealing]`"}
stack := dnfrepo.ItemStack{ItemID: 3037, Count: 5}
gmApplyMailEquipmentSeal(&stack, stackable)
if _, sealed := stack.Extra["seal_flag"]; sealed {
t.Fatalf("stackable was sealed: %+v", stack.Extra)
}
}