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,110 @@
|
||||
package dnfbridge
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"longheng.io/server/internal/modules/dnf/avatartitle"
|
||||
)
|
||||
|
||||
const (
|
||||
currentAvatarCompoundRequestSize = 22
|
||||
currentAvatarCompoundErrorCode = 0x16
|
||||
)
|
||||
|
||||
var (
|
||||
errCurrentAvatarCompoundRequestInvalid = errors.New("dnf current avatar compound request is invalid")
|
||||
errCurrentAvatarCompoundUnavailable = errors.New("dnf current avatar compound owner or PVF mapping is unavailable")
|
||||
errCurrentAvatarCompoundSourceInvalid = errors.New("dnf current avatar compound source is invalid")
|
||||
errCurrentAvatarCompoundMaterial = errors.New("dnf current avatar compound synthesizer is invalid")
|
||||
errCurrentAvatarCompoundOutputInvalid = errors.New("dnf current avatar compound output is invalid")
|
||||
)
|
||||
|
||||
type currentAvatarCompoundRequest struct {
|
||||
ConsumeSlot int16
|
||||
Slot1 int16
|
||||
ExpectedItemID1 uint32
|
||||
Slot2 int16
|
||||
ExpectedItemID2 uint32
|
||||
RequestedItemID uint32
|
||||
AbilityNo uint16
|
||||
RequestedItemFlag byte
|
||||
MaterialClass byte
|
||||
}
|
||||
|
||||
type currentAvatarCompoundResult struct {
|
||||
MaterialItemID uint32
|
||||
MaterialRemain int64
|
||||
SourceItemIDs [2]uint32
|
||||
NewSlots []int16
|
||||
NewItemIDs []uint32
|
||||
RareRate int64
|
||||
RareRoll uint64
|
||||
RareHit bool
|
||||
}
|
||||
|
||||
func parseCurrentAvatarCompoundRequest(body []byte) (currentAvatarCompoundRequest, error) {
|
||||
if len(body) != currentAvatarCompoundRequestSize {
|
||||
return currentAvatarCompoundRequest{}, fmt.Errorf("%w: body=%d", errCurrentAvatarCompoundRequestInvalid, len(body))
|
||||
}
|
||||
decoded, err := avatartitle.DecodeCompoundAvatarRequest(body)
|
||||
if err != nil {
|
||||
return currentAvatarCompoundRequest{}, errors.Join(errCurrentAvatarCompoundRequestInvalid, err)
|
||||
}
|
||||
if decoded.ConsumeSlot < 0 || decoded.Slot1 < 0 || decoded.Slot2 < 0 || decoded.Slot1 == decoded.Slot2 ||
|
||||
decoded.ExpectedItemID1 <= 0 || decoded.ExpectedItemID2 <= 0 || decoded.RequestItemID <= 0 ||
|
||||
decoded.RequestedItemFlag > 1 {
|
||||
return currentAvatarCompoundRequest{}, errCurrentAvatarCompoundRequestInvalid
|
||||
}
|
||||
return currentAvatarCompoundRequest{
|
||||
ConsumeSlot: decoded.ConsumeSlot,
|
||||
Slot1: decoded.Slot1,
|
||||
ExpectedItemID1: uint32(decoded.ExpectedItemID1),
|
||||
Slot2: decoded.Slot2,
|
||||
ExpectedItemID2: uint32(decoded.ExpectedItemID2),
|
||||
RequestedItemID: uint32(decoded.RequestItemID),
|
||||
AbilityNo: decoded.AbilityNo,
|
||||
RequestedItemFlag: decoded.RequestedItemFlag,
|
||||
MaterialClass: decoded.MaterialClass,
|
||||
}, nil
|
||||
}
|
||||
|
||||
// buildCurrentAvatarCompoundSuccessBody is the exact class-1/op99 body read
|
||||
// by NoPack.exe sub_1D1C6D0. The leading byte is the common success status;
|
||||
// it is followed by three deletion rows and exactly two result records.
|
||||
func buildCurrentAvatarCompoundSuccessBody(request currentAvatarCompoundRequest, result currentAvatarCompoundResult) []byte {
|
||||
var body packetWriter
|
||||
body.writeByte(1)
|
||||
body.writeByte(3)
|
||||
body.writeByte(currentAvatarInventoryListType)
|
||||
body.writeUint16(uint16(request.Slot1))
|
||||
body.writeUint32(1)
|
||||
body.writeByte(currentAvatarInventoryListType)
|
||||
body.writeUint16(uint16(request.Slot2))
|
||||
body.writeUint32(1)
|
||||
body.writeByte(0)
|
||||
body.writeUint16(uint16(request.ConsumeSlot))
|
||||
body.writeUint32(1)
|
||||
for index := 0; index < 2; index++ {
|
||||
if index < len(result.NewItemIDs) && index < len(result.NewSlots) {
|
||||
body.writeUint16(uint16(result.NewSlots[index]))
|
||||
body.writeUint32(result.NewItemIDs[index])
|
||||
} else {
|
||||
body.writeUint16(^uint16(0))
|
||||
body.writeUint32(0)
|
||||
}
|
||||
body.writeUint32(0)
|
||||
body.writeUint16(request.AbilityNo)
|
||||
body.writeUint32(30)
|
||||
body.writeZero(30)
|
||||
body.writeUint32(4)
|
||||
body.writeZero(4)
|
||||
}
|
||||
return body.bytes()
|
||||
}
|
||||
|
||||
func currentAvatarCompoundFailureBody() []byte {
|
||||
// The current op99 sender/reference includes the third zero tail. The
|
||||
// class-1 dispatcher consumes status/error and safely ignores the tail.
|
||||
return []byte{0, currentAvatarCompoundErrorCode, 0}
|
||||
}
|
||||
Reference in new issue
Block a user