From 30748536d02b94b12c134929d1c0f6b1019886ae Mon Sep 17 00:00:00 2001 From: panFD Date: Sat, 5 Sep 2026 12:55:35 +0800 Subject: [PATCH] =?UTF-8?q?refactor(hero-config):=20=E7=A7=BB=E9=99=A4?= =?UTF-8?q?=E6=97=A7=E7=9A=84=E6=9C=AC=E5=9C=B0=E5=AF=BC=E5=87=BAhexport.t?= =?UTF-8?q?s=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 删除了前后端中与本地导出hexport.ts相关的API、页面按钮和实现代码,不再支持生成本地hexport.ts配置文件。 --- assets/script/game/common/config/hexport.ts | 186 -------------------- put/server/index.js | 45 +---- put/web/src/App.vue | 17 -- put/web/src/api.js | 2 - 4 files changed, 1 insertion(+), 249 deletions(-) delete mode 100644 assets/script/game/common/config/hexport.ts diff --git a/assets/script/game/common/config/hexport.ts b/assets/script/game/common/config/hexport.ts deleted file mode 100644 index 3caf503c..00000000 --- a/assets/script/game/common/config/hexport.ts +++ /dev/null @@ -1,186 +0,0 @@ -/** - * 英雄配置导出文件 - 由英雄配置编辑器生成 - * 生成时间: 2026-09-03T07:48:48.642Z - * 使用方式: import { HexportHeroInfo } from "./hexport" 后合并进 HeroInfo - */ -import { v3 } from "cc" -import { FacSet } from "./GameSet" -import { TGroup } from "./SkillSet" -import { SkillLv, HType, HGrowType, HRole, HERO_ROLE_BASE, AtkSpeedSet, AtkSpeedLv, heroInfo } from "./heroSet" - -export const HexportHeroInfo: Record = { - // 5001 叠甲骑士 — CSV导入:自身护盾+全体护盾 - 5001: { - uuid: 5001, name: "叠甲骑士", path: "hk1", fac: FacSet.HERO, rarity: 1, lv: 1, type: HType.Melee, grow_type: HGrowType.Tank, role: HRole.Tank, hp: HERO_ROLE_BASE[HRole.Tank].hp + 20, ap: HERO_ROLE_BASE[HRole.Tank].ap, def: HERO_ROLE_BASE[HRole.Tank].def + 10, - skills: { - 6004: { uuid: 6004, lv: 1, cd: AtkSpeedSet[AtkSpeedLv.Slow].cd, ccd: 0, overrides: {"ap":100}, desc: "挥剑对{target}造成攻击力{ap}%伤害", - lv_entries: [ - { lv: 2, s_lv: SkillLv.Lv2, overrides: {"ap":120} }, - ], - }, - 6301: { uuid: 6301, name: "魔法盾", lv: 1, cd: 8, ccd: 0, overrides: {"ap":30,"summon_count":1}, desc: "{target}获得生命最大值{ap}%的护盾", - lv_entries: [ - { lv: 8, s_lv: SkillLv.Lv2, overrides: {"ap":60,"summon_count":1} }, - { lv: 16, s_lv: SkillLv.Lv3, overrides: {"ap":120,"summon_count":2} }, - ], - }, - }, - atked: { - 6301: [ - { lv: 4, s_lv: SkillLv.Lv1, name: "全体圣盾", t_num: 3, overrides: {"TGroup":null,"ap":10,"summon_count":1}, desc: "全队获得本英雄生命最大值{ap}%的护盾" }, - ], - }, - info: "", - }, - // 5002 易伤剑仙 — CSV导入:击退压场+易伤放大;复刻酒仙 - 5002: { - uuid: 5002, name: "易伤剑仙", path: "hk3", fac: FacSet.HERO, rarity: 1, lv: 1, type: HType.Melee, grow_type: HGrowType.Warrior, role: HRole.Warrior, hp: HERO_ROLE_BASE[HRole.Warrior].hp + 5, ap: HERO_ROLE_BASE[HRole.Warrior].ap + 20, def: HERO_ROLE_BASE[HRole.Warrior].def + 5, - skills: { - 6004: { uuid: 6004, lv: 1, cd: AtkSpeedSet[AtkSpeedLv.Slow].cd, ccd: 0, overrides: {"ap":100}, desc: "挥拳对{target}造成攻击力{ap}%伤害", - lv_entries: [ - { lv: 2, s_lv: SkillLv.Lv2, overrides: {"ap":120} }, - ], - }, - 6101: { uuid: 6101, name: "气斩", lv: 1, cd: 8, ccd: 0, overrides: {"ap":150,"timed_buff_id":7002,"summon_count":1}, desc: "斩出气刃,对{target}造成攻击力{ap}%伤害,并使目标易伤(受到伤害加深,持续{dur}秒)", - lv_entries: [ - { lv: 8, s_lv: SkillLv.Lv2, overrides: {"buff_value":20,"summon_count":1} }, - { lv: 16, s_lv: SkillLv.Lv3, overrides: {"ap":180,"bck":60,"buff_value":40,"summon_count":2}, desc: "斩出气刃,对{target}造成攻击力{ap}%伤害,击退{bck},并使目标易伤(持续{dur}秒)" }, - ], - }, - }, - atking: { - 6004: [ - { lv: 4, s_lv: SkillLv.Lv1, name: "奋力一击", t_num: 3, overrides: {"ap":300}, desc: "每三次攻击后立即打击{target},造成攻击力{ap}%伤害" }, - ], - }, - info: "", - }, - // 5003 眩晕暴击哥 — CSV导入:高爆发+击晕收割;复刻齐天大圣 - 5003: { - uuid: 5003, name: "眩晕暴击哥", path: "hk5", fac: FacSet.HERO, rarity: 1, lv: 1, type: HType.Melee, grow_type: HGrowType.Warrior, role: HRole.Warrior, hp: HERO_ROLE_BASE[HRole.Warrior].hp + 5, ap: HERO_ROLE_BASE[HRole.Warrior].ap + 20, def: HERO_ROLE_BASE[HRole.Warrior].def + 5, - skills: { - 6004: { uuid: 6004, lv: 1, cd: AtkSpeedSet[AtkSpeedLv.Slow].cd, ccd: 0, overrides: {"ap":100}, desc: "挥斧对{target}造成攻击力{ap}%伤害", - lv_entries: [ - { lv: 2, s_lv: SkillLv.Lv2, overrides: {"stun":10}, desc: "挥斧对{target}造成攻击力{ap}%伤害,{stun}%概率击晕" }, - ], - }, - 6104: { uuid: 6104, name: "开山斧", lv: 1, cd: 8, ccd: 0, overrides: {"ap":300,"stun":100,"summon_count":1}, desc: "劈出开山斧,对{target}造成攻击力{ap}%伤害,必定击晕", - lv_entries: [ - { lv: 8, s_lv: SkillLv.Lv2, overrides: {"ap":450,"stun":100,"summon_count":1} }, - { lv: 16, s_lv: SkillLv.Lv3, overrides: {"ap":450,"stun":100,"summon_count":2} }, - ], - }, - }, - field: [ - { lv: 4, uuids: [{ uuid: 7005, value: 0.25, name: "大圣神威" }] }, - ], - info: "", - }, - // 5004 刀刀暴击 — CSV导入:暴击/暴伤双光环乘区;复刻剑圣 - 5004: { - uuid: 5004, name: "刀刀暴击", path: "hc1", fac: FacSet.HERO, rarity: 1, lv: 1, type: HType.Mid, grow_type: HGrowType.Assassin, role: HRole.Assassin, hp: HERO_ROLE_BASE[HRole.Assassin].hp, ap: HERO_ROLE_BASE[HRole.Assassin].ap + 30, def: HERO_ROLE_BASE[HRole.Assassin].def, - skills: { - 6002: { uuid: 6002, lv: 1, cd: AtkSpeedSet[AtkSpeedLv.Fast].cd, ccd: 0, overrides: {"ap":100}, desc: "挥刀对{target}造成攻击力{ap}%伤害", - lv_entries: [ - { lv: 2, s_lv: SkillLv.Lv2, overrides: {"crt":10}, desc: "挥刀对{target}造成攻击力{ap}%伤害,{crt}%概率暴击" }, - ], - }, - 6100: { uuid: 6100, name: "光闪", lv: 1, cd: 8, ccd: 0, overrides: {"ap":150,"summon_count":1}, desc: "斩出光闪,对{target}造成攻击力{ap}%伤害", - lv_entries: [ - { lv: 8, s_lv: SkillLv.Lv2, overrides: {"ap":250,"summon_count":1} }, - { lv: 16, s_lv: SkillLv.Lv3, overrides: {"ap":350,"summon_count":2} }, - ], - }, - }, - field: [ - { lv: 4, uuids: [{ uuid: 7004, value: 0.12, name: "剑刃风暴" }, { uuid: 7005, value: 0.2, name: "斩魂利刃" }] }, - ], - info: "", - }, - // 5005 出血贼 — CSV导入:入场先手+受击格挡;复刻剑豪 - 5005: { - uuid: 5005, name: "出血贼", path: "hc2", fac: FacSet.HERO, rarity: 1, lv: 1, type: HType.Mid, grow_type: HGrowType.Assassin, role: HRole.Assassin, hp: HERO_ROLE_BASE[HRole.Assassin].hp, ap: HERO_ROLE_BASE[HRole.Assassin].ap + 30, def: HERO_ROLE_BASE[HRole.Assassin].def, - skills: { - 6002: { uuid: 6002, lv: 1, cd: AtkSpeedSet[AtkSpeedLv.Fast].cd, ccd: 0, overrides: {"ap":100}, desc: "挥刀对{target}造成攻击力{ap}%伤害", - lv_entries: [ - { lv: 2, s_lv: SkillLv.Lv2, overrides: {"timed_buff_id":7007,"buff_value":30,"buff_chance":30}, desc: "挥刀对{target}造成攻击力{ap}%伤害,{buff_chance}%概率使目标出血(每0.5秒受到{buff_value}点伤害,持续{dur}秒)" }, - ], - }, - 6103: { uuid: 6103, name: "闪电斩", lv: 1, cd: 8, ccd: 0, overrides: {"ap":150,"summon_count":1}, desc: "召唤落雷斩击{target},造成攻击力{ap}%伤害", - lv_entries: [ - { lv: 8, s_lv: SkillLv.Lv2, overrides: {"ap":250,"timed_buff_id":7007,"summon_count":1}, desc: "召唤落雷斩击{target},造成攻击力{ap}%伤害,并使目标出血(每0.5秒受到{buff_value}点伤害,持续{dur}秒)" }, - { lv: 16, s_lv: SkillLv.Lv3, overrides: {"ap":350,"para":50,"timed_buff_id":7007,"buff_value":60,"summon_count":2}, desc: "召唤落雷斩击{target},造成攻击力{ap}%伤害,{para}%概率麻痹,并使目标出血(每0.5秒受到{buff_value}点伤害,持续{dur}秒)" }, - ], - }, - }, - field: [ - { lv: 4, uuids: [{ uuid: 7018, value: 1, name: "连击光环" }] }, - ], - info: "", - }, - // 5006 冻箭哥 — CSV导入:多重单体箭,带冰冻 - 5006: { - uuid: 5006, name: "冻箭哥", path: "ha1", fac: FacSet.HERO, rarity: 1, lv: 1, type: HType.Long, grow_type: HGrowType.Archer, role: HRole.Archer, hp: HERO_ROLE_BASE[HRole.Archer].hp, ap: HERO_ROLE_BASE[HRole.Archer].ap + 30, def: HERO_ROLE_BASE[HRole.Archer].def, - skills: { - 6006: { uuid: 6006, lv: 1, cd: AtkSpeedSet[AtkSpeedLv.Normal].cd, ccd: 0, overrides: {"ap":100}, desc: "射出箭矢,对{target}造成攻击力{ap}%伤害", - lv_entries: [ - { lv: 2, s_lv: SkillLv.Lv2, overrides: {"bck":10}, desc: "射出箭矢,对{target}造成攻击力{ap}%伤害,击退{bck}" }, - ], - }, - 6150: { uuid: 6150, name: "万箭齐发·冰", lv: 1, cd: 8, ccd: 0, overrides: {"ap":150,"frz":30,"summon_count":1}, desc: "万箭齐发,对{target}造成攻击力{ap}%伤害,{frz}%概率冰冻", - lv_entries: [ - { lv: 8, s_lv: SkillLv.Lv2, overrides: {"ap":200,"frz":50,"summon_count":1} }, - { lv: 16, s_lv: SkillLv.Lv3, overrides: {"ap":250,"frz":70,"summon_count":2} }, - ], - }, - }, - field: [ - { lv: 4, uuids: [{ uuid: 7006, value: 0.15 }] }, - ], - info: "", - }, - // 5007 击退火女 — CSV导入:群体击退/麻痹压场;复刻深渊女王 - 5007: { - uuid: 5007, name: "击退火女", path: "hm1", fac: FacSet.HERO, rarity: 1, lv: 1, type: HType.Long, grow_type: HGrowType.Mage, role: HRole.Mage, hp: HERO_ROLE_BASE[HRole.Mage].hp - 5, ap: HERO_ROLE_BASE[HRole.Mage].ap + 10, def: HERO_ROLE_BASE[HRole.Mage].def, - skills: { - 6010: { uuid: 6010, lv: 1, cd: AtkSpeedSet[AtkSpeedLv.Slow].cd, ccd: 0, overrides: {"ap":100,"bck":30}, desc: "掷出紫魔球,对{target}造成攻击力{ap}%伤害,击退{bck}", - lv_entries: [ - { lv: 2, s_lv: SkillLv.Lv2, overrides: {"bck":40} }, - ], - }, - 6200: { uuid: 6200, name: "火焰喷射", lv: 1, cd: 8, ccd: 0, overrides: {"ap":250,"bck":100,"summon_count":1}, desc: "喷出烈焰风暴,对{target}造成攻击力{ap}%伤害,击退{bck}", - lv_entries: [ - { lv: 8, s_lv: SkillLv.Lv2, overrides: {"ap":350,"bck":100,"summon_count":1} }, - { lv: 16, s_lv: SkillLv.Lv3, overrides: {"ap":450,"bck":100,"summon_count":2} }, - ], - }, - }, - field: [ - { lv: 4, uuids: [{ uuid: 7002, value: 0.15, name: "深渊威压" }] }, - ], - info: "", - }, - // 5008 团疗奶爸 — CSV导入:全体治疗续航+自身护盾 - 5008: { - uuid: 5008, name: "团疗奶爸", path: "hh1", fac: FacSet.HERO, rarity: 1, lv: 1, type: HType.Long, grow_type: HGrowType.Support, role: HRole.Support, hp: HERO_ROLE_BASE[HRole.Support].hp + 10, ap: HERO_ROLE_BASE[HRole.Support].ap + 20, def: HERO_ROLE_BASE[HRole.Support].def, - skills: { - 6011: { uuid: 6011, lv: 1, cd: AtkSpeedSet[AtkSpeedLv.Normal].cd, ccd: 0, overrides: {"ap":100}, desc: "挥杖对{target}造成攻击力{ap}%伤害", - lv_entries: [ - { lv: 2, s_lv: SkillLv.Lv2, overrides: {"bck":10}, desc: "挥杖对{target}造成攻击力{ap}%伤害,击退{bck}" }, - ], - }, - 6302: { uuid: 6302, name: "治疗", lv: 1, cd: 8, ccd: 0, overrides: {"ap":300,"summon_count":1}, desc: "为{target}回复攻击力{ap}%生命", - lv_entries: [ - { lv: 8, s_lv: SkillLv.Lv2, overrides: {"ap":400,"summon_count":1} }, - { lv: 16, s_lv: SkillLv.Lv3, overrides: {"ap":450,"summon_count":2} }, - ], - }, - }, - atking: { - 6301: [ - { lv: 4, s_lv: SkillLv.Lv1, name: "圣愈之盾", t_num: 3, overrides: {"ap":30,"summon_count":1}, desc: "{target}获得生命最大值{ap}%的护盾" }, - ], - }, - info: "", - }, -} diff --git a/put/server/index.js b/put/server/index.js index 2f9100d4..a8cde023 100644 --- a/put/server/index.js +++ b/put/server/index.js @@ -8,7 +8,6 @@ import url from 'node:url' const __dirname = path.dirname(url.fileURLToPath(import.meta.url)) const PROJECT_ROOT = path.resolve(__dirname, '..', '..') const CONFIG_DIR = path.join(PROJECT_ROOT, 'assets/script/game/common/config') -const EXPORT_PATH = path.join(CONFIG_DIR, 'hexport.ts') const HEROSET_PATH = path.join(CONFIG_DIR, 'heroSet.ts') const CSV_PATH = path.join(CONFIG_DIR, '英雄设计表.csv') // heroSet.ts 中英雄条目区域标记(怪物配置在 end 标记之后,不受替换影响) @@ -114,28 +113,7 @@ function serializeOverrides(o) { return s } -/** 生成 hexport.ts 内容 */ -function renderHeroTs(heroes) { - const nl = '\n' - let out = '' - out += `/**${nl}` - out += ` * 英雄配置导出文件 - 由英雄配置编辑器生成${nl}` - out += ` * 生成时间: ${new Date().toISOString()}${nl}` - out += ` * 使用方式: import { HexportHeroInfo } from "./hexport" 后合并进 HeroInfo${nl}` - out += ` */${nl}` - out += `import { v3 } from "cc"${nl}` - out += `import { FacSet } from "./GameSet"${nl}` - out += `import { TGroup, BuffTarget } from "./SkillSet"${nl}` - out += `import { SkillLv, HType, HGrowType, HRole, HERO_ROLE_BASE, AtkSpeedSet, AtkSpeedLv, heroInfo } from "./heroSet"${nl}` - out += nl - out += `export const HexportHeroInfo: Record = {${nl}` - for (const h of heroes) { - out += renderSingleHero(h) - } - out += `}${nl}` - return out -} - +/** 生成英雄 TS 条目(供 /api/apply 使用) */ function renderSingleHero(h) { const lines = [] const indent = ' ' @@ -235,26 +213,6 @@ function renderSingleHero(h) { return lines.join('\n') + '\n' } -app.post('/api/export', (req, res) => { - try { - const heroes = req.body?.heroes - if (!Array.isArray(heroes) || !heroes.length) { - return res.status(400).json({ error: 'heroes 不能为空' }) - } - const content = renderHeroTs(heroes) - fs.writeFileSync(EXPORT_PATH, content, 'utf8') - res.json({ ok: true, path: EXPORT_PATH, bytes: Buffer.byteLength(content) }) - } catch (e) { - res.status(500).json({ error: String(e?.message || e) }) - } -}) - -app.get('/api/export', (_req, res) => { - if (!fs.existsSync(EXPORT_PATH)) return res.status(404).json({ error: '尚未生成' }) - res.setHeader('Content-Type', 'text/plain; charset=utf-8') - res.send(fs.readFileSync(EXPORT_PATH, 'utf8')) -}) - /** * 直接写回 heroSet.ts:用编辑器数据替换英雄条目区域(HEROES_BEGIN/END 标记之间), * 怪物条目与区域外的其它配置保持不变。 @@ -427,5 +385,4 @@ app.post('/api/apply', (req, res) => { const PORT = 3001 app.listen(PORT, () => { console.log(`[hero-config-tool] server listening http://localhost:${PORT}`) - console.log(`[hero-config-tool] export path: ${EXPORT_PATH}`) }) diff --git a/put/web/src/App.vue b/put/web/src/App.vue index 4c616ae7..9850a371 100644 --- a/put/web/src/App.vue +++ b/put/web/src/App.vue @@ -5,7 +5,6 @@
刷新配置数据 保存到服务器 - 导出 hexport.ts 写入 heroSet.ts 导出英雄设计表.csv
@@ -375,22 +374,6 @@ async function doSave() { } } -async function doExport() { - try { - await ElMessageBox.confirm( - `将写入 ${heroes.value.length} 个英雄到 assets/script/game/common/config/hexport.ts`, - '导出确认', - { confirmButtonText: '写入', cancelButtonText: '取消', type: 'warning' } - ) - } catch { return } - try { - const r = await api.exportHeroes(heroes.value) - ElMessage.success(`已写入 ${r.bytes} 字节 → ${r.path}`) - } catch (e) { - ElMessage.error('导出失败: ' + (e?.response?.data?.error || e.message)) - } -} - async function doApply() { try { await ElMessageBox.confirm( diff --git a/put/web/src/api.js b/put/web/src/api.js index 1633ba72..27dd2423 100644 --- a/put/web/src/api.js +++ b/put/web/src/api.js @@ -5,8 +5,6 @@ export const api = { refresh: () => axios.post('/api/refresh').then((r) => r.data), fetchHeroes: () => axios.get('/api/heroes').then((r) => r.data), saveHeroes: (heroes) => axios.post('/api/heroes', { heroes }).then((r) => r.data), - exportHeroes: (heroes) => axios.post('/api/export', { heroes }).then((r) => r.data), applyHeroes: (heroes) => axios.post('/api/apply', { heroes }).then((r) => r.data), exportCsv: (heroes) => axios.post('/api/export-csv', { heroes }).then((r) => r.data), - fetchExport: () => axios.get('/api/export', { responseType: 'text' }).then((r) => r.data), }