DNF90 服务端与启动器完整源码(含 GM 工具功能增强)

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

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

No files matched your search

@@ -0,0 +1,96 @@
package companion
import (
"strings"
"testing"
)
func TestCompileAIProfileProducesDeterministicLuaAndReportsGaps(t *testing.T) {
profile := DefaultAIProfile(9)
one, err := CompileAIProfile(profile, DefaultStrategyCapabilities())
if err != nil {
t.Fatal(err)
}
if !one.ReadyForStaticAIC() || one.Status != "compiled_with_gaps" {
t.Fatalf("compile status=%+v", one)
}
if one.LuaSHA256 == "" || !strings.Contains(one.LuaSource, "behavior = \"assist\"") {
t.Fatalf("lua artifact missing: %+v", one)
}
two, err := CompileAIProfile(profile, DefaultStrategyCapabilities())
if err != nil {
t.Fatal(err)
}
if one.LuaSHA256 != two.LuaSHA256 || one.LuaSource != two.LuaSource {
t.Fatalf("compiler is not deterministic: %q %q", one.LuaSHA256, two.LuaSHA256)
}
for _, want := range []StrategyCapability{CapabilityLeaderFollow, CapabilityLeaderBuff, CapabilityTargetSticky, CapabilityStuckDetour} {
found := false
for _, got := range one.MissingCapabilities {
if got == want {
found = true
break
}
}
if !found {
t.Fatalf("missing capability %q not reported: %v", want, one.MissingCapabilities)
}
}
}
func TestCompileAIProfileAggressiveOrdersBuffBeforeAttack(t *testing.T) {
profile := DefaultAIProfile(1)
profile.Behavior = "aggressive"
profile.ComboPreset = "sword_guard"
result, err := CompileAIProfile(profile, StrategyCapabilities{
ThinkTerm: true, Distance: true, Cooldown: true, ActionStream: true, EnemyCount: true,
})
if err != nil {
t.Fatal(err)
}
if !result.ReadyForStaticAIC() {
t.Fatalf("status=%s missing=%v", result.Status, result.MissingCapabilities)
}
if len(result.Steps) == 0 || result.Steps[0].Name != "buff_first" {
t.Fatalf("steps=%+v", result.Steps)
}
if !strings.Contains(result.LuaSource, "combo_preset = \"sword_guard\"") {
t.Fatalf("lua preset missing: %s", result.LuaSource)
}
}
func TestAITuningRejectsUnsafeValues(t *testing.T) {
profile := DefaultAIProfile(1)
profile.Tuning = &AITuning{ThinkIntervalMS: 1}
if err := profile.Validate(); err != ErrSelection {
t.Fatalf("err=%v", err)
}
profile.Tuning = &AITuning{HealLeaderPercent: 101}
if err := profile.Validate(); err != ErrSelection {
t.Fatalf("heal err=%v", err)
}
}
func TestSelectAITemplateUsesNativeBaselineForClassAndBehavior(t *testing.T) {
assist := SelectAITemplate(DefaultAIProfile(4), 4)
aggressiveProfile := DefaultAIProfile(4)
aggressiveProfile.Behavior = "aggressive"
aggressive := SelectAITemplate(aggressiveProfile, 4)
other := SelectAITemplate(DefaultAIProfile(9), 2)
for name, selector := range map[string]AITemplateSelector{
"assist": assist, "aggressive": aggressive, "other": other,
} {
if !selector.Valid() {
t.Fatalf("%s selector invalid: %+v", name, selector)
}
}
if assist.APCCode != 20902 || assist.AICPath != "aicharacter/_bizarre/priest/mirror_priest/mirror_priest.aic" {
t.Fatalf("priest assist did not use native baseline: %+v", assist)
}
if aggressive.APCCode != assist.APCCode || aggressive.AICPath != assist.AICPath {
t.Fatalf("behavior selectors must patch the same native baseline: assist=%+v aggressive=%+v", assist, aggressive)
}
if assist.APCCode == other.APCCode || assist.AICPath == other.AICPath {
t.Fatalf("class selectors aliased: assist=%+v other=%+v", assist, other)
}
}