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,88 @@
|
||||
package dnfbridge
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"longheng.io/server/internal/modules/dnf/worldmap"
|
||||
)
|
||||
|
||||
func TestDungeonRuntimeContainsDeathOwnerObjectKey(t *testing.T) {
|
||||
currentMonsterKey := uint32(407)
|
||||
currentRoom := dungeonDeathOwnerTestRoom(
|
||||
[]runtimeDungeonMonster{{ObjectKey: currentMonsterKey, State: runtimeDungeonMonsterAnnounced}},
|
||||
nil,
|
||||
)
|
||||
previousMonsterKey := uint32(402)
|
||||
previousFriendlyAPCKey := uint32(405)
|
||||
previousHostileAPCKey := uint32(406)
|
||||
previousUnannouncedAPCKey := uint32(412)
|
||||
previousHostileReference := worldmap.HostileReference{Kind: worldmap.HostileAICharacter, Index: 0}
|
||||
previousRoom := dungeonDeathOwnerTestRoom(
|
||||
[]runtimeDungeonMonster{{ObjectKey: previousMonsterKey, State: runtimeDungeonMonsterDefeated}},
|
||||
[]runtimeDungeonExtendedActor{
|
||||
{
|
||||
Kind: runtimeDungeonActorAICharacter,
|
||||
ObjectKey: previousFriendlyAPCKey,
|
||||
State: runtimeDungeonMonsterAnnounced,
|
||||
},
|
||||
{
|
||||
Kind: runtimeDungeonActorAICharacter,
|
||||
ObjectKey: previousHostileAPCKey,
|
||||
HostileReference: &previousHostileReference,
|
||||
State: runtimeDungeonMonsterAnnounced,
|
||||
},
|
||||
{
|
||||
Kind: runtimeDungeonActorAICharacter,
|
||||
ObjectKey: previousUnannouncedAPCKey,
|
||||
State: runtimeDungeonMonsterPlanned,
|
||||
},
|
||||
},
|
||||
)
|
||||
runtime := &runtimeDungeonState{
|
||||
Room: currentRoom,
|
||||
Rooms: map[runtimeDungeonRoomKey]*runtimeDungeonRoomVisit{
|
||||
{X: 3, Y: 1, MapID: 57880}: {Room: currentRoom},
|
||||
{X: 4, Y: 1, MapID: 57879}: {Room: previousRoom},
|
||||
},
|
||||
}
|
||||
|
||||
tests := []struct {
|
||||
name string
|
||||
objectKey uint32
|
||||
want bool
|
||||
}{
|
||||
{name: "current room actor", objectKey: currentMonsterKey, want: true},
|
||||
{name: "previous room friendly APC", objectKey: previousFriendlyAPCKey, want: true},
|
||||
{name: "previous room monster", objectKey: previousMonsterKey, want: false},
|
||||
{name: "previous room hostile APC", objectKey: previousHostileAPCKey, want: false},
|
||||
{name: "previous room unannounced APC", objectKey: previousUnannouncedAPCKey, want: false},
|
||||
{name: "unknown object", objectKey: 65000, want: false},
|
||||
{name: "zero object", objectKey: 0, want: false},
|
||||
}
|
||||
for _, test := range tests {
|
||||
t.Run(test.name, func(t *testing.T) {
|
||||
if got := dungeonRuntimeContainsDeathOwnerObjectKey(runtime, test.objectKey); got != test.want {
|
||||
t.Fatalf("owner object key %d accepted=%t want=%t", test.objectKey, got, test.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func dungeonDeathOwnerTestRoom(
|
||||
monsters []runtimeDungeonMonster,
|
||||
extendedActors []runtimeDungeonExtendedActor,
|
||||
) *runtimeDungeonRoom {
|
||||
room := &runtimeDungeonRoom{
|
||||
monsters: monsters,
|
||||
byObjectKey: make(map[uint32]int, len(monsters)),
|
||||
extendedActors: extendedActors,
|
||||
extendedByObjectKey: make(map[uint32]int, len(extendedActors)),
|
||||
}
|
||||
for index, monster := range monsters {
|
||||
room.byObjectKey[monster.ObjectKey] = index
|
||||
}
|
||||
for index, actor := range extendedActors {
|
||||
room.extendedByObjectKey[actor.ObjectKey] = index
|
||||
}
|
||||
return room
|
||||
}
|
||||
Reference in new issue
Block a user