Files
90CNServer/server/internal/modules/dnf/skill/companion_bridge.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

81 lines
2.8 KiB
Go

package skill
// 本文件是支援兵(companion)移植的桥接层。
//
// companion 模块从 Server-90 移植,引用 Skill.MaximumLevelForCharacterGrowth。
// 当前包的 MaximumLearnableLevel 会**同时**按角色等级收窄上限,而支援兵要的是
// 「只按成长类型算出的技能上限」——两者语义不同,不能互换,所以这个方法按
// Server-90 的原语义移植,只把它的两个内部辅助函数换成本包已有的等价写法。
//
// MaximumLevelForCharacterGrowth resolves the packed grow_type's branch and
// cumulative awakening stage. A positive awakening slot takes precedence;
// otherwise the branch table applies. Missing tables use [maximum level].
func (s Skill) MaximumLevelForCharacterGrowth(growType int) int {
first := growType & 0x0f
awakening := (growType >> 4) & 0x0f
maximum := s.MaximumLevel
hasDirectionTables := len(s.GrowTypeMaximumLevels) > 0 || len(s.SecondGrowTypeMaximumLevels) > 0
if !hasDirectionTables {
// Focused fixtures and older PVF rows may omit the maximum-level
// tables. Preserve their established fitness semantics until a table is
// present; a zero scalar means the old owner imposed no upper cap.
if !s.SupportsGrowType(first) {
return 0
}
if len(s.SecondGrowTypes) > 0 {
allowed := false
for _, minimumStage := range s.SecondGrowTypes {
if minimumStage >= 0 && awakening >= minimumStage {
allowed = true
break
}
}
if !allowed {
return 0
}
}
if maximum > 0 {
return maximum
}
return -1
}
// 当前 Skill 类型没有 Server-90 的那个 MaximumLevels 数组 —— 那一维在本树
// 由标量 MaximumLevel + GrowTypeMaximumLevels / SecondGrowTypeMaximumLevels
// 表达。所以这里跳过那一步覆盖,直接用标量作为基准。
directionMaximum := maximum
if awakening > 0 && len(s.SecondGrowTypeMaximumLevels) > 0 {
directionMaximum = companionIndexedMaximum(s.SecondGrowTypeMaximumLevels, first*2+awakening-1)
if directionMaximum > 0 {
return companionMinimumMaximum(maximum, directionMaximum)
}
}
if len(s.GrowTypeMaximumLevels) > 0 {
directionMaximum = companionIndexedMaximum(s.GrowTypeMaximumLevels, first)
}
return companionMinimumMaximum(maximum, directionMaximum)
}
// companionIndexedMaximum 按下标取值;越界返回 0(与 Server-90 的
// indexedMaximum 同义:0 表示"这张表没给这一档定上限")。
func companionIndexedMaximum(values []int, index int) int {
if index < 0 || index >= len(values) {
return 0
}
return values[index]
}
// companionMinimumMaximum 取两个上限里更严的那个,0 视为"无上限"。
// 与 Server-90 的 minimumMaximum 同义。
func companionMinimumMaximum(left, right int) int {
if left <= 0 {
return right
}
if right <= 0 {
return left
}
if left < right {
return left
}
return right
}