服务端(Go): - GM 塞背包/带属性装备发放:在线角色推送 op14 增量物品行,背包实时刷新,无需回角色选择界面 - GM 改金币/改等级:去掉在线拒绝,落库后推送 op14 钱包/op37 等级状态,在线实时刷新 - 等级端点统一切换到新版 GMSetCharacterLevel(自带在线刷新) - 无限/锁死疲劳模式 + 燃烧疲劳:每房间消耗 2 点、打怪与通关经验双倍 - 燃烧疲劳开关时给所有在线角色推送系统提示(op12 mode 0) - 深渊史诗掉率:GM 全局倍率 + 城镇增益药剂窗口倍率,真实接入掉落结算 启动器(Python/JS): - 标题栏自绘、窗口 1204x717、禁止拖拽改大小、仅最小化/关闭 - GM 工具:疲劳与燃烧、深渊史诗掉率、拍卖行上架(单一定价对齐) - 拍卖行上架前端对齐服务端单一价格语义,修复 400 报错
72 lines
2.5 KiB
Go
72 lines
2.5 KiB
Go
package dnfbridge
|
|
|
|
import (
|
|
"context"
|
|
"encoding/binary"
|
|
"reflect"
|
|
"testing"
|
|
|
|
"longheng.io/server/internal/modules/dnf/channelcatalog"
|
|
dnfpvp "longheng.io/server/internal/modules/dnf/pvp"
|
|
repo "longheng.io/server/internal/modules/dnf/repository"
|
|
)
|
|
|
|
func TestPVPTotalMissionsBeforeTeamRegistration(t *testing.T) {
|
|
s := pvpRoomTestService(t)
|
|
s.pvpTotalCatalog = pvpDailyTestCatalog()
|
|
s.pvpTotalCatalog.Normal = []dnfpvp.Mission{
|
|
{ID: 800, Category: "battle", Condition: "hereafter join", Target: 100},
|
|
{ID: 801, Category: "battle", Condition: "hereafter join", Target: 333, PreRequired: 800},
|
|
{ID: 824, Category: "victory", Condition: "hereafter winning count", Target: 100},
|
|
}
|
|
repos, _ := s.repositoryGroup()
|
|
ctx := context.Background()
|
|
if err := repos.Account.Save(ctx, repo.AccountRecord{AccountID: "pvp-29", Metadata: map[string]string{"keep": "yes"}}); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
before, _, _ := repos.Character.Load(ctx, "29")
|
|
p := &gameSession{conn: &bufferConn{}, accountID: "pvp-29", selectedCharacterID: 29,
|
|
channel: channelcatalog.Channel{ID: 75, Type: 8, Group: "pvp"}}
|
|
var first []byte
|
|
for attempt := 0; attempt < 2; attempt++ {
|
|
if err := s.sendCurrentPVPDailyState(p); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
packets := totalTestPackets(t, p)
|
|
var mission []byte
|
|
for _, packet := range packets {
|
|
if packet.Header.MsgID == 323 {
|
|
if mission != nil {
|
|
t.Fatal("second op323 would replace the first task family")
|
|
}
|
|
mission = packet.Body
|
|
}
|
|
if packet.Header.MsgID == 48 || packet.Header.MsgID == 801 || packet.Header.MsgID == 802 {
|
|
t.Fatal("mission publication invented a three-character roster")
|
|
}
|
|
}
|
|
if len(mission) != 61 || mission[0] != 6 {
|
|
t.Fatalf("unregistered team got no complete native mission snapshot: %x", mission)
|
|
}
|
|
for i, id := range []uint16{800, 801, 824} {
|
|
row := mission[1+(3+i)*10:]
|
|
if binary.LittleEndian.Uint16(row) != id || binary.LittleEndian.Uint32(row[2:]) != 0 {
|
|
t.Fatal("target row missing or personal match facts leaked", id)
|
|
}
|
|
}
|
|
if attempt == 0 {
|
|
first = append([]byte(nil), mission...)
|
|
} else if !reflect.DeepEqual(first, mission) {
|
|
t.Fatal("reconnecting rerolled missions")
|
|
}
|
|
}
|
|
team, err := dnfpvp.ReadTotalTeam(ctx, repos, p.accountID)
|
|
if err != nil || team.Team.Name != "" || team.Slots != [3]byte{255, 255, 255} {
|
|
t.Fatal("mission initialization registered a team", err)
|
|
}
|
|
after, _, _ := repos.Character.Load(ctx, "29")
|
|
if !reflect.DeepEqual(before.Stats, after.Stats) {
|
|
t.Fatal("total initialization altered ordinary character counters")
|
|
}
|
|
}
|