服务端(Go): - GM 塞背包/带属性装备发放:在线角色推送 op14 增量物品行,背包实时刷新,无需回角色选择界面 - GM 改金币/改等级:去掉在线拒绝,落库后推送 op14 钱包/op37 等级状态,在线实时刷新 - 等级端点统一切换到新版 GMSetCharacterLevel(自带在线刷新) - 无限/锁死疲劳模式 + 燃烧疲劳:每房间消耗 2 点、打怪与通关经验双倍 - 燃烧疲劳开关时给所有在线角色推送系统提示(op12 mode 0) - 深渊史诗掉率:GM 全局倍率 + 城镇增益药剂窗口倍率,真实接入掉落结算 启动器(Python/JS): - 标题栏自绘、窗口 1204x717、禁止拖拽改大小、仅最小化/关闭 - GM 工具:疲劳与燃烧、深渊史诗掉率、拍卖行上架(单一定价对齐) - 拍卖行上架前端对齐服务端单一价格语义,修复 400 报错
85 lines
2.9 KiB
Go
85 lines
2.9 KiB
Go
package dungeon
|
|
|
|
import (
|
|
"testing"
|
|
"time"
|
|
|
|
dnfrepo "longheng.io/server/internal/modules/dnf/repository"
|
|
dnfrevivecoin "longheng.io/server/internal/modules/dnf/revivecoin"
|
|
)
|
|
|
|
// A revive coin picked up in a dungeon must land in the fixed slot-1 wallet,
|
|
// never in an ordinary bag row. Item 42 (cash/coin_general.stk) counts as one
|
|
// wallet coin each, so it folds into the same row as item 1.
|
|
func TestPlacePickupItemRoutesReviveCoinsToTheWallet(t *testing.T) {
|
|
for _, itemID := range []uint32{1, 42} {
|
|
record := dnfrepo.InventoryRecord{CharacterID: "7", Slots: map[string]dnfrepo.ItemStack{
|
|
dnfrevivecoin.WalletKey(): {ItemID: 1, Count: 100},
|
|
}}
|
|
slot, stack, err := PlacePickupItem(&record, PickupItemPlacement{
|
|
Definition: PickupItemDefinition{
|
|
ItemID: itemID, Kind: PickupItemStackable, StackLimit: 0,
|
|
SlotStart: 121, SlotEnd: 176,
|
|
},
|
|
Amount: 10,
|
|
BuildNew: func(int16) (dnfrepo.ItemStack, error) {
|
|
t.Fatal("a revive coin must not build an ordinary bag row")
|
|
return dnfrepo.ItemStack{}, nil
|
|
},
|
|
})
|
|
if err != nil {
|
|
t.Fatalf("item %d: %v", itemID, err)
|
|
}
|
|
if slot != uint16(dnfrevivecoin.WalletSlot) || stack.ItemID != dnfrevivecoin.WalletItemID || stack.Count != 110 {
|
|
t.Fatalf("item %d: slot=%d stack=%+v want slot 1 item 1 x110", itemID, slot, stack)
|
|
}
|
|
if len(record.Slots) != 1 {
|
|
t.Fatalf("item %d: a loose bag row was left behind: %+v", itemID, record.Slots)
|
|
}
|
|
}
|
|
}
|
|
|
|
// Ordinary pickups keep the PVF slot-range placement.
|
|
func TestPlacePickupItemLeavesOrdinaryItemsInTheBag(t *testing.T) {
|
|
record := dnfrepo.InventoryRecord{CharacterID: "7", Slots: map[string]dnfrepo.ItemStack{}}
|
|
slot, _, err := PlacePickupItem(&record, PickupItemPlacement{
|
|
Definition: PickupItemDefinition{
|
|
ItemID: 3166, Kind: PickupItemStackable, SlotStart: 121, SlotEnd: 176,
|
|
},
|
|
Amount: 3,
|
|
BuildNew: func(slot int16) (dnfrepo.ItemStack, error) {
|
|
return dnfrepo.ItemStack{ItemID: 3166, Count: 3}, nil
|
|
},
|
|
})
|
|
if err != nil || slot != 121 {
|
|
t.Fatalf("slot=%d err=%v want 121", slot, err)
|
|
}
|
|
}
|
|
|
|
// The dungeon clear card flip is its own grant path and has to follow the
|
|
// same rule.
|
|
func TestAddCardItemRoutesReviveCoinsToTheWallet(t *testing.T) {
|
|
record := dnfrepo.InventoryRecord{CharacterID: "7", Slots: map[string]dnfrepo.ItemStack{}}
|
|
slot, err := addCardItem(&record, 256, CardItemReward{
|
|
Stack: dnfrepo.ItemStack{ItemID: 42, Count: 3},
|
|
Stackable: true,
|
|
SlotStart: 121,
|
|
SlotEnd: 176,
|
|
}, func(stack dnfrepo.ItemStack, _ time.Time) (dnfrepo.ItemStack, error) {
|
|
return stack, nil
|
|
})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
if slot != dnfrevivecoin.WalletSlot {
|
|
t.Fatalf("slot=%d want %d", slot, dnfrevivecoin.WalletSlot)
|
|
}
|
|
wallet := record.Slots[dnfrevivecoin.WalletKey()]
|
|
if wallet.ItemID != dnfrevivecoin.WalletItemID || wallet.Count != 3 {
|
|
t.Fatalf("wallet=%+v want item 1 x3", wallet)
|
|
}
|
|
if len(record.Slots) != 1 {
|
|
t.Fatalf("a loose bag row was left behind: %+v", record.Slots)
|
|
}
|
|
}
|