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

73 lines
2.5 KiB
Go

// 本文件负责修理费用的 86JP 领域公式(EquipmentRepairPriceProvider)。
// PVF 证据由 dnfbridge resolver 提供,这里只做确定性计算。
package equip
import (
"longheng.io/server/internal/modules/dnf/alignedcmd"
)
// repairAllEligibleTypes is the 86JP repair-all type filter: only these PVF
// [equipment type] categories are touched by a repair-all request; charms,
// avatars (except aurora), titles, pet gear and medals are skipped.
var repairAllEligibleTypes = map[string]bool{
"[weapon]": true,
"[coat]": true,
"[pants]": true,
"[hat]": true,
"[shoulder]": true,
"[waist]": true,
"[shoes]": true,
"[amulet]": true,
"[wrist]": true,
"[ring]": true,
"[support]": true,
"[aurora avatar]": true,
"[magic stone]": true,
}
// RepairAllEligible reports whether one PVF equipment type participates in a
// repair-all scan (86JP ItemMetadataResolver.IsRepairAllEligible).
func RepairAllEligible(equipmentType string) bool {
return repairAllEligibleTypes[equipmentType]
}
// CalcRepairCost mirrors 86JP EquipmentRepairPriceProvider.CalcRepairCost,
// including its C# evaluation order: the (repairPrice*(grade+5))/10 factor is
// computed with integer arithmetic before the float rate chain, and every
// rate multiply is float32 like the C# float math. The final cost truncates
// to int64. Zero lost durability, non-positive repair price or max durability
// yields zero cost.
func CalcRepairCost(evidence alignedcmd.RepairCostEvidence, currentDurability int64, upgradeLevel int, quickRepair bool) int64 {
if evidence.MaxDurability <= 0 || evidence.RepairPrice <= 0 || currentDurability >= evidence.MaxDurability || currentDurability < 0 {
return 0
}
lost := evidence.MaxDurability - currentDurability
scaledPrice := evidence.RepairPrice * (evidence.Grade + 5) / 10
base := float32(scaledPrice) * float32(evidence.RepairCostRate) / float32(evidence.MaxDurability) * float32(lost)
cost := base * float32(upgradeRepairRate(evidence.UpgradeRates, upgradeLevel))
if quickRepair {
cost *= float32(evidence.QuickRepairRate)
}
if cost <= 0 {
return 0
}
return int64(cost)
}
func upgradeRepairRate(rates []float64, upgradeLevel int) float32 {
if len(rates) == 0 {
return 1
}
if upgradeLevel < 0 {
upgradeLevel = 0
}
if upgradeLevel > len(rates)-1 {
upgradeLevel = len(rates) - 1
}
rate := rates[upgradeLevel]
if rate <= 0 {
return 1
}
return float32(rate)
}