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,107 @@
|
||||
package dnfbridge
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"longheng.io/server/internal/modules/dnf/dnfenum"
|
||||
dnfproto "longheng.io/server/internal/modules/dnf/protocol"
|
||||
"longheng.io/server/internal/modules/dnf/worldmap"
|
||||
)
|
||||
|
||||
func TestHandleDungeonMissionCheckSuccessRecognizesCompletedTutorialWithoutInventingReward(t *testing.T) {
|
||||
service, runtime := prepareTutorialScopeRuntime(t, tutorialScopeFixtureOptions{
|
||||
job: "12",
|
||||
dungeonReference: tutorialScopeKnightFDungeonReference,
|
||||
mapDirectory: tutorialScopeKnightFMapDirectory,
|
||||
})
|
||||
if err := runtime.Session.CompleteCurrentRoom(); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
runtime.bossDieCheckAccepted = true
|
||||
conn := &bufferConn{}
|
||||
session := &gameSession{
|
||||
conn: conn,
|
||||
connID: "op560-deferred-test",
|
||||
selectedCharacterID: 99,
|
||||
dungeon: dungeonSessionState{runtime: runtime},
|
||||
}
|
||||
|
||||
request, err := dnfproto.BuildChannelPacket(
|
||||
uint16(dnfenum.CmdPacketDungeonMissionCheckSuccess),
|
||||
nil,
|
||||
0,
|
||||
dnfproto.DefaultChannelClassification,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := service.handleGameUpper(session, request); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if conn.write.Len() != 0 {
|
||||
t.Fatalf("op560 without reward source emitted invented response=%x", conn.write.Bytes())
|
||||
}
|
||||
if session.dungeon.runtime != runtime || !runtime.bossDieCheckAccepted {
|
||||
t.Fatalf("deferred op560 changed runtime owner=%p accepted=%t", session.dungeon.runtime, runtime.bossDieCheckAccepted)
|
||||
}
|
||||
if status := runtime.Session.Snapshot().Run.Status; status != worldmap.DungeonRunCompleted {
|
||||
t.Fatalf("deferred op560 changed run status=%s", status)
|
||||
}
|
||||
}
|
||||
|
||||
func TestHandleDungeonMissionCheckSuccessRejectsMalformedOrWrongClass(t *testing.T) {
|
||||
tests := []struct {
|
||||
name string
|
||||
body []byte
|
||||
classification byte
|
||||
}{
|
||||
{name: "non-empty body", body: []byte{0}, classification: dnfproto.DefaultChannelClassification},
|
||||
{name: "wrong class", classification: 0},
|
||||
}
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
service, runtime := prepareTutorialScopeRuntime(t, tutorialScopeFixtureOptions{})
|
||||
conn := &bufferConn{}
|
||||
session := &gameSession{conn: conn, selectedCharacterID: 99, dungeon: dungeonSessionState{runtime: runtime}}
|
||||
request, err := dnfproto.BuildChannelPacket(
|
||||
uint16(dnfenum.CmdPacketDungeonMissionCheckSuccess),
|
||||
test.body,
|
||||
0,
|
||||
test.classification,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if err := service.handleGameUpper(session, request); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if conn.write.Len() != 0 || session.dungeon.runtime != runtime {
|
||||
t.Fatalf("rejected op560 wrote=%x runtime=%p", conn.write.Bytes(), session.dungeon.runtime)
|
||||
}
|
||||
if status := runtime.Session.Snapshot().Run.Status; status != worldmap.DungeonRunActive {
|
||||
t.Fatalf("rejected op560 status=%s want=%s", status, worldmap.DungeonRunActive)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestHandleDungeonMissionCheckSuccessDefersGenericActiveDungeonWithoutMutation(t *testing.T) {
|
||||
service, runtime := prepareTutorialScopeRuntime(t, tutorialScopeFixtureOptions{
|
||||
omitTutorialFlag: true,
|
||||
})
|
||||
conn := &bufferConn{}
|
||||
session := &gameSession{conn: conn, selectedCharacterID: 99, dungeon: dungeonSessionState{runtime: runtime}}
|
||||
before := runtime.Session.Snapshot()
|
||||
|
||||
if err := service.handleDungeonMissionCheckSuccess(session, nil); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
after := runtime.Session.Snapshot()
|
||||
if conn.write.Len() != 0 || session.dungeon.runtime != runtime {
|
||||
t.Fatalf("generic op560 wrote=%x runtime=%p", conn.write.Bytes(), session.dungeon.runtime)
|
||||
}
|
||||
if after.Run.Status != before.Run.Status || after.Scene.Cleared != before.Scene.Cleared ||
|
||||
len(after.Scene.DefeatedObjects) != len(before.Scene.DefeatedObjects) {
|
||||
t.Fatalf("generic op560 mutated dungeon before=%+v after=%+v", before, after)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user