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,88 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"pvfine/internal/pvf"
|
||||
)
|
||||
|
||||
func TestQuestTargetSearchScopesBeforePagination(t *testing.T) {
|
||||
for _, disk := range []bool{false, true} {
|
||||
t.Run(fmt.Sprintf("disk=%v", disk), func(t *testing.T) {
|
||||
c, _, _ := editFixture(t, editableShop)
|
||||
for _, kind := range []string{"dungeon", "monster", "npc"} {
|
||||
extension := map[string]string{"dungeon": "dgn", "monster": "mob", "npc": "npc"}[kind]
|
||||
listPath := kind + "/" + kind + ".lst"
|
||||
text := fmt.Sprintf("101 `sub/one.%s` 102 `sub/two.%s`", extension, extension)
|
||||
if i, ok := c.archive.Find(listPath); ok {
|
||||
if err := c.archive.SetText(i, text); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
} else if _, err := c.archive.AddFileText(listPath, text, pvf.TypeScript); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, entry := range []string{"one", "two", "unregistered"} {
|
||||
if _, err := c.archive.AddFileText(kind+"/sub/"+entry+"."+extension, "[name]\n`共同搜索名 "+entry+"`", pvf.TypeScript); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
if _, err := c.archive.AddFileText(kind+"other/false."+extension, "[name]\n`共同搜索名`", pvf.TypeScript); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
}
|
||||
if err := c.setArchive(c.archive); err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if disk {
|
||||
index, _, err := openSQLiteArchiveIndex(c.archive)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
c.mu.Lock()
|
||||
c.diskIndex = index
|
||||
c.installDiskArchiveIndexesLocked(c.archive)
|
||||
c.mu.Unlock()
|
||||
}
|
||||
c.startSearchIndex()
|
||||
waitForSearchIndex(t, c)
|
||||
service := NewArchiveService(c)
|
||||
for _, kind := range []string{"dungeon", "monster", "npc"} {
|
||||
for _, query := range []string{"共同搜索名", "10", "sub/", "*共同*"} {
|
||||
ids := map[string]bool{}
|
||||
cursor := 0
|
||||
for page := 0; page < 20; page++ {
|
||||
result, err := service.SearchQuestTargets(kind, query, cursor, 1)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, hit := range result.Hits {
|
||||
if hit.ID == "" || !strings.HasPrefix(hit.Path, kind+"/") || ids[hit.ID] {
|
||||
t.Fatalf("unexpected result kind=%s query=%s: %#v", kind, query, hit)
|
||||
}
|
||||
ids[hit.ID] = true
|
||||
}
|
||||
if result.NextCursor < 0 {
|
||||
break
|
||||
}
|
||||
if result.NextCursor <= cursor {
|
||||
t.Fatal("cursor did not advance")
|
||||
}
|
||||
cursor = result.NextCursor
|
||||
}
|
||||
if len(ids) != 2 || !ids["101"] || !ids["102"] {
|
||||
t.Fatalf("kind=%s query=%s IDs=%v", kind, query, ids)
|
||||
}
|
||||
}
|
||||
}
|
||||
if _, err := service.SearchQuestTargets("equipment", "共同搜索名", 0, 30); err == nil {
|
||||
t.Fatal("unsupported kind accepted")
|
||||
}
|
||||
empty, err := service.SearchQuestTargets("npc", "", 0, 30)
|
||||
if err != nil || len(empty.Hits) != 0 || empty.NextCursor != -1 {
|
||||
t.Fatalf("empty query=%#v, %v", empty, err)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user