服务端(Go): - GM 塞背包/带属性装备发放:在线角色推送 op14 增量物品行,背包实时刷新,无需回角色选择界面 - GM 改金币/改等级:去掉在线拒绝,落库后推送 op14 钱包/op37 等级状态,在线实时刷新 - 等级端点统一切换到新版 GMSetCharacterLevel(自带在线刷新) - 无限/锁死疲劳模式 + 燃烧疲劳:每房间消耗 2 点、打怪与通关经验双倍 - 燃烧疲劳开关时给所有在线角色推送系统提示(op12 mode 0) - 深渊史诗掉率:GM 全局倍率 + 城镇增益药剂窗口倍率,真实接入掉落结算 启动器(Python/JS): - 标题栏自绘、窗口 1204x717、禁止拖拽改大小、仅最小化/关闭 - GM 工具:疲劳与燃烧、深渊史诗掉率、拍卖行上架(单一定价对齐) - 拍卖行上架前端对齐服务端单一价格语义,修复 400 报错
48 lines
2.1 KiB
TypeScript
48 lines
2.1 KiB
TypeScript
import { expect, test } from "vitest";
|
|
import { EditorState } from "@codemirror/state";
|
|
import { ensureSyntaxTree } from "@codemirror/language";
|
|
import { highlightTree, tags, tagHighlighter } from "@lezer/highlight";
|
|
import { archiveEditorLanguage } from "../src/luaLanguage";
|
|
import { squirrelLanguage } from "../src/squirrelLanguage";
|
|
|
|
test("归档中的 nut 后缀启用 Squirrel,兼容大小写并保留其他语言识别", () => {
|
|
expect(archiveEditorLanguage("scripts/example.nut")).toBe("squirrel");
|
|
expect(archiveEditorLanguage("scripts/example.NUT")).toBe("squirrel");
|
|
expect(archiveEditorLanguage("scripts/example.nut.bak")).toBe("pvf");
|
|
expect(archiveEditorLanguage("scripts/example.lua")).toBe("lua");
|
|
expect(archiveEditorLanguage("equipment/example.equ")).toBe("pvf");
|
|
});
|
|
|
|
test("Squirrel 高亮识别特有关键字、数字、转义字符串和跨行注释", () => {
|
|
const doc = [
|
|
"local count = 42;",
|
|
'local text = "hello\\\"world";',
|
|
"// single line comment",
|
|
"/* block",
|
|
"comment */",
|
|
"foreach (item in items) { yield clone item; }",
|
|
"return null;",
|
|
].join("\n");
|
|
const state = EditorState.create({ doc, extensions: squirrelLanguage.extension });
|
|
const tree = ensureSyntaxTree(state, doc.length, 1000);
|
|
expect(tree).not.toBeNull();
|
|
const highlighted: Record<string, string[]> = {};
|
|
highlightTree(tree!, tagHighlighter([
|
|
{ tag: tags.keyword, class: "keyword" },
|
|
{ tag: tags.number, class: "number" },
|
|
{ tag: tags.string, class: "string" },
|
|
{ tag: tags.comment, class: "comment" },
|
|
{ tag: tags.atom, class: "atom" },
|
|
]), (from, to, style) => {
|
|
(highlighted[style] ??= []).push(doc.slice(from, to));
|
|
});
|
|
expect(highlighted.keyword).toEqual(expect.arrayContaining([
|
|
"local", "foreach", "in", "yield", "clone", "return",
|
|
]));
|
|
expect(highlighted.number).toEqual(["42"]);
|
|
expect(highlighted.string).toContain('"hello\\\"world"');
|
|
expect(highlighted.comment).toContain("// single line comment");
|
|
expect(highlighted.comment?.join("\n")).toContain("/* block\ncomment */");
|
|
expect(highlighted.atom).toContain("null");
|
|
});
|