服务端(Go): - GM 塞背包/带属性装备发放:在线角色推送 op14 增量物品行,背包实时刷新,无需回角色选择界面 - GM 改金币/改等级:去掉在线拒绝,落库后推送 op14 钱包/op37 等级状态,在线实时刷新 - 等级端点统一切换到新版 GMSetCharacterLevel(自带在线刷新) - 无限/锁死疲劳模式 + 燃烧疲劳:每房间消耗 2 点、打怪与通关经验双倍 - 燃烧疲劳开关时给所有在线角色推送系统提示(op12 mode 0) - 深渊史诗掉率:GM 全局倍率 + 城镇增益药剂窗口倍率,真实接入掉落结算 启动器(Python/JS): - 标题栏自绘、窗口 1204x717、禁止拖拽改大小、仅最小化/关闭 - GM 工具:疲劳与燃烧、深渊史诗掉率、拍卖行上架(单一定价对齐) - 拍卖行上架前端对齐服务端单一价格语义,修复 400 报错
91 lines
2.7 KiB
Go
91 lines
2.7 KiB
Go
package services
|
|
|
|
import (
|
|
annotationrules "pvfine/internal/annotations"
|
|
"pvfine/internal/buildmode"
|
|
)
|
|
|
|
type AnnotationReloadResult struct {
|
|
RuleCount int `json:"ruleCount"`
|
|
RelationCount int `json:"relationCount"`
|
|
}
|
|
|
|
type AnnotationService struct {
|
|
c *core
|
|
path string
|
|
initErr error
|
|
layered bool
|
|
}
|
|
|
|
func NewAnnotationService(c *core) *AnnotationService {
|
|
if c.ruleStore != nil {
|
|
return &AnnotationService{c: c, layered: true}
|
|
}
|
|
if path, ok := annotationrules.FindSourcePath(); buildmode.Development && ok {
|
|
return &AnnotationService{c: c, path: path}
|
|
}
|
|
path, err := annotationrules.RuntimePath()
|
|
if err != nil {
|
|
return &AnnotationService{c: c, initErr: err}
|
|
}
|
|
return &AnnotationService{c: c, path: path}
|
|
}
|
|
|
|
func newAnnotationService(c *core, path string) *AnnotationService {
|
|
return &AnnotationService{c: c, path: path}
|
|
}
|
|
|
|
// ReloadRules validates the on-disk rules before atomically replacing the
|
|
// active engine. Invalid files leave the current engine untouched.
|
|
func (s *AnnotationService) ReloadRules() (AnnotationReloadResult, error) {
|
|
if s.layered {
|
|
if err := NewRuleService(s.c).reload("annotations"); err != nil {
|
|
return AnnotationReloadResult{}, err
|
|
}
|
|
s.c.mu.RLock()
|
|
defer s.c.mu.RUnlock()
|
|
document := s.c.annotationEngine.Document()
|
|
return AnnotationReloadResult{RuleCount: len(document.Rules), RelationCount: len(document.Relations)}, nil
|
|
}
|
|
if s.initErr != nil {
|
|
return AnnotationReloadResult{}, s.initErr
|
|
}
|
|
engine, err := annotationrules.LoadFile(s.path)
|
|
if err != nil {
|
|
return AnnotationReloadResult{}, err
|
|
}
|
|
document := engine.Document()
|
|
|
|
s.c.mu.Lock()
|
|
oldSpecsFingerprint := searchIndexSpecFingerprint(s.c.searchableListSpecsLocked())
|
|
engine = engine.ForVersion(s.c.archive.ClientVersion())
|
|
s.c.annotationEngine = engine
|
|
s.c.annotationSnapshot = nil
|
|
s.c.annotationErr = nil
|
|
s.c.annotationRelations = make(map[string]map[string]*relationTarget)
|
|
s.c.editorAnnotation = editorAnnotationCache{}
|
|
archiveOpen := s.c.archive != nil
|
|
if archiveOpen {
|
|
s.c.pathAnnotations = buildPathAnnotations(engine, s.c.dirChildren)
|
|
}
|
|
newSpecsFingerprint := searchIndexSpecFingerprint(s.c.searchableListSpecsLocked())
|
|
if archiveOpen && oldSpecsFingerprint != newSpecsFingerprint {
|
|
s.c.markAdvancedSearchStaleLocked(s.c.archive)
|
|
}
|
|
if archiveOpen && oldSpecsFingerprint != newSpecsFingerprint && s.c.diskIndex != nil {
|
|
s.c.diskIndex.dirty = true
|
|
s.c.diskIndex.semanticEpoch++
|
|
}
|
|
s.c.mu.Unlock()
|
|
if archiveOpen && oldSpecsFingerprint != newSpecsFingerprint {
|
|
s.c.startSearchIndex()
|
|
}
|
|
|
|
result := AnnotationReloadResult{
|
|
RuleCount: len(document.Rules),
|
|
RelationCount: len(document.Relations),
|
|
}
|
|
emitEvent("annotations:reloaded", result)
|
|
return result, nil
|
|
}
|