Files
90CNServer/server/internal/services/dnfbridge/dungeon_practice_mode_test.go
T
hanfuit 645b64fe21 DNF90 服务端与启动器完整源码(含 GM 工具功能增强)
服务端(Go):
- GM 塞背包/带属性装备发放:在线角色推送 op14 增量物品行,背包实时刷新,无需回角色选择界面
- GM 改金币/改等级:去掉在线拒绝,落库后推送 op14 钱包/op37 等级状态,在线实时刷新
- 等级端点统一切换到新版 GMSetCharacterLevel(自带在线刷新)
- 无限/锁死疲劳模式 + 燃烧疲劳:每房间消耗 2 点、打怪与通关经验双倍
- 燃烧疲劳开关时给所有在线角色推送系统提示(op12 mode 0)
- 深渊史诗掉率:GM 全局倍率 + 城镇增益药剂窗口倍率,真实接入掉落结算

启动器(Python/JS):
- 标题栏自绘、窗口 1204x717、禁止拖拽改大小、仅最小化/关闭
- GM 工具:疲劳与燃烧、深渊史诗掉率、拍卖行上架(单一定价对齐)
- 拍卖行上架前端对齐服务端单一价格语义,修复 400 报错
2026-11-04 14:31:55 +08:00

84 lines
3.4 KiB
Go

package dnfbridge
import "testing"
// currentDungeonProtocolModeForRoom is the room-aware half of the C2S op16
// mapping: state=1 + token=UINT16_MAX is this client's 练习模式 switch for an
// ordinary dungeon, while the two guided direct-entry rooms send the same pair
// from their own buttons and must keep the ordinary policy.
//
// Live capture 2026-09-17 (packet_log.txt): 481 select requests, every ordinary
// 进入 among them carrying state=0 + token=UINT16_MAX; the only state=1 +
// UINT16_MAX requests were the guided rooms (7142) and the operator's 练习模式
// attempt on 190, which the ordinary reading refused with the 「疲劳值不足」
// prompt because the character's fatigue had been zeroed on purpose.
func TestCurrentDungeonProtocolModeForRoomResolvesPracticeAndGuidedRooms(t *testing.T) {
cases := []struct {
name string
runtimeState byte
runtimeToken uint16
dungeonID int64
wantMode currentDungeonProtocolMode
wantOK bool
}{
{
name: "default ordinary entry", runtimeState: 0, runtimeToken: 0xffff, dungeonID: 190,
wantMode: currentDungeonProtocolModeNormal, wantOK: true,
},
{
name: "练习模式 on an ordinary dungeon", runtimeState: 1, runtimeToken: 0xffff, dungeonID: 190,
wantMode: currentDungeonProtocolModePractice, wantOK: true,
},
{
name: "练习模式 on another ordinary dungeon", runtimeState: 1, runtimeToken: 0xffff, dungeonID: 7115,
wantMode: currentDungeonProtocolModePractice, wantOK: true,
},
{
name: "explicit practice pair", runtimeState: 1, runtimeToken: 0, dungeonID: 190,
wantMode: currentDungeonProtocolModePractice, wantOK: true,
},
{
name: "修炼场 direct button keeps the ordinary policy",
runtimeState: 1, runtimeToken: 0xffff, dungeonID: int64(currentPungjinTrainingDungeonID),
wantMode: currentDungeonProtocolModeNormal, wantOK: true,
},
{
name: "转职体验 direct button keeps the ordinary policy",
runtimeState: 1, runtimeToken: 0xffff, dungeonID: int64(currentJobChangeTrialDungeonID),
wantMode: currentDungeonProtocolModeNormal, wantOK: true,
},
{
name: "unproven pair", runtimeState: 1, runtimeToken: 1, dungeonID: 190,
wantMode: currentDungeonProtocolModeNormal, wantOK: false,
},
}
for _, testCase := range cases {
t.Run(testCase.name, func(t *testing.T) {
mode, ok := currentDungeonProtocolModeForRoom(
testCase.runtimeState, testCase.runtimeToken, testCase.dungeonID,
)
if mode != testCase.wantMode || ok != testCase.wantOK {
t.Fatalf("currentDungeonProtocolModeForRoom(%d,%d,%d)=(%s,%t) want=(%s,%t)",
testCase.runtimeState, testCase.runtimeToken, testCase.dungeonID,
mode, ok, testCase.wantMode, testCase.wantOK)
}
})
}
}
// The guided-room exemption is keyed to the room, not to the shape, so a
// neighbouring id must still reach the practice policy.
func TestCurrentDungeonGuidedDirectEntryRoomIsKeyedToTheRoom(t *testing.T) {
if !currentDungeonGuidedDirectEntryRoom(int64(currentPungjinTrainingDungeonID)) {
t.Fatal("the training room must own the guided direct-entry route")
}
if !currentDungeonGuidedDirectEntryRoom(int64(currentJobChangeTrialDungeonID)) {
t.Fatal("the job-change trial must own the guided direct-entry route")
}
for _, dungeonID := range []int64{0, -1, 190, 5001, 7141, 7143, 1 << 33} {
if currentDungeonGuidedDirectEntryRoom(dungeonID) {
t.Fatalf("dungeon %d must not be treated as a guided direct-entry room", dungeonID)
}
}
}