服务端(Go): - GM 塞背包/带属性装备发放:在线角色推送 op14 增量物品行,背包实时刷新,无需回角色选择界面 - GM 改金币/改等级:去掉在线拒绝,落库后推送 op14 钱包/op37 等级状态,在线实时刷新 - 等级端点统一切换到新版 GMSetCharacterLevel(自带在线刷新) - 无限/锁死疲劳模式 + 燃烧疲劳:每房间消耗 2 点、打怪与通关经验双倍 - 燃烧疲劳开关时给所有在线角色推送系统提示(op12 mode 0) - 深渊史诗掉率:GM 全局倍率 + 城镇增益药剂窗口倍率,真实接入掉落结算 启动器(Python/JS): - 标题栏自绘、窗口 1204x717、禁止拖拽改大小、仅最小化/关闭 - GM 工具:疲劳与燃烧、深渊史诗掉率、拍卖行上架(单一定价对齐) - 拍卖行上架前端对齐服务端单一价格语义,修复 400 报错
161 lines
5.2 KiB
Go
161 lines
5.2 KiB
Go
package dnfbridge
|
|
|
|
import (
|
|
"testing"
|
|
|
|
dnfrepo "longheng.io/server/internal/modules/dnf/repository"
|
|
)
|
|
|
|
func TestMailboxItemResolutionAllowsListedPVFItemWithoutPrice(t *testing.T) {
|
|
got, err := mailboxItemResolutionFromPVF(dungeonDropItemDefinition{
|
|
ItemID: 3166,
|
|
Kind: dungeonDropItemStackable,
|
|
PVFPath: "stackable/reproduced-item.stk",
|
|
StackableType: "[material]",
|
|
Durability: 0,
|
|
PriceFound: false,
|
|
SlotStart: 121,
|
|
SlotEnd: 176,
|
|
StackLimit: 1000,
|
|
}, true)
|
|
if err != nil {
|
|
t.Fatalf("mailboxItemResolutionFromPVF error = %v", err)
|
|
}
|
|
if got.Price != 0 || got.PVFPath != "stackable/reproduced-item.stk" || got.Kind != "stackable" ||
|
|
got.StackableType != "[material]" ||
|
|
got.SlotStart != 121 || got.SlotEnd != 176 || got.StackLimit != 1000 || got.PreferQuickSlots {
|
|
t.Fatalf("mailbox item resolution = %+v, want listed zero-value stackable", got)
|
|
}
|
|
}
|
|
|
|
func TestMailboxItemResolutionCarriesEquipmentDurability(t *testing.T) {
|
|
got, err := mailboxItemResolutionFromPVF(dungeonDropItemDefinition{
|
|
ItemID: 5001,
|
|
Kind: dungeonDropItemEquipment,
|
|
PVFPath: "equipment/test.equ",
|
|
EquipmentType: "[weapon]",
|
|
Durability: 57,
|
|
SlotStart: 9,
|
|
SlotEnd: 64,
|
|
}, false)
|
|
if err != nil {
|
|
t.Fatalf("mailboxItemResolutionFromPVF error = %v", err)
|
|
}
|
|
if got.Kind != "equipment" || got.EquipmentType != "[weapon]" || got.Durability != 57 || got.StackLimit != 1 {
|
|
t.Fatalf("mailbox equipment resolution = %+v", got)
|
|
}
|
|
}
|
|
|
|
func TestMailboxItemResolutionAllowsQuickSlotsOnlyForPVFWaste(t *testing.T) {
|
|
got, err := mailboxItemResolutionFromPVF(dungeonDropItemDefinition{
|
|
ItemID: 500,
|
|
Kind: dungeonDropItemStackable,
|
|
StackableType: "[waste]",
|
|
SlotStart: 65,
|
|
SlotEnd: 120,
|
|
StackLimit: 1000,
|
|
}, false)
|
|
if err != nil {
|
|
t.Fatalf("mailboxItemResolutionFromPVF error = %v", err)
|
|
}
|
|
if !got.PreferQuickSlots {
|
|
t.Fatalf("waste mailbox resolution = %+v, want quick-slot preference", got)
|
|
}
|
|
}
|
|
|
|
func TestMailboxItemResolutionRejectsNegativePrice(t *testing.T) {
|
|
_, err := mailboxItemResolutionFromPVF(dungeonDropItemDefinition{
|
|
ItemID: 3166,
|
|
Kind: dungeonDropItemStackable,
|
|
Price: -1,
|
|
PriceFound: true,
|
|
}, true)
|
|
if err == nil {
|
|
t.Fatal("negative mailbox PVF price should be rejected")
|
|
}
|
|
}
|
|
|
|
func TestMailboxItemResolutionRoutesEveryNativeInventoryFamily(t *testing.T) {
|
|
tests := []struct {
|
|
name string
|
|
definition dungeonDropItemDefinition
|
|
listType byte
|
|
start int16
|
|
end int16
|
|
}{
|
|
{
|
|
name: "ordinary equipment",
|
|
definition: dungeonDropItemDefinition{ItemID: 5001, Kind: dungeonDropItemEquipment,
|
|
EquipmentType: "[weapon]", SlotStart: 9, SlotEnd: 64},
|
|
listType: 0, start: 9, end: 64,
|
|
},
|
|
{
|
|
name: "avatar",
|
|
definition: dungeonDropItemDefinition{ItemID: 5002, Kind: dungeonDropItemEquipment,
|
|
EquipmentType: "[skin avatar]", SlotStart: 9, SlotEnd: 64},
|
|
listType: 1, start: 0, end: 500,
|
|
},
|
|
{
|
|
name: "creature",
|
|
definition: dungeonDropItemDefinition{ItemID: 5003, Kind: dungeonDropItemEquipment,
|
|
EquipmentType: "[creature]", SlotStart: 9, SlotEnd: 64},
|
|
listType: 7, start: 0, end: 139,
|
|
},
|
|
{
|
|
name: "creature artifact",
|
|
definition: dungeonDropItemDefinition{ItemID: 5004, Kind: dungeonDropItemEquipment,
|
|
EquipmentType: "[artifact red]", SlotStart: 9, SlotEnd: 64},
|
|
listType: 7, start: 140, end: 188,
|
|
},
|
|
{
|
|
name: "creature feed",
|
|
definition: dungeonDropItemDefinition{ItemID: 5005, Kind: dungeonDropItemStackable,
|
|
StackableType: "[feed]", SlotStart: 65, SlotEnd: 120},
|
|
listType: 7, start: 189, end: 238,
|
|
},
|
|
{
|
|
name: "guild medal",
|
|
definition: dungeonDropItemDefinition{ItemID: 5006, Kind: dungeonDropItemEquipment,
|
|
EquipmentType: "[flag]", SlotStart: 9, SlotEnd: 64},
|
|
listType: 38, start: 0, end: 48,
|
|
},
|
|
{
|
|
name: "guardian gem",
|
|
definition: dungeonDropItemDefinition{ItemID: 5007, Kind: dungeonDropItemStackable,
|
|
StackableType: "[flag gem]", SlotStart: 65, SlotEnd: 120},
|
|
listType: 38, start: 49, end: 97,
|
|
},
|
|
{
|
|
name: "ordinary material subtype four",
|
|
definition: dungeonDropItemDefinition{ItemID: 5008, Kind: dungeonDropItemStackable,
|
|
StackableType: "[material] 4", SlotStart: 345, SlotEnd: 359},
|
|
listType: 0, start: 345, end: 353,
|
|
},
|
|
{
|
|
name: "fixed crystal",
|
|
definition: dungeonDropItemDefinition{ItemID: 3033, Kind: dungeonDropItemStackable,
|
|
StackableType: "[material] 4", SlotStart: 345, SlotEnd: 359},
|
|
listType: 0, start: dnfrepo.CrystalWarehouseFirstSlot, end: dnfrepo.CrystalWarehouseFirstSlot,
|
|
},
|
|
{
|
|
name: "fixed soul",
|
|
definition: dungeonDropItemDefinition{ItemID: 10158124, Kind: dungeonDropItemStackable,
|
|
StackableType: "[material]", SlotStart: 121, SlotEnd: 176},
|
|
listType: 0, start: dnfrepo.SoulWarehouseLastSlot, end: dnfrepo.SoulWarehouseLastSlot,
|
|
},
|
|
}
|
|
|
|
for _, test := range tests {
|
|
t.Run(test.name, func(t *testing.T) {
|
|
got, err := mailboxItemResolutionFromPVF(test.definition, false)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if got.ListType != test.listType || got.SlotStart != test.start || got.SlotEnd != test.end {
|
|
t.Fatalf("placement=(%d,%d..%d), want=(%d,%d..%d): %+v",
|
|
got.ListType, got.SlotStart, got.SlotEnd, test.listType, test.start, test.end, got)
|
|
}
|
|
})
|
|
}
|
|
}
|