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

52 lines
2.0 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package dnfbridge
import (
"context"
"time"
dnfcharstat "longheng.io/server/internal/modules/dnf/charstat"
dnfcollectbox "longheng.io/server/internal/modules/dnf/collectbox"
)
func (s *Service) currentCollectboxBonus(ctx context.Context, session *gameSession) (dnfcollectbox.Bonus, error) {
if s == nil || session == nil || session.selectedCharacterID == 0 {
return dnfcollectbox.Bonus{}, nil
}
catalog, err := s.currentCollectboxCatalog()
if err != nil {
return dnfcollectbox.Bonus{}, err
}
// 走 projectionRepositories(ctx) 而不是 repositoryGroup():前者会在一次扇出
// 内把同一个角色的仓储读只做一遍(projection_read_cache.go:176-186),后者
// 每次都是真读。本函数由 characterPVFStatsForUserInfo 调用,而后者在
// syncRuntimeRaidMateActorsAllAtSceneBoundary 的 M×(M−1) 双循环里**每个有序对
// 都会跑一遍** —— 实测一次边界 112 次属性重算,也就是 112 次未缓存的
// loadCollectboxState。ctx 上没有缓存时它退化成与 repositoryGroup() 完全一致,
// 所以这是一处纯读缓存,不改变任何字节与顺序。
repositories, ok := s.projectionRepositories(ctx)
if !ok {
return dnfcollectbox.Bonus{}, nil
}
state, err := loadCollectboxState(ctx, repositories, s.accountIDForSession(session), uint64(session.selectedCharacterID))
if err != nil {
return dnfcollectbox.Bonus{}, err
}
var result dnfcollectbox.Bonus
for _, index := range catalog.indexes {
definition, found := collectboxDefinition(catalog, index)
if found {
result.Add(dnfcollectbox.SnapshotBonus(definition, state, time.Now().UTC()))
}
}
return result, nil
}
func applyCurrentCollectboxBonus(stats dnfcharstat.Vector, bonus dnfcollectbox.Bonus) dnfcharstat.Vector {
stats.PhysicalAttack += bonus.PhysicalAttack
stats.PhysicalDefense += bonus.PhysicalDefense
stats.MagicalAttack += bonus.MagicalAttack
stats.MagicalDefense += bonus.MagicalDefense
stats.IndependentAttack += bonus.IndependentAttack
return stats
}