服务端(Go): - GM 塞背包/带属性装备发放:在线角色推送 op14 增量物品行,背包实时刷新,无需回角色选择界面 - GM 改金币/改等级:去掉在线拒绝,落库后推送 op14 钱包/op37 等级状态,在线实时刷新 - 等级端点统一切换到新版 GMSetCharacterLevel(自带在线刷新) - 无限/锁死疲劳模式 + 燃烧疲劳:每房间消耗 2 点、打怪与通关经验双倍 - 燃烧疲劳开关时给所有在线角色推送系统提示(op12 mode 0) - 深渊史诗掉率:GM 全局倍率 + 城镇增益药剂窗口倍率,真实接入掉落结算 启动器(Python/JS): - 标题栏自绘、窗口 1204x717、禁止拖拽改大小、仅最小化/关闭 - GM 工具:疲劳与燃烧、深渊史诗掉率、拍卖行上架(单一定价对齐) - 拍卖行上架前端对齐服务端单一价格语义,修复 400 报错
87 lines
3.3 KiB
Go
87 lines
3.3 KiB
Go
package dnfbridge
|
|
|
|
import (
|
|
"encoding/binary"
|
|
"strconv"
|
|
"testing"
|
|
"time"
|
|
|
|
"longheng.io/server/internal/modules/dnf/alignedcmd"
|
|
dnfinventory "longheng.io/server/internal/modules/dnf/inventory"
|
|
)
|
|
|
|
func TestDamageFontPVFDefinitionsSupportAllExpirationModes(t *testing.T) {
|
|
source := dungeonDropCatalogTestSource{
|
|
"monster/monster.lst": "",
|
|
"equipment/equipment.lst": "",
|
|
"stackable/stackable.lst": "1 `font/period.stk`\n2 `font/fixed.stk`\n3 `font/unlimited.stk`\n",
|
|
"stackable/font/period.stk": damageFontTestDocument(2, "`[period]` 90"),
|
|
"stackable/font/fixed.stk": damageFontTestDocument(5000, "`[date]` `2028-01-02 03:04:05`"),
|
|
"stackable/font/unlimited.stk": damageFontTestDocument(5001, "`[unlimit]`"),
|
|
}
|
|
catalog, err := newPVFDungeonDropCatalog(source)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
period, err := catalog.ResolveItem(1)
|
|
if err != nil || period.DamageFontIndex != 2 || period.DamageFontExpirationMode != alignedcmd.DamageFontExpirationPeriod || period.DamageFontPeriodDays != 90 {
|
|
t.Fatalf("period = %+v err=%v", period, err)
|
|
}
|
|
fixed, err := catalog.ResolveItem(2)
|
|
if err != nil || fixed.DamageFontIndex != 5000 || fixed.DamageFontExpirationMode != alignedcmd.DamageFontExpirationFixed || fixed.DamageFontFixedExpiration.IsZero() {
|
|
t.Fatalf("fixed = %+v err=%v", fixed, err)
|
|
}
|
|
unlimited, err := catalog.ResolveItem(3)
|
|
if err != nil || unlimited.DamageFontIndex != 5001 || unlimited.DamageFontExpirationMode != alignedcmd.DamageFontExpirationUnlimited {
|
|
t.Fatalf("unlimited = %+v err=%v", unlimited, err)
|
|
}
|
|
}
|
|
|
|
func damageFontTestDocument(index int, expiration string) string {
|
|
return "[action type]\n`[add damage font skin]`\n[/action type]\n[damage font info]\n[index]\n" +
|
|
strconv.Itoa(index) + "\n[expiration info]\n" + expiration + "\n[/damage font info]\n"
|
|
}
|
|
|
|
func TestBuildCurrentDamageFontSkinListBodyMatchesVerifiedNoti1239Layout(t *testing.T) {
|
|
now := time.Unix(2_000_000_000, 0)
|
|
body := buildCurrentDamageFontSkinListBody(map[string]int64{
|
|
dnfinventory.DamageFontSelectedStatKey: 5000,
|
|
dnfinventory.DamageFontOwnershipStatKey(2): 0,
|
|
dnfinventory.DamageFontOwnershipStatKey(5000): now.Unix() + 90,
|
|
}, now)
|
|
if len(body) != 28 {
|
|
t.Fatalf("body len = %d, want 28", len(body))
|
|
}
|
|
if got := binary.LittleEndian.Uint16(body[0:2]); got != 5000 {
|
|
t.Fatalf("selected = %d", got)
|
|
}
|
|
if got := binary.LittleEndian.Uint16(body[2:4]); got != 3 {
|
|
t.Fatalf("count = %d", got)
|
|
}
|
|
if got := binary.LittleEndian.Uint32(body[4:8]); got != 0 {
|
|
t.Fatalf("entry0 index = %d", got)
|
|
}
|
|
if got := binary.LittleEndian.Uint32(body[8:12]); got != 0 {
|
|
t.Fatalf("entry0 expiry = %d", got)
|
|
}
|
|
if got := binary.LittleEndian.Uint32(body[12:16]); got != 2 {
|
|
t.Fatalf("entry1 index = %d", got)
|
|
}
|
|
if got := binary.LittleEndian.Uint32(body[20:24]); got != 5000 {
|
|
t.Fatalf("entry2 index = %d", got)
|
|
}
|
|
}
|
|
|
|
func TestBuildCurrentDamageFontSkinListBodyAlwaysIncludesDefaultFont(t *testing.T) {
|
|
body := buildCurrentDamageFontSkinListBody(nil, time.Unix(2_000_000_000, 0))
|
|
want := []byte{0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0}
|
|
if len(body) != len(want) {
|
|
t.Fatalf("body len = %d, want %d", len(body), len(want))
|
|
}
|
|
for index := range want {
|
|
if body[index] != want[index] {
|
|
t.Fatalf("body[%d] = %d, want %d; body=%x", index, body[index], want[index], body)
|
|
}
|
|
}
|
|
}
|