服务端(Go): - GM 塞背包/带属性装备发放:在线角色推送 op14 增量物品行,背包实时刷新,无需回角色选择界面 - GM 改金币/改等级:去掉在线拒绝,落库后推送 op14 钱包/op37 等级状态,在线实时刷新 - 等级端点统一切换到新版 GMSetCharacterLevel(自带在线刷新) - 无限/锁死疲劳模式 + 燃烧疲劳:每房间消耗 2 点、打怪与通关经验双倍 - 燃烧疲劳开关时给所有在线角色推送系统提示(op12 mode 0) - 深渊史诗掉率:GM 全局倍率 + 城镇增益药剂窗口倍率,真实接入掉落结算 启动器(Python/JS): - 标题栏自绘、窗口 1204x717、禁止拖拽改大小、仅最小化/关闭 - GM 工具:疲劳与燃烧、深渊史诗掉率、拍卖行上架(单一定价对齐) - 拍卖行上架前端对齐服务端单一价格语义,修复 400 报错
89 lines
3.4 KiB
Go
89 lines
3.4 KiB
Go
package dnfbridge
|
|
|
|
import (
|
|
"fmt"
|
|
"math"
|
|
)
|
|
|
|
// expandCurrentDeterministicNestedCeraPackages follows historical
|
|
// [cera package] rewards which are themselves only transport wrappers. These
|
|
// wrappers are normally expanded by Cera-shop checkout and are not usable
|
|
// inventory boxes. Expanding their deterministic fixed/singleton contents at
|
|
// the owning package boundary prevents a player from receiving an inert inner
|
|
// box. Random boosters, booster selections, [usable cera package] items,
|
|
// packages with alternative selections, and packages containing avatars stay
|
|
// as terminal inventory items so their own current-EXE UI/protocol remains the
|
|
// authority.
|
|
func expandCurrentDeterministicNestedCeraPackages(
|
|
catalog *pvfDungeonDropCatalog,
|
|
rewards []currentCeraPackageReward,
|
|
) ([]currentCeraPackageReward, error) {
|
|
if catalog == nil || catalog.source == nil {
|
|
return nil, errCurrentCeraPackagePVFInvalid
|
|
}
|
|
result := make([]currentCeraPackageReward, 0, len(rewards))
|
|
var total uint64
|
|
var walk func(currentCeraPackageReward, int, map[uint32]struct{}) error
|
|
walk = func(reward currentCeraPackageReward, depth int, path map[uint32]struct{}) error {
|
|
if reward.Definition.ItemID == 0 || reward.Count == 0 {
|
|
return errCurrentCeraPackagePVFInvalid
|
|
}
|
|
definition, recognized, err := resolveCurrentCeraPackageDefinitionForSource(catalog, reward.Definition)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
deterministic := recognized && definition.StackableType == "[cera package]" && len(definition.AvatarItemIDs) == 0
|
|
if deterministic {
|
|
for _, group := range definition.SelectionGroups {
|
|
if len(group) != 1 {
|
|
deterministic = false
|
|
break
|
|
}
|
|
}
|
|
}
|
|
if !deterministic {
|
|
if len(result) >= currentCeraPackageMaxRewardRows {
|
|
return fmt.Errorf("%w: expanded reward rows exceed %d", errCurrentCeraPackagePVFInvalid, currentCeraPackageMaxRewardRows)
|
|
}
|
|
total += uint64(reward.Count)
|
|
if total > currentCeraPackageMaxRewardAmount {
|
|
return fmt.Errorf("%w: expanded reward total=%d", errCurrentCeraPackagePVFInvalid, total)
|
|
}
|
|
result = append(result, reward)
|
|
return nil
|
|
}
|
|
if depth >= currentCeraPackageGraphMaxDepth {
|
|
return fmt.Errorf("%w: nested package depth exceeds %d at item=%d", errCurrentCeraPackagePVFInvalid, currentCeraPackageGraphMaxDepth, reward.Definition.ItemID)
|
|
}
|
|
if _, cycle := path[reward.Definition.ItemID]; cycle {
|
|
return fmt.Errorf("%w: nested package cycle at item=%d", errCurrentCeraPackagePVFInvalid, reward.Definition.ItemID)
|
|
}
|
|
nextPath := make(map[uint32]struct{}, len(path)+1)
|
|
for itemID := range path {
|
|
nextPath[itemID] = struct{}{}
|
|
}
|
|
nextPath[reward.Definition.ItemID] = struct{}{}
|
|
children := append([]currentCeraPackageReward(nil), definition.Rewards...)
|
|
for _, group := range definition.SelectionGroups {
|
|
children = append(children, group[0])
|
|
}
|
|
for _, child := range children {
|
|
count := uint64(reward.Count) * uint64(child.Count)
|
|
if count == 0 || count > math.MaxUint32 || count > currentCeraPackageMaxRewardAmount {
|
|
return fmt.Errorf("%w: nested package item=%d reward=%d count=%d", errCurrentCeraPackagePVFInvalid, reward.Definition.ItemID, child.Definition.ItemID, count)
|
|
}
|
|
child.Count = uint32(count)
|
|
if err := walk(child, depth+1, nextPath); err != nil {
|
|
return err
|
|
}
|
|
}
|
|
return nil
|
|
}
|
|
for _, reward := range rewards {
|
|
if err := walk(reward, 0, nil); err != nil {
|
|
return nil, err
|
|
}
|
|
}
|
|
return result, nil
|
|
}
|