Files
90CNServer/server/internal/services/dnfbridge/online_player_manager_channel_test.go
T
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

46 lines
2.1 KiB
Go

package dnfbridge
import "testing"
// A channel is a separate copy of the same town. Two characters standing on the
// same map in different channels are not peers: they must not appear in each
// other's area roster, receive each other's movement, or satisfy the party
// dungeon-entry co-presence check. Before areaKey carried the channel id they
// keyed into one shared area, so a character in the arena and a character in an
// ordinary town could see each other while genuine arena peers could not.
func TestOnlinePlayerManagerSeparatesChannelsSharingATownArea(t *testing.T) {
manager := newOnlinePlayerManager()
first := &onlinePlayerInfo{CharacterID: 11, ChannelID: 191, TownID: 10, AreaID: 1}
sameChannel := &onlinePlayerInfo{CharacterID: 12, ChannelID: 191, TownID: 10, AreaID: 1}
otherChannel := &onlinePlayerInfo{CharacterID: 13, ChannelID: 192, TownID: 10, AreaID: 1}
if peers := manager.EnterArea(first); len(peers) != 0 {
t.Fatalf("first character saw unexpected peers: %+v", peers)
}
if peers := manager.EnterArea(otherChannel); len(peers) != 0 {
t.Fatalf("another channel leaked into the area roster: %+v", peers)
}
peers := manager.EnterArea(sameChannel)
if len(peers) != 1 || peers[0].CharacterID != first.CharacterID {
t.Fatalf("same-channel peers=%+v, want only character %d", peers, first.CharacterID)
}
if !manager.PeerInSameArea(first.CharacterID, sameChannel.CharacterID) {
t.Fatal("same-channel characters are not co-present")
}
if manager.PeerInSameArea(first.CharacterID, otherChannel.CharacterID) {
t.Fatal("characters in different channels are visible to each other")
}
if got := manager.GetAreaPlayers(191, 10, 1); len(got) != 2 {
t.Fatalf("channel 191 roster=%+v, want two characters", got)
}
if got := manager.GetAreaPlayers(192, 10, 1); len(got) != 1 ||
got[0].CharacterID != otherChannel.CharacterID {
t.Fatalf("channel 192 roster=%+v, want only character %d", got, otherChannel.CharacterID)
}
if got := manager.GetAreaPlayers(0, 10, 1); len(got) != 0 {
t.Fatalf("channel 0 must not collect a real channel's actors: %+v", got)
}
}