DNF90 服务端与启动器完整源码(含 GM 工具功能增强)
服务端(Go): - GM 塞背包/带属性装备发放:在线角色推送 op14 增量物品行,背包实时刷新,无需回角色选择界面 - GM 改金币/改等级:去掉在线拒绝,落库后推送 op14 钱包/op37 等级状态,在线实时刷新 - 等级端点统一切换到新版 GMSetCharacterLevel(自带在线刷新) - 无限/锁死疲劳模式 + 燃烧疲劳:每房间消耗 2 点、打怪与通关经验双倍 - 燃烧疲劳开关时给所有在线角色推送系统提示(op12 mode 0) - 深渊史诗掉率:GM 全局倍率 + 城镇增益药剂窗口倍率,真实接入掉落结算 启动器(Python/JS): - 标题栏自绘、窗口 1204x717、禁止拖拽改大小、仅最小化/关闭 - GM 工具:疲劳与燃烧、深渊史诗掉率、拍卖行上架(单一定价对齐) - 拍卖行上架前端对齐服务端单一价格语义,修复 400 报错
This commit is contained in:
commit
645b64fe21
4388 files changed
+1405457
No files matched your search
@@ -0,0 +1,101 @@
|
||||
package companion
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"strings"
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestCompileAICArtifactRoundTripsAndDiffersByBehavior(t *testing.T) {
|
||||
assist := DefaultAIProfile(9)
|
||||
aggressive := assist
|
||||
aggressive.Behavior = "aggressive"
|
||||
|
||||
a, err := CompileAICArtifact(assist, DefaultStrategyCapabilities())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
b, err := CompileAICArtifact(aggressive, DefaultStrategyCapabilities())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if a.SHA256 == b.SHA256 || a.AICText == b.AICText {
|
||||
t.Fatal("assist and aggressive artifacts must differ")
|
||||
}
|
||||
values, err := ReadAICArtifact(a.AICText)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if values["[warlike]"] != 0 {
|
||||
t.Fatalf("assist warlike=%d, want 0", values["[warlike]"])
|
||||
}
|
||||
values, err = ReadAICArtifact(b.AICText)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if values["[warlike]"] != 80 {
|
||||
t.Fatalf("aggressive warlike=%d, want 80", values["[warlike]"])
|
||||
}
|
||||
}
|
||||
|
||||
func TestCompileAICArtifactUsesTimeForDestinationRetryAndRejectsMissingPrimitives(t *testing.T) {
|
||||
profile := DefaultAIProfile(4)
|
||||
tuning := DefaultAITuning()
|
||||
tuning.RetryMS = 700
|
||||
tuning.AssistLeashX = 240
|
||||
profile.Tuning = &tuning
|
||||
artifact, err := CompileAICArtifact(profile, DefaultStrategyCapabilities())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
values, err := ReadAICArtifact(artifact.AICText)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if values["[destination change term]"] != 700 {
|
||||
t.Fatal("destination change term must use a time value")
|
||||
}
|
||||
if _, err := CompileAICArtifact(profile, StrategyCapabilities{}); err == nil {
|
||||
t.Fatal("missing static AIC primitives unexpectedly accepted")
|
||||
}
|
||||
}
|
||||
|
||||
func TestPVFOverlayManifestIsStableAndValidatesTampering(t *testing.T) {
|
||||
profile := DefaultAIProfile(15)
|
||||
artifact, err := CompileAICArtifact(profile, DefaultStrategyCapabilities())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
manifest, err := NewPVFOverlayManifest("runtime/data/dnf/Script.pvf", "base-hash", []AICArtifact{artifact})
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := ValidatePVFOverlayManifest(manifest); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
data, err := json.Marshal(manifest)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if !strings.Contains(string(data), "dnf90-companion-pvf-overlay-v1") {
|
||||
t.Fatal("manifest format missing")
|
||||
}
|
||||
manifest.Artifacts[0].AICText = strings.Replace(manifest.Artifacts[0].AICText, "[warlike]\n0", "[warlike]\n80", 1)
|
||||
if err := ValidatePVFOverlayManifest(manifest); err == nil {
|
||||
t.Fatal("tampered artifact unexpectedly validated")
|
||||
}
|
||||
}
|
||||
|
||||
func TestReadAICArtifactRejectsUnknownAndDuplicateTags(t *testing.T) {
|
||||
profile := DefaultAIProfile(1)
|
||||
artifact, err := CompileAICArtifact(profile, DefaultStrategyCapabilities())
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if _, err := ReadAICArtifact(artifact.AICText + "[custom tag]\n1\n"); err == nil {
|
||||
t.Fatal("unknown tag unexpectedly accepted")
|
||||
}
|
||||
if _, err := ReadAICArtifact(artifact.AICText + "[vision]\n1\n"); err == nil {
|
||||
t.Fatal("duplicate tag unexpectedly accepted")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user