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

122 lines
4.0 KiB
Go

package dnfbridge
import (
"testing"
)
func TestRuntimeRaidTeamGraphOwnerResolvesUnsetModeToAnton(t *testing.T) {
tests := []struct {
name string
state runtimeRaidState
wantOwner byte
wantAnton bool
}{
{
// RaidMode is stamped at start, so a roster that has not started yet
// reads 0. Anton is the only team graph such a state can belong to.
name: "unset mode is the anton team graph",
state: runtimeRaidState{},
wantOwner: runtimeRaidOwnerAnton,
wantAnton: true,
},
{
name: "anton team",
state: runtimeRaidState{RaidMode: runtimeRaidOwnerAnton},
wantOwner: runtimeRaidOwnerAnton,
wantAnton: true,
},
{
name: "luke team",
state: runtimeRaidState{RaidMode: runtimeRaidOwnerLuke},
wantOwner: runtimeRaidOwnerLuke,
wantAnton: false,
},
{
// Single mode runs a flat route and arms no team mechanism, so it is
// not the Anton team graph even though its owner resolves to Anton.
name: "anton single",
state: runtimeRaidState{RaidMode: runtimeRaidOwnerAnton, TailFlag: 1},
wantOwner: runtimeRaidOwnerAnton,
wantAnton: false,
},
{
name: "luke single",
state: runtimeRaidState{RaidMode: runtimeRaidOwnerLuke, TailFlag: 1},
wantOwner: runtimeRaidOwnerLuke,
wantAnton: false,
},
}
for _, test := range tests {
t.Run(test.name, func(t *testing.T) {
if got := runtimeRaidTeamGraphOwner(test.state); got != test.wantOwner {
t.Fatalf("owner=%d want=%d", got, test.wantOwner)
}
if got := runtimeRaidUsesAntonTeamGraph(test.state); got != test.wantAnton {
t.Fatalf("uses anton team graph=%t want=%t", got, test.wantAnton)
}
})
}
}
func TestLukeTeamPhaseNeverCompletesThroughAntonGates(t *testing.T) {
// 213 and 215 are Anton's two legs. A Luke state that happens to carry them
// must still not read as complete, because Luke's phase one ends on its own
// three sanctums.
state := runtimeRaidState{
RaidMode: runtimeRaidOwnerLuke,
Lifecycle: runtimeRaidLifecycleState{
Phase: runtimeRaidDungeonPhaseOne,
Objectives: map[int]runtimeRaidDungeonObjective{
213: {Phase: runtimeRaidDungeonPhaseOne, MapID: 213, RemainingHP: 0},
215: {Phase: runtimeRaidDungeonPhaseOne, MapID: 215, RemainingHP: 0},
},
},
}
if runtimeRaidPhaseObjectivesComplete(state, runtimeRaidDungeonPhaseOne) {
t.Fatal("luke phase one completed through Anton's legs")
}
state.RaidMode = runtimeRaidOwnerAnton
if !runtimeRaidPhaseObjectivesComplete(state, runtimeRaidDungeonPhaseOne) {
t.Fatal("anton phase one did not complete on its own legs")
}
phaseTwo := runtimeRaidState{
RaidMode: runtimeRaidOwnerLuke,
Lifecycle: runtimeRaidLifecycleState{
Phase: runtimeRaidDungeonPhaseTwo,
Objectives: map[int]runtimeRaidDungeonObjective{
220: {Phase: runtimeRaidDungeonPhaseTwo, MapID: 220, RemainingHP: 0},
},
},
}
if runtimeRaidPhaseObjectivesComplete(phaseTwo, runtimeRaidDungeonPhaseTwo) {
t.Fatal("luke phase two completed through Anton's heart")
}
phaseTwo.RaidMode = runtimeRaidOwnerAnton
if !runtimeRaidPhaseObjectivesComplete(phaseTwo, runtimeRaidDungeonPhaseTwo) {
t.Fatal("anton phase two did not complete on its own heart")
}
}
// TestLukeTeamPhaseTwoSnapshotCarriesNoAntonSymbols proves the snapshot no
// longer mixes namespaces: every key runtimeRaidPhaseTwoSymbolRows emits is an
// etc/raid/anton.etc.symbol id, and those ids mean different things in
// etc/raid/luke/luke.etc.symbol.
func TestLukeTeamPhaseTwoSnapshotCarriesNoAntonSymbols(t *testing.T) {
state := runtimeRaidState{
RaidMode: runtimeRaidOwnerLuke,
Lifecycle: runtimeRaidLifecycleState{
Phase: runtimeRaidDungeonPhaseTwo,
Barrier: antonBarrierMaximum,
MovieSymbols: map[uint32]uint32{},
},
}
if rows := runtimeRaidPhaseTwoSymbolRows(state); len(rows) != 0 {
t.Fatalf("luke phase two symbol rows=%+v want none", rows)
}
state.RaidMode = runtimeRaidOwnerAnton
if rows := runtimeRaidPhaseTwoSymbolRows(state); len(rows) == 0 {
t.Fatal("anton phase two symbol rows are empty")
}
}