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,145 @@
|
||||
package dnfbridge
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
dnfhonor "longheng.io/server/internal/modules/dnf/honor"
|
||||
"longheng.io/server/internal/modules/dnf/progression"
|
||||
dnfrepo "longheng.io/server/internal/modules/dnf/repository"
|
||||
)
|
||||
|
||||
const (
|
||||
currentHonorExpertLevelStatKey = dnfhonor.ExpertLevelStatKey
|
||||
currentHonorExpertProgressExperienceStatKey = dnfhonor.ExpertProgressExperienceStatKey
|
||||
)
|
||||
|
||||
var errCurrentHonorExpertStateInvalid = errors.New("current HonorExpert persisted state is invalid")
|
||||
|
||||
// currentHonorExpertProgress returns the character-scoped state shared by the
|
||||
// current mode-1, actor-tail, and op37 readers. Missing legacy stats are the
|
||||
// valid level-zero challenger state.
|
||||
func currentHonorExpertProgress(character dnfrepo.CharacterRecord) (dnfhonor.ExpertProgress, error) {
|
||||
progress, err := dnfhonor.ExpertProgressFromStats(character.Stats)
|
||||
if err != nil {
|
||||
return dnfhonor.ExpertProgress{}, fmt.Errorf("%w: character=%s: %v", errCurrentHonorExpertStateInvalid, character.CharacterID, err)
|
||||
}
|
||||
return progress, nil
|
||||
}
|
||||
|
||||
func currentHonorExpertStats(progress dnfhonor.ExpertProgress) map[string]int64 {
|
||||
return map[string]int64{
|
||||
currentHonorExpertLevelStatKey: int64(progress.Level),
|
||||
currentHonorExpertProgressExperienceStatKey: int64(progress.CurrentLevelExperience),
|
||||
}
|
||||
}
|
||||
|
||||
// currentHonorExpertExperienceGain isolates only the part of a proven
|
||||
// character-EXP award earned after the DNF90 level cap. The entry threshold
|
||||
// comes from the runtime progression PVF, while the cap comes from the
|
||||
// current EXE/profile compatibility unit.
|
||||
//
|
||||
// 口径本身在 honor.PostCapExperienceShare,不再在这里重复实现:骁勇结晶与
|
||||
// 成长胶囊槽用的是同一个值,两条路算出不同结果就是 bug。
|
||||
func currentHonorExpertExperienceGain(
|
||||
tables *progression.Tables,
|
||||
previousLevel int,
|
||||
previousExperience uint32,
|
||||
gain uint32,
|
||||
) (uint32, error) {
|
||||
if previousLevel <= 0 || previousLevel > currentAdventureCharacterLevelCap {
|
||||
return 0, fmt.Errorf(
|
||||
"%w: level=%d cap=%d",
|
||||
errCurrentHonorExpertStateInvalid,
|
||||
previousLevel,
|
||||
currentAdventureCharacterLevelCap,
|
||||
)
|
||||
}
|
||||
if gain == 0 || previousLevel < currentAdventureCharacterLevelCap-1 {
|
||||
return 0, nil
|
||||
}
|
||||
if previousLevel >= currentAdventureCharacterLevelCap {
|
||||
return gain, nil
|
||||
}
|
||||
if tables == nil {
|
||||
return 0, errCurrentHonorExpertStateInvalid
|
||||
}
|
||||
share, err := dnfhonor.PostCapExperienceShare(
|
||||
tables,
|
||||
previousLevel,
|
||||
previousExperience,
|
||||
gain,
|
||||
currentAdventureCharacterLevelCap,
|
||||
)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return share, nil
|
||||
}
|
||||
|
||||
// currentCharacterExperienceBaseline returns the ordinary cumulative EXP
|
||||
// represented by the current actor. At level cap it cannot exceed the PVF
|
||||
// threshold that entered the cap.
|
||||
func currentCharacterExperienceBaseline(
|
||||
tables *progression.Tables,
|
||||
level int,
|
||||
persisted uint32,
|
||||
) (uint32, error) {
|
||||
if level < currentAdventureCharacterLevelCap {
|
||||
return persisted, nil
|
||||
}
|
||||
if level != currentAdventureCharacterLevelCap || tables == nil {
|
||||
return 0, errCurrentHonorExpertStateInvalid
|
||||
}
|
||||
entryExperience, err := tables.ThresholdToNext(currentAdventureCharacterLevelCap - 1)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
if persisted > entryExperience {
|
||||
return entryExperience, nil
|
||||
}
|
||||
return persisted, nil
|
||||
}
|
||||
|
||||
func currentCharacterExperienceAwardPresentation(
|
||||
tables *progression.Tables,
|
||||
level int,
|
||||
persisted uint32,
|
||||
gain uint32,
|
||||
) (uint32, error) {
|
||||
baseline, err := currentCharacterExperienceBaseline(tables, level, persisted)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
return saturatingCurrentDungeonUint32Add(baseline, gain), nil
|
||||
}
|
||||
|
||||
func planCurrentHonorExpertProgress(
|
||||
tables *dnfhonor.Tables,
|
||||
character dnfrepo.CharacterRecord,
|
||||
gain uint32,
|
||||
) (dnfhonor.ExpertProgress, error) {
|
||||
if tables == nil {
|
||||
return dnfhonor.ExpertProgress{}, errHonorTableUnavailable
|
||||
}
|
||||
current, err := currentHonorExpertProgress(character)
|
||||
if err != nil {
|
||||
return dnfhonor.ExpertProgress{}, err
|
||||
}
|
||||
return tables.AdvanceExpert(current, uint64(gain))
|
||||
}
|
||||
|
||||
// writeCurrentHonorExpertState writes the current EXE's shared
|
||||
// {u32 level, u64 current-level EXP} actor state. A corrupted persisted value
|
||||
// is not allowed to desynchronize packet readers, so it projects neutral until
|
||||
// the durable record can be repaired through an authoritative award.
|
||||
func writeCurrentHonorExpertState(writer *packetWriter, character dnfrepo.CharacterRecord) {
|
||||
progress, err := currentHonorExpertProgress(character)
|
||||
if err != nil {
|
||||
writer.writeUint32(0)
|
||||
writer.writeZero(8)
|
||||
return
|
||||
}
|
||||
writer.writeUint32(progress.Level)
|
||||
writer.writeUint64(progress.CurrentLevelExperience)
|
||||
}
|
||||
Reference in new issue
Block a user