服务端(Go): - GM 塞背包/带属性装备发放:在线角色推送 op14 增量物品行,背包实时刷新,无需回角色选择界面 - GM 改金币/改等级:去掉在线拒绝,落库后推送 op14 钱包/op37 等级状态,在线实时刷新 - 等级端点统一切换到新版 GMSetCharacterLevel(自带在线刷新) - 无限/锁死疲劳模式 + 燃烧疲劳:每房间消耗 2 点、打怪与通关经验双倍 - 燃烧疲劳开关时给所有在线角色推送系统提示(op12 mode 0) - 深渊史诗掉率:GM 全局倍率 + 城镇增益药剂窗口倍率,真实接入掉落结算 启动器(Python/JS): - 标题栏自绘、窗口 1204x717、禁止拖拽改大小、仅最小化/关闭 - GM 工具:疲劳与燃烧、深渊史诗掉率、拍卖行上架(单一定价对齐) - 拍卖行上架前端对齐服务端单一价格语义,修复 400 报错
84 lines
3.1 KiB
Go
84 lines
3.1 KiB
Go
package dnfbridge
|
|
|
|
import (
|
|
"testing"
|
|
|
|
dnfrepo "longheng.io/server/internal/modules/dnf/repository"
|
|
"longheng.io/server/internal/modules/dnf/worldmap"
|
|
)
|
|
|
|
func TestSelectDungeonMazeUsesPersistedQuestConnectionsBeforeDefaults(t *testing.T) {
|
|
mazes := []worldmap.Maze{
|
|
{Index: 0},
|
|
{Index: 1, QuestConnection: []int64{0, 3145, 0}},
|
|
{Index: 2, QuestConnection: []int64{1, 3144}},
|
|
}
|
|
selected, err := selectDungeonMaze(mazes, 0, dnfrepo.QuestRecord{States: map[int64]dnfrepo.QuestState{
|
|
3145: {Status: "active"},
|
|
3144: {Status: "completed"},
|
|
}}, func(int) (int, error) {
|
|
t.Fatal("single quest-connected maze must not invoke random chooser")
|
|
return 0, nil
|
|
})
|
|
if err != nil || selected.Index != 1 || selected.QuestID != 3145 || selected.Reason != "active_quest_connection" {
|
|
t.Fatalf("active quest selection=%+v err=%v", selected, err)
|
|
}
|
|
|
|
selected, err = selectDungeonMaze(mazes, 0, dnfrepo.QuestRecord{Progress: map[int64]dnfrepo.QuestState{
|
|
3144: {Status: "cleared"},
|
|
}}, nil)
|
|
if err != nil || selected.Index != 2 || selected.QuestID != 3144 || selected.Reason != "cleared_quest_connection" {
|
|
t.Fatalf("cleared quest selection=%+v err=%v", selected, err)
|
|
}
|
|
}
|
|
|
|
func TestSelectDungeonMazeHonorsDifficultyAndNonQuestFallback(t *testing.T) {
|
|
mazes := []worldmap.Maze{
|
|
{Index: 0},
|
|
{Index: 1, QuestConnection: []int64{0, 3145, 2}},
|
|
{Index: 2},
|
|
}
|
|
record := dnfrepo.QuestRecord{States: map[int64]dnfrepo.QuestState{3145: {Status: "accepted"}}}
|
|
selected, err := selectDungeonMaze(mazes, 1, record, func(limit int) (int, error) {
|
|
if limit != 2 {
|
|
t.Fatalf("default candidate count=%d", limit)
|
|
}
|
|
return 1, nil
|
|
})
|
|
if err != nil || selected.Index != 2 || selected.QuestID != 0 || selected.Reason != "pvf_non_quest_maze" {
|
|
t.Fatalf("difficulty fallback selection=%+v err=%v", selected, err)
|
|
}
|
|
|
|
selected, err = selectDungeonMaze(mazes, 2, record, nil)
|
|
if err != nil || selected.Index != 1 || selected.QuestID != 3145 || selected.Reason != "active_quest_connection" {
|
|
t.Fatalf("difficulty match selection=%+v err=%v", selected, err)
|
|
}
|
|
}
|
|
|
|
func TestSelectDungeonMazeUsesFirstOnlyWhenPVFHasNoDefault(t *testing.T) {
|
|
selected, err := selectDungeonMaze([]worldmap.Maze{
|
|
{Index: 0, QuestConnection: []int64{0, 100}},
|
|
{Index: 1, QuestConnection: []int64{1, 101}},
|
|
}, 0, dnfrepo.QuestRecord{}, nil)
|
|
if err != nil || selected.Index != 0 || selected.Reason != "pvf_first_maze_no_default" {
|
|
t.Fatalf("no-default selection=%+v err=%v", selected, err)
|
|
}
|
|
}
|
|
|
|
func TestSelectDungeonMazeHonorsPVFRouteWeights(t *testing.T) {
|
|
mazes := []worldmap.Maze{
|
|
{Index: 0, ChanceRate: worldmap.OptionalInt{Value: 11875, Set: true}},
|
|
{Index: 1, ChanceRate: worldmap.OptionalInt{Value: 11875, Set: true}},
|
|
{Index: 2, ChanceRate: worldmap.OptionalInt{Value: 2500, Set: true}, InfernoSpecial: true},
|
|
}
|
|
selected, err := selectDungeonMaze(mazes, 2, dnfrepo.QuestRecord{}, func(limit int) (int, error) {
|
|
if limit != 26250 {
|
|
t.Fatalf("weighted limit=%d want 26250", limit)
|
|
}
|
|
return 23750, nil
|
|
})
|
|
if err != nil || selected.Index != 2 || selected.Reason != "pvf_non_quest_maze" {
|
|
t.Fatalf("weighted selection=%+v err=%v", selected, err)
|
|
}
|
|
}
|