Files
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

81 lines
2.4 KiB
Go

package dnfbridge
import (
"errors"
"math"
dnfrepo "longheng.io/server/internal/modules/dnf/repository"
)
var (
errCurrentOverflowMailRowInvalid = errors.New("current overflow refund row invalid")
// currentOverflowMailMaxRows caps one row's expansion so a corrupt stack
// limit cannot build an unbounded letter.
currentOverflowMailMaxRows = 32
)
// currentOverflowMailAttachments turns one reward row the bag refused into
// mail attachments, splitting a count beyond the template's stack limit across
// rows. The stack goes through buildCurrentDungeonPickupStack so the
// attachment carries the exact item-instance payload and PVF expiration rather
// than a bare template id -- a zero instance timestamp reads as a retired
// event deadline when the letter is opened.
//
// source names the grant for the item's extra map, which is how these rows are
// told apart later from ordinary drops.
func currentOverflowMailAttachments(
catalog *pvfDungeonDropCatalog,
itemID uint32,
count int64,
source string,
) ([]dnfrepo.MailAttachment, error) {
if catalog == nil || itemID == 0 || count <= 0 || source == "" {
return nil, errCurrentOverflowMailRowInvalid
}
definition, err := catalog.ResolveItem(itemID)
if err != nil {
return nil, err
}
attachments := make([]dnfrepo.MailAttachment, 0, 1)
remaining := count
for remaining > 0 {
chunk := remaining
switch definition.Kind {
case dungeonDropItemEquipment:
chunk = 1
case dungeonDropItemStackable:
if definition.StackLimit > 0 && chunk > definition.StackLimit {
chunk = definition.StackLimit
}
default:
return nil, errCurrentOverflowMailRowInvalid
}
if chunk <= 0 || chunk > math.MaxUint32 {
return nil, errCurrentOverflowMailRowInvalid
}
stack, buildErr := buildCurrentDungeonPickupStack(definition.SlotStart, definition, uint32(chunk))
if buildErr != nil {
return nil, buildErr
}
if stack.Extra == nil {
stack.Extra = make(map[string]string, 3)
}
stack.Extra["source"] = source
stack.Extra["last_grant_source"] = source
stack.Extra["overflow_mail"] = "true"
attachments = append(attachments, dnfrepo.MailAttachment{
ItemID: stack.ItemID,
Count: stack.Count,
Bind: stack.Bind,
ExpireAt: stack.ExpireAt,
RawEntry: stack.RawEntry,
Extra: stack.Extra,
})
remaining -= chunk
if len(attachments) > currentOverflowMailMaxRows {
return nil, errCurrentOverflowMailRowInvalid
}
}
return attachments, nil
}