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

42 lines
2.0 KiB
Go

package dnfbridge
import (
"context"
"fmt"
dnfrepo "longheng.io/server/internal/modules/dnf/repository"
)
// grantCurrentWeddingMainProduct 是上游 grantCurrentCeraShopMainProduct 在工作区的等价物。
//
// 两份 fork 的发放入口签名不同,必须适配:
//
// - 上游:grantCurrentCeraShopProduct(inventory, definition, count)
// - 工作区:grantCurrentCeraShopProduct(inventory, definition, count, mainSlotCount)
//
// 工作区把 mainSlotCount 改成必填是有意为之(见 cera_shop_grant.go 的说明):
// 它决定 limitCurrentMainInventoryDefinitionSlots 是否被调用,从而决定新物品能不能
// 落进"未解锁"的背包扩展行。漏传的后果不是报错,而是物品静默落进客户端不渲染的
// 格子——玩家看起来就是奖励消失了。
//
// 所以这里必须把该角色已购买的背包扩展行数取出来一并透传,不能为了少改几行而
// 走 3 参数的旧语义。取不到时 currentInventoryPlacementMainSlotCount 返回 0
// (等价于默认 4 行),宁可对已扩展角色少放宽几行,也不让物品越界。
//
// 上游该函数不接受 context,婚礼侧的调用点之一(weddingGiftAllocator 返回的闭包)
// 也确实拿不到调用方的 ctx,所以这里沿用服务端写路径的固定超时,保持签名与上游
// 一致,把差异收敛在这一个文件里。
func (s *Service) grantCurrentWeddingMainProduct(
inventory *dnfrepo.InventoryRecord,
definition dungeonDropItemDefinition,
count uint32,
) ([]uint16, error) {
if definition.InventoryListType != dnfrepo.MainInventoryListType {
return nil, fmt.Errorf("%w: main-list grant received list %d", errCurrentCeraShopProductUnavailable, definition.InventoryListType)
}
ctx, cancel := context.WithTimeout(context.Background(), createWriteTimeout)
defer cancel()
mainSlotCount := s.currentInventoryPlacementMainSlotCount(ctx, inventory, "")
return grantCurrentCeraShopProduct(inventory, definition, count, mainSlotCount)
}