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

62 lines
2.0 KiB
Go

package dnfbridge
import (
"bytes"
"context"
"encoding/binary"
"testing"
"time"
dnfrepo "longheng.io/server/internal/modules/dnf/repository"
)
func TestCurrentMode1EquippedCustomAbilityFallsBackToCurrentItemRaw(t *testing.T) {
repos := testRepositoryGroup()
rawWeapon := make([]byte, currentItemListEntryWireSize)
binary.LittleEndian.PutUint16(rawWeapon[0x00:0x02], 11)
binary.LittleEndian.PutUint32(rawWeapon[0x02:0x06], 900001)
binary.LittleEndian.PutUint32(rawWeapon[0x06:0x0a], 123456)
binary.LittleEndian.PutUint16(rawWeapon[0x0b:0x0d], 27)
rawWeapon[currentEpicProductionAbilityTailOffset+0] = 4
rawWeapon[currentEpicProductionAbilityTailOffset+1] = 20
if err := repos.Equipment.Save(context.Background(), dnfrepo.EquipmentRecord{
CharacterID: "77",
Entries: map[string]dnfrepo.EquipmentEntry{
"11": {
SlotIndex: 11,
ItemID: 900001,
RawEntry: rawWeapon,
Extra: map[string]string{
"current_exe_equipment_type": "12",
"mode1_create_enabled": "1",
},
},
},
UpdatedAt: time.Now().UTC(),
}); err != nil {
t.Fatal(err)
}
service := Service{repositoryProvider: func() (dnfrepo.Group, bool) { return repos, true }}
reader := csharpLegacyUserInfoReader{ctx: context.Background(), service: &service, characterID: "77"}
rows := currentMode1EquipmentCreateRows(reader.currentMode1EquipmentObjectRows())
if len(rows) != 1 {
t.Fatalf("mode1 equipment rows = %d, want 1", len(rows))
}
want := []byte{4, 20, 0, 0, 0}
if !bytes.Equal(rows[0].lateRawE, want) {
t.Fatalf("mode1 late rawE = %x, want %x", rows[0].lateRawE, want)
}
var writer packetWriter
writeCurrentMode1EquipmentCreateRow(&writer, rows[0])
wire := writer.bytes()
blockStart := len(wire) - len(want) - currentMode1EquipmentRawBlockHeaderSize
if blockStart < 0 || binary.LittleEndian.Uint32(wire[blockStart:blockStart+4]) != uint32(len(want)) {
t.Fatalf("mode1 late rawE block invalid: %x", wire)
}
if got := wire[blockStart+4:]; !bytes.Equal(got, want) {
t.Fatalf("mode1 late rawE wire = %x, want %x", got, want)
}
}