服务端(Go): - GM 塞背包/带属性装备发放:在线角色推送 op14 增量物品行,背包实时刷新,无需回角色选择界面 - GM 改金币/改等级:去掉在线拒绝,落库后推送 op14 钱包/op37 等级状态,在线实时刷新 - 等级端点统一切换到新版 GMSetCharacterLevel(自带在线刷新) - 无限/锁死疲劳模式 + 燃烧疲劳:每房间消耗 2 点、打怪与通关经验双倍 - 燃烧疲劳开关时给所有在线角色推送系统提示(op12 mode 0) - 深渊史诗掉率:GM 全局倍率 + 城镇增益药剂窗口倍率,真实接入掉落结算 启动器(Python/JS): - 标题栏自绘、窗口 1204x717、禁止拖拽改大小、仅最小化/关闭 - GM 工具:疲劳与燃烧、深渊史诗掉率、拍卖行上架(单一定价对齐) - 拍卖行上架前端对齐服务端单一价格语义,修复 400 报错
105 lines
4.4 KiB
Go
105 lines
4.4 KiB
Go
package dnfbridge
|
|
|
|
import (
|
|
"testing"
|
|
|
|
dnfenum "longheng.io/server/internal/modules/dnf/dnfenum"
|
|
dnfproto "longheng.io/server/internal/modules/dnf/protocol"
|
|
)
|
|
|
|
// TestDungeonCreatureMovePublishesActorRowAndActivationTail pins the shipped
|
|
// behaviour for an in-dungeon pet move end to end:
|
|
//
|
|
// 1. the op2/mode0 actor row in the scene context - the only packet measured to
|
|
// rebind the client's pet layer (op342+op357 left the pet stale, op9+op120+op357
|
|
// left the pet stale);
|
|
// 2. the room-entry activation tail in its native order op9 -> op120 -> op357 -> op3,
|
|
// because the client treats that row as a fresh scene binding and "op3 marks the
|
|
// selected local wrapper active". Sending the row without the tail is exactly what
|
|
// stopped the client from ever issuing CHANGE MAP (op45) after a pet move - the
|
|
// socket-level probe saw no send() attempt at the door at all.
|
|
func TestDungeonCreatureMovePublishesActorRowAndActivationTail(t *testing.T) {
|
|
service, session, connection := newDungeonCreatureAppearanceTest(t, true)
|
|
|
|
if err := service.sendAlignedUpperResponses(session, dungeonCreatureMoveResult()); err != nil {
|
|
t.Fatalf("dungeon creature move: %v", err)
|
|
}
|
|
stream := connection.write.Bytes()
|
|
|
|
mode0, ownerContext, found := firstMode0WithOwnerContext(t, stream)
|
|
if !found {
|
|
t.Fatalf("dungeon creature move published no op2 actor row: %x", stream)
|
|
}
|
|
if mode0.Header.MsgID != uint16(dnfenum.CmdPacketSetUDPIPPort) || mode0.Header.Classification != 0 {
|
|
t.Fatalf("dungeon actor row header=%+v", mode0.Header)
|
|
}
|
|
if ownerContext != currentSceneObjectContext {
|
|
t.Fatalf("dungeon actor row owner context=%d, want %d body_head=%x",
|
|
ownerContext, currentSceneObjectContext, mode0.Body[:min(16, len(mode0.Body))])
|
|
}
|
|
|
|
// 激活尾巴:op9 角色显示 -> op120 落位 -> op357 重绘 -> op3 激活本地 wrapper。
|
|
if _, found := firstPacketWithMsgID(t, stream, uint16(dnfenum.CmdPacketRecoverStamina)); !found {
|
|
t.Fatalf("activation tail is missing op9 actor display: %x", stream)
|
|
}
|
|
if _, found := firstPacketWithMsgID(t, stream, uint16(dnfenum.CmdPacketRequestBlacklist)); !found {
|
|
t.Fatalf("activation tail is missing op120 placement: %x", stream)
|
|
}
|
|
if _, found := firstPacketWithMsgID(t, stream, currentActorUserStateMsgID); !found {
|
|
t.Fatalf("activation tail is missing op357 redraw: %x", stream)
|
|
}
|
|
if _, found := firstPacketWithMsgID(t, stream, uint16(dnfenum.CmdPacketNotifyUserState)); !found {
|
|
t.Fatalf("activation tail is missing op3 wrapper activation: %x", stream)
|
|
}
|
|
|
|
// 宠物状态投影照旧,不受发布影响。
|
|
if _, found := firstPacketWithMsgID(t, stream, currentCreatureStateTableMsgID); !found {
|
|
t.Fatalf("dungeon creature move dropped the creature state table: %x", stream)
|
|
}
|
|
}
|
|
|
|
// TestDungeonActorRowIsFollowedByTheActivationTailOrder pins the ORDER, not just the
|
|
// presence: the client needs op120 (room object manager commit) before op3 (wrapper
|
|
// activation), and the display row before both.
|
|
func TestDungeonActorRowIsFollowedByTheActivationTailOrder(t *testing.T) {
|
|
service, session, connection := newDungeonCreatureAppearanceTest(t, true)
|
|
|
|
if err := service.sendAlignedUpperResponses(session, dungeonCreatureMoveResult()); err != nil {
|
|
t.Fatalf("dungeon creature move: %v", err)
|
|
}
|
|
stream := connection.write.Bytes()
|
|
|
|
order := []uint16{
|
|
uint16(dnfenum.CmdPacketSetUDPIPPort), // op2 actor row (mode0)
|
|
uint16(dnfenum.CmdPacketRecoverStamina), // op9 actor display
|
|
uint16(dnfenum.CmdPacketRequestBlacklist), // op120 placement
|
|
currentActorUserStateMsgID, // op357 redraw
|
|
uint16(dnfenum.CmdPacketNotifyUserState), // op3 wrapper activation
|
|
}
|
|
position := 0
|
|
for len(stream) > 0 {
|
|
packet, rest := splitGameServerUpperPacket(t, stream)
|
|
stream = rest
|
|
if position < len(order) && packet.Header.MsgID == order[position] {
|
|
position++
|
|
}
|
|
}
|
|
if position != len(order) {
|
|
t.Fatalf("activation tail order broken: matched %d/%d of %v", position, len(order), order)
|
|
}
|
|
}
|
|
|
|
// firstPacketWithMsgID returns the first packet carrying msgID in a server-upper
|
|
// stream written by sendAlignedUpperResponses, regardless of classification.
|
|
func firstPacketWithMsgID(t *testing.T, data []byte, msgID uint16) (dnfproto.ChannelPacket, bool) {
|
|
t.Helper()
|
|
for len(data) > 0 {
|
|
packet, rest := splitGameServerUpperPacket(t, data)
|
|
data = rest
|
|
if packet.Header.MsgID == msgID {
|
|
return packet, true
|
|
}
|
|
}
|
|
return dnfproto.ChannelPacket{}, false
|
|
}
|