Files
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

91 lines
3.1 KiB
Go

package actionobject
import (
"os"
"testing"
dnfpvf "longheng.io/server/internal/modules/dnf/pvf"
platformpvf "longheng.io/server/internal/platform/pvf"
)
// TestRealScriptPVFEnergySaveGateScripts decodes the shipped 能源储藏室 scripts
// rather than the hand-written fixtures above, so a grammar the fixtures do not
// reproduce cannot pass unnoticed.
func TestRealScriptPVFEnergySaveGateScripts(t *testing.T) {
pvfPath := os.Getenv("DNF_WORLDMAP_REAL_PVF_SMOKE")
if pvfPath == "" {
t.Skip("set DNF_WORLDMAP_REAL_PVF_SMOKE to decode the shipped action-object scripts")
}
archive, err := platformpvf.LoadArchive(platformpvf.Options{Path: pvfPath})
if err != nil {
t.Fatal(err)
}
const base = "passiveobject/actionobject/map/luke_raid/phase2/enegy_save/action/"
read := func(name string) Script {
t.Helper()
text, readErr := archive.ReadText(base + name)
if readErr != nil {
t.Fatalf("read %s: %v", name, readErr)
}
document, parseErr := dnfpvf.Parse(base+name, text)
if parseErr != nil {
t.Fatalf("parse %s: %v", name, parseErr)
}
script, decodeErr := Parse(document)
if decodeErr != nil {
t.Fatalf("decode %s: %v", name, decodeErr)
}
return script
}
gate := read("gate_control_gate.act")
if len(gate.Triggers) != 2 || len(gate.Behaviors) != 2 {
t.Fatalf("gate script=%+v", gate)
}
for index, want := range []Condition{
{Kind: ConditionDungeonSymbol, Symbol: "storage gate open", Op: CompareLess, Value: 2},
{Kind: ConditionDungeonSymbol, Symbol: "storage gate open", Op: CompareGreaterEqual, Value: 2},
} {
conditions := gate.Triggers[index].Conditions
if len(conditions) != 1 || conditions[0] != want {
t.Fatalf("gate trigger %d conditions=%+v want %+v (unsupported=%v)",
index, conditions, want, gate.Triggers[index].Unsupported)
}
}
if gate.Triggers[0].Enabled == gate.Triggers[1].Enabled {
t.Fatalf("gate triggers must ship in opposite states: %+v", gate.Triggers)
}
opened := false
for _, operation := range gate.Behaviors[1].Operations {
if operation.Kind == OperationGateEnable && operation.GateEnabled &&
len(operation.GateDirections) == 1 && operation.GateDirections[0] == "down" {
opened = true
}
}
if !opened {
t.Fatalf("gate behavior 1 never opens the down gate: %+v", gate.Behaviors[1])
}
for name, monsterID := range map[string]int64{
"gate_control_left.act": 57156,
"gate_control_right.act": 56068,
} {
cylinder := read(name)
if len(cylinder.Triggers) != 1 || len(cylinder.Behaviors) != 1 {
t.Fatalf("%s=%+v", name, cylinder)
}
conditions := cylinder.Triggers[0].Conditions
want := Condition{Kind: ConditionMonsterCount, MonsterID: monsterID, Op: CompareLess, Value: 1}
if len(conditions) != 1 || conditions[0] != want {
t.Fatalf("%s conditions=%+v want %+v (unsupported=%v)",
name, conditions, want, cylinder.Triggers[0].Unsupported)
}
operations := cylinder.Behaviors[0].Operations
if len(operations) != 1 || operations[0].Kind != OperationSymbolCalc ||
operations[0].Symbol != "storage gate open" ||
operations[0].Calc != "+" || operations[0].Value != 1 {
t.Fatalf("%s operations=%+v", name, operations)
}
}
}