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,80 @@
|
||||
package dnfbridge
|
||||
|
||||
import (
|
||||
dnfcreaturestate "longheng.io/server/internal/modules/dnf/creaturestate"
|
||||
)
|
||||
|
||||
// currentPetEggPVFType is the PVF `[equipment type]` shared by pets and their eggs.
|
||||
const currentPetEggPVFType = "[creature]"
|
||||
|
||||
// installPetEggProbeOnce hands the pet domain the runtime-PVF egg predicate.
|
||||
// It runs on the first aligned command the service routes, which covers every
|
||||
// path that reconciles the pet record (op19 moves, enchants) and the op18 item
|
||||
// delete. Until it runs, creaturestate keeps its pre-existing behaviour.
|
||||
func (s *Service) installPetEggProbeOnce() {
|
||||
if s == nil {
|
||||
return
|
||||
}
|
||||
s.petEggProbeOnce.Do(func() {
|
||||
dnfcreaturestate.SetPetEggProbe(func(itemID int64) bool {
|
||||
return s.currentIsPetEggItem(itemID)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
// currentIsPetEggItem proves that an item template is a pet EGG rather than a
|
||||
// hatched creature.
|
||||
//
|
||||
// The only authority is the runtime PVF: an egg carries an `[output index]`
|
||||
// section naming the creature it hatches into, a real pet does not. File names
|
||||
// are deliberately NOT used -- scanning the live Script.pvf, 359
|
||||
// `equipment/creature/*.equ` documents have `[output index]`, and many of them
|
||||
// are named `100980042.equ` / `15_petitsandman/63483.equ`, while 6 documents
|
||||
// named `egg_*.equ` have no output index at all.
|
||||
//
|
||||
// The catalog it reads is the same one every op19 command already warms, so this
|
||||
// adds no archive scan. Results are cached per template.
|
||||
func (s *Service) currentIsPetEggItem(itemID int64) bool {
|
||||
if s == nil || itemID <= 0 || itemID > int64(^uint32(0)) {
|
||||
return false
|
||||
}
|
||||
if cached, ok := s.petEggCache.Load(itemID); ok {
|
||||
value, _ := cached.(bool)
|
||||
return value
|
||||
}
|
||||
value := s.resolvePetEggItem(uint32(itemID))
|
||||
s.petEggCache.Store(itemID, value)
|
||||
return value
|
||||
}
|
||||
|
||||
func (s *Service) resolvePetEggItem(itemID uint32) bool {
|
||||
catalog, err := s.currentPVFItemCatalog()
|
||||
if err != nil || catalog == nil {
|
||||
return false
|
||||
}
|
||||
definition, err := catalog.ResolveItem(itemID)
|
||||
if err != nil || definition.Kind != dungeonDropItemEquipment {
|
||||
return false
|
||||
}
|
||||
doc, err := parseDungeonCardPVFDocument(catalog.source, definition.PVFPath)
|
||||
if err != nil || doc == nil {
|
||||
return false
|
||||
}
|
||||
equipmentType, ok := doc.Text("equipment type")
|
||||
if !ok {
|
||||
return false
|
||||
}
|
||||
// 直接比较归一化后的 PVF 类型:currentEquipmentPlacementRuleForPVFType 只覆盖
|
||||
// 可穿戴槽位的类型表,其中没有 `[creature]`,用它会把所有宠物/蛋都判成非蛋。
|
||||
if normalizeEquipmentPlacementPVFType(equipmentType) != currentPetEggPVFType {
|
||||
return false
|
||||
}
|
||||
// 正常宠物没有 [output index];少数技能宠物(例如
|
||||
// 迷你战争领主SSS型 - 技能 100330655)会用自身 item_id 作为 output index。
|
||||
// 自指 output 不是蛋,否则会被误判成蛋、跳过 serial 分配,宠物无法装备。
|
||||
outputItemID, hasOutput := doc.Int("output index")
|
||||
if !hasOutput {
|
||||
return false
|
||||
}
|
||||
return outputItemID != int64(itemID)
|
||||
}
|
||||
Reference in new issue
Block a user