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,104 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"pvfine/internal/pvf"
|
||||
)
|
||||
|
||||
func TestArchiveTaskFollowUpDoesNotBlockClose(t *testing.T) {
|
||||
gate := newArchiveTaskGate()
|
||||
finish, ok := gate.tryBegin()
|
||||
if !ok {
|
||||
t.Fatal("open gate rejected follow-up")
|
||||
}
|
||||
waitFor := gate.beginClose()
|
||||
if len(waitFor) != 1 {
|
||||
t.Fatalf("close tracks %d tasks, want 1", len(waitFor))
|
||||
}
|
||||
if _, ok := gate.tryBegin(); ok {
|
||||
t.Fatal("closing gate accepted follow-up")
|
||||
}
|
||||
finish()
|
||||
<-waitFor[0]
|
||||
gate.endClose()
|
||||
finish, ok = gate.tryBegin()
|
||||
if !ok {
|
||||
t.Fatal("reopened gate rejected follow-up")
|
||||
}
|
||||
finish()
|
||||
}
|
||||
|
||||
func TestCloseArchiveWaitsForArchiveTasks(t *testing.T) {
|
||||
c := NewCore()
|
||||
a := pvf.New()
|
||||
a.AddFile("data.bin", make([]byte, 2<<20), pvf.TypeScript)
|
||||
|
||||
c.mu.Lock()
|
||||
c.archive = a
|
||||
c.mu.Unlock()
|
||||
|
||||
finishTask := c.archiveTasks.begin()
|
||||
taskStarted := make(chan struct{})
|
||||
releaseTask := make(chan struct{})
|
||||
go func() {
|
||||
close(taskStarted)
|
||||
<-releaseTask
|
||||
finishTask()
|
||||
}()
|
||||
<-taskStarted
|
||||
|
||||
closed := make(chan struct{})
|
||||
go func() {
|
||||
c.closeArchive()
|
||||
close(closed)
|
||||
}()
|
||||
|
||||
select {
|
||||
case <-closed:
|
||||
t.Fatal("closeArchive returned before the archive task exited")
|
||||
case <-time.After(50 * time.Millisecond):
|
||||
}
|
||||
|
||||
c.mu.RLock()
|
||||
archiveCleared := c.archive == nil
|
||||
c.mu.RUnlock()
|
||||
if !archiveCleared {
|
||||
t.Fatal("closeArchive did not clear the active archive")
|
||||
}
|
||||
|
||||
close(releaseTask)
|
||||
select {
|
||||
case <-closed:
|
||||
case <-time.After(5 * time.Second):
|
||||
t.Fatal("closeArchive did not finish after the archive task exited")
|
||||
}
|
||||
if got := a.FileCount(); got != 0 {
|
||||
t.Fatalf("released archive still has %d files", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestArchiveTaskGateWaitsDuringClose(t *testing.T) {
|
||||
gate := newArchiveTaskGate()
|
||||
gate.beginClose()
|
||||
started, finished := make(chan struct{}), make(chan struct{})
|
||||
go func() {
|
||||
close(started)
|
||||
finish := gate.begin()
|
||||
finish()
|
||||
close(finished)
|
||||
}()
|
||||
<-started
|
||||
select {
|
||||
case <-finished:
|
||||
t.Fatal("task started while gate was closing")
|
||||
case <-time.After(20 * time.Millisecond):
|
||||
}
|
||||
gate.endClose()
|
||||
select {
|
||||
case <-finished:
|
||||
case <-time.After(time.Second):
|
||||
t.Fatal("task did not resume after close")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user