Files
90CNServer/server/internal/services/dnfbridge/initial_town_scene_ready_test.go
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

71 lines
3.5 KiB
Go

package dnfbridge
import "testing"
// TestCurrentSceneTransitionReadyAfterOrdinaryTownMove pins the upstream branch
// this fork had dropped. The op24/op36 town-area move path retires the initial
// town route (initialTownRouteCharacterID = 0, stage = idle) and then records
// townSceneReadyCharacterID for the same character -- it never re-arms the
// route. Without the "retired route, bound actor" branch the predicate is false
// for the rest of the session, and every 公会 caller that guards on it fails
// with the module's generic error byte.
//
// Live 2026-10-04 19:44: the player teleported to 安徒恩战舰, moved areas twice,
// then every 公会金库 deposit was answered op247 {0, 196} and the client showed
// dstr 21684 「公会仓库尚未完成加载。」— the cargo itself was fine (op261 had
// just answered capacity 56 / zero rows).
func TestCurrentSceneTransitionReadyAfterOrdinaryTownMove(t *testing.T) {
service, session, _, _ := newLegacyTownSceneReadySkillTest(t)
// Login shape: the initial town route is live and committed.
if ready, source := service.currentSceneTransitionReadyForState(session); !ready {
t.Fatalf("committed initial town route read as unready: %s", source)
}
// Ordinary town-area move: retire the route, keep the actor bound.
session.townMu.Lock()
session.initialTownRouteCharacterID = 0
session.initialTownRouteStage = currentInitialTownRouteIdle
session.townSceneReadyCharacterID = session.selectedCharacterID
session.townMu.Unlock()
ready, source := service.currentSceneTransitionReadyForState(session)
if !ready || source != "committed_town_scene_after_initial_route" {
t.Fatalf("town move left the scene unready: ready=%t source=%s", ready, source)
}
if ready, source, busy := service.currentSceneTransitionReadyForStateNonBlocking(session); !ready || busy ||
source != "committed_town_scene_after_initial_route" {
t.Fatalf("non-blocking read disagrees: ready=%t busy=%t source=%s", ready, busy, source)
}
// The same session states must not read as ready in a dungeon: the dungeon
// path owns its own boundary (postStartMapPlayerStateSent), and a retired
// town route is not evidence that a dungeon scene exists.
session.dungeon.runtime = &runtimeDungeonState{}
ready, source = service.currentSceneTransitionReadyForState(session)
if ready || source != "actor_binding_or_scene_transition_incomplete" {
t.Fatalf("dungeon with a retired town route read as ready: ready=%t source=%s", ready, source)
}
if ready, source, busy := service.currentSceneTransitionReadyForStateNonBlocking(session); ready || busy ||
source != "actor_binding_or_scene_transition_incomplete" {
t.Fatalf("non-blocking dungeon read disagrees: ready=%t busy=%t source=%s", ready, busy, source)
}
session.dungeon.runtime = nil
// A different character's bound scene must not authorize this session, and a
// session with no selected character (character select) stays unready.
session.townMu.Lock()
session.townSceneReadyCharacterID = session.selectedCharacterID + 1
session.townMu.Unlock()
if ready, source := service.currentSceneTransitionReadyForState(session); ready {
t.Fatalf("another character's town scene authorized the session: %s", source)
}
session.townMu.Lock()
session.townSceneReadyCharacterID = session.selectedCharacterID
session.selectedCharacterID = 0
session.townMu.Unlock()
if ready, source := service.currentSceneTransitionReadyForState(session); ready {
t.Fatalf("character select read as ready: %s", source)
}
}