服务端(Go): - GM 塞背包/带属性装备发放:在线角色推送 op14 增量物品行,背包实时刷新,无需回角色选择界面 - GM 改金币/改等级:去掉在线拒绝,落库后推送 op14 钱包/op37 等级状态,在线实时刷新 - 等级端点统一切换到新版 GMSetCharacterLevel(自带在线刷新) - 无限/锁死疲劳模式 + 燃烧疲劳:每房间消耗 2 点、打怪与通关经验双倍 - 燃烧疲劳开关时给所有在线角色推送系统提示(op12 mode 0) - 深渊史诗掉率:GM 全局倍率 + 城镇增益药剂窗口倍率,真实接入掉落结算 启动器(Python/JS): - 标题栏自绘、窗口 1204x717、禁止拖拽改大小、仅最小化/关闭 - GM 工具:疲劳与燃烧、深渊史诗掉率、拍卖行上架(单一定价对齐) - 拍卖行上架前端对齐服务端单一价格语义,修复 400 报错
60 lines
2.0 KiB
Go
60 lines
2.0 KiB
Go
package dnfbridge
|
|
|
|
import (
|
|
"context"
|
|
"encoding/binary"
|
|
"math"
|
|
"testing"
|
|
"time"
|
|
|
|
dnfjoust "longheng.io/server/internal/modules/dnf/joust"
|
|
dnfrepo "longheng.io/server/internal/modules/dnf/repository"
|
|
dnfrepomemory "longheng.io/server/internal/modules/dnf/repository/memory"
|
|
)
|
|
|
|
func TestReconcileCurrentMailboxAttachmentExpirationsAddsPVFDeadlineForAnySource(t *testing.T) {
|
|
ctx := context.Background()
|
|
repositories := dnfrepomemory.NewMemoryGroup()
|
|
if err := repositories.Mailbox.Save(ctx, dnfrepo.MailboxRecord{
|
|
CharacterID: "19",
|
|
Mails: map[string]dnfrepo.MailRecord{
|
|
"42": {
|
|
MailID: "42",
|
|
Attachments: []dnfrepo.MailAttachment{{
|
|
ItemID: dnfjoust.PermanentCrystalID,
|
|
Count: 232,
|
|
}},
|
|
Metadata: map[string]string{"source": "manual-system-grant"},
|
|
},
|
|
},
|
|
}); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
service := &Service{
|
|
pvfItemCatalog: mustTestJoustCatalog(t),
|
|
repositoryProvider: func() (dnfrepo.Group, bool) { return repositories, true },
|
|
}
|
|
changed, err := service.reconcileCurrentMailboxAttachmentExpirations(ctx, 19)
|
|
if err != nil || changed != 1 {
|
|
t.Fatalf("repair changed=%d err=%v", changed, err)
|
|
}
|
|
mailbox, found, err := repositories.Mailbox.Load(ctx, "19")
|
|
if err != nil || !found {
|
|
t.Fatalf("load mailbox found=%t err=%v", found, err)
|
|
}
|
|
want := time.Date(2028, time.August, 15, 22, 0, 0, 0, time.UTC)
|
|
attachment := mailbox.Mails["42"].Attachments[0]
|
|
if got := attachment.ExpireAt; !got.Equal(want) {
|
|
t.Fatalf("attachment expiry=%s want=%s", got, want)
|
|
}
|
|
if len(attachment.RawEntry) != currentItemListEntryWireSize ||
|
|
binary.LittleEndian.Uint32(attachment.RawEntry[currentItemListExpireTimeOffset:currentItemListExpireTimeOffset+4]) != uint32(want.Unix()) ||
|
|
binary.LittleEndian.Uint16(attachment.RawEntry[0x0b:0x0d]) != math.MaxUint16 {
|
|
t.Fatalf("attachment row was not normalized: %+v", attachment)
|
|
}
|
|
changed, err = service.reconcileCurrentMailboxAttachmentExpirations(ctx, 19)
|
|
if err != nil || changed != 0 {
|
|
t.Fatalf("repeat repair changed=%d err=%v", changed, err)
|
|
}
|
|
}
|