From 5ef8ee8bc50b875f2f40f5c802a48b9d2556fc90 Mon Sep 17 00:00:00 2001 From: zhenhui <1276357500@qq.com> Date: Wed, 25 Mar 2026 13:42:46 +0800 Subject: [PATCH] =?UTF-8?q?[=E8=89=B2=E5=AD=90=E6=B8=B8=E6=88=8F]=E5=A5=96?= =?UTF-8?q?=E5=8A=B1=E9=85=8D=E7=BD=AE-=E6=96=B0=E5=A2=9E=E6=8C=89?= =?UTF-8?q?=E8=A7=84=E5=88=99=E8=87=AA=E5=8A=A8=E7=94=9F=E6=88=90=E5=A5=96?= =?UTF-8?q?=E5=8A=B1=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../scripts/generate-dice-reward-index.ts | 53 ++ .../locales/langs/en/dice/reward_config.json | 45 +- .../locales/langs/zh/dice/reward_config.json | 45 +- .../plugin/dice/reward_config/index/index.vue | 517 +++++++++++++++++- .../utils/generateIndexByRules.ts | 413 ++++++++++++++ 5 files changed, 1069 insertions(+), 4 deletions(-) create mode 100644 saiadmin-artd/scripts/generate-dice-reward-index.ts create mode 100644 saiadmin-artd/src/views/plugin/dice/reward_config/utils/generateIndexByRules.ts diff --git a/saiadmin-artd/scripts/generate-dice-reward-index.ts b/saiadmin-artd/scripts/generate-dice-reward-index.ts new file mode 100644 index 0000000..4072ea0 --- /dev/null +++ b/saiadmin-artd/scripts/generate-dice-reward-index.ts @@ -0,0 +1,53 @@ +/** + * 命令行:按「当前盘面 grid_number 排布」与 T1/T2/T4/T5 约束生成 DiceRewardConfig 表 JSON(不含保存)。 + * 用法:pnpm tsx scripts/generate-dice-reward-index.ts [t1Min] [t2Min] [t4Fixed] [t5Fixed] + * 默认:3 5 1 1(T4/T5 为顺、逆加权条数固定值) + * + * 生成逻辑见 src/views/plugin/dice/reward_config/utils/generateIndexByRules.ts + */ + +import { + buildRowsFromTiers, + computeBoardFrequencies, + DEFAULT_TIER_REAL_EV_STANDARDS, + generateTiers, + summarizeCounts +} from '../src/views/plugin/dice/reward_config/utils/generateIndexByRules' + +const grids = [ + 20, 27, 24, 10, 5, 15, 8, 22, 30, 23, 16, 12, 13, 7, 17, 9, 21, 26, 6, 29, 19, 11, 25, 14, 28, 18 +] + +const args = process.argv.slice(2).map((x) => parseInt(x, 10)) +const t1 = Number.isFinite(args[0]) ? args[0] : 3 +const t2 = Number.isFinite(args[1]) ? args[1] : 5 +const x4 = Number.isFinite(args[2]) ? args[2] : 1 +const x5 = Number.isFinite(args[3]) ? args[3] : 1 + +const constraints = { + t1MinCw: t1, + t2MinCw: t2, + t4FixedCw: x4, + t5FixedCw: x5, + t1MinCcw: t1, + t2MinCcw: t2, + t4FixedCcw: x4, + t5FixedCcw: x5 +} + +const gen = generateTiers({ grids, constraints }) +if (gen.ok === false) { + console.error(gen.message) + process.exit(1) +} + +const board = computeBoardFrequencies(grids) +if (board === null) { + console.error('computeBoardFrequencies failed') + process.exit(1) +} + +const rows = buildRowsFromTiers(grids, gen.tiers, DEFAULT_TIER_REAL_EV_STANDARDS) +const sc = summarizeCounts(board, gen.tiers) + +console.log(JSON.stringify({ weighted: { cw: sc.cw, ccw: sc.ccw }, rows }, null, 2)) diff --git a/saiadmin-artd/src/locales/langs/en/dice/reward_config.json b/saiadmin-artd/src/locales/langs/en/dice/reward_config.json index ff0a0d9..12acfad 100644 --- a/saiadmin-artd/src/locales/langs/en/dice/reward_config.json +++ b/saiadmin-artd/src/locales/langs/en/dice/reward_config.json @@ -50,7 +50,50 @@ "warnDupGrid": "Duplicate dice points in this table: {list}", "warnNoBigwinToSave": "No BIGWIN rows to save", "warnBigwinDupGrid": "Duplicate big-win points in this table: {list}", - "infoNoBigwin": "No BIGWIN rows. Set tier to BIGWIN in the Reward Index tab first." + "infoNoBigwin": "No BIGWIN rows. Set tier to BIGWIN in the Reward Index tab first.", + "btnRuleGenerate": "Generate by rules", + "ruleGenerateTitle": "Generate reward index by rules", + "ruleGenerateRules": "[Generation logic (same as Create Reward Reference)]\n• 26 cells ordered by id ascending are positions 0–25; each row’s grid_number is 5–30 and unique.\n• Roll D (5–30): start at the cell whose grid_number equals D (start_index); clockwise landing = (start position + D) mod 26; counter-clockwise = start − D (if negative, +26).\n• Each reference row’s “dice points” column is the roll D; tier / real_ev / display text come from the config at the landing id.\n\n[Leopard rolls]\nFor rolls 5, 10, 15, 20, 25, 30, clockwise and counter-clockwise landing tiers must NOT be T4 or T5 (avoid leopard roll + penalty / try again).\n\n[real_ev vs tier]\nreal < −100 → T4; −100 < real < 0 → T3; 0 < real < 100 → T2; 100 < real < 500 → T1; T5 “try again” real_ev=0. Set per-tier real_ev standards below; values are written into the config and can be edited later.\n\n[Inputs]\nT1/T2: minimum weighted counts. T4 and T5: fixed weighted counts — clockwise and counter-clockwise must each match the number you set (one value per tier, applied to both directions). real_ev standards: one value per tier. Generated T1–T4 use ui_text / ui_text_en = 100 + real_ev (same EN); T5 uses “try again” / “Once again”. Remarks still distinguish break-even vs small win where applicable.", + "ruleGenT1Row": "T1 (big prize)", + "ruleGenT2Row": "T2 (small win / break-even)", + "ruleGenT3RealEvOnly": "T3 (rake)", + "ruleGenT4Row": "T4 (penalty)", + "ruleGenT5Row": "T5 (try again)", + "ruleGenMinCount": "Min count", + "ruleGenFixedCount": "Fixed count (CW & CCW)", + "ruleGenRealEvStd": "real_ev standard", + "ruleGenRealEvEditHint": "After saving, you can still edit display text, EN, real_ev and remarks per row in the table above.", + "ruleGenInvalidT1RealEv": "T1 real_ev must satisfy 100 < value < 500", + "ruleGenInvalidT2RealEv": "T2 real_ev must satisfy 0 < value < 100", + "ruleGenInvalidT3RealEv": "T3 real_ev must satisfy -100 < value < 0", + "ruleGenInvalidT4RealEv": "T4 real_ev must satisfy value < -100", + "ruleGenInvalidT5RealEv": "T5 “try again” real_ev must be 0", + "ruleGenT1Min": "T1 min (CW & CCW)", + "ruleGenT2Min": "T2 min (CW & CCW)", + "ruleGenT4Max": "T4 fixed count (CW & CCW)", + "ruleGenT5Max": "T5 fixed count (CW & CCW)", + "ruleGenScopeHint": "T1/T2 are minimums; T4 and T5 are exact: clockwise and counter-clockwise weighted counts must each equal the fixed value.", + "ruleGenApply": "Generate and save", + "ruleGenNeedFullGrid": "Missing id 0–25 rows or incomplete grid_number; cannot generate", + "ruleGenFreqFail": "Cannot compute board frequencies; check grid_number", + "ruleGenUnknownId": "Unknown reward index id: {id}", + "ruleGenSuccess": "Generated and saved. Clockwise weighted: T1={cwT1} T2={cwT2} T4={cwT4} T5={cwT5}; counter-clockwise: T1={ccT1} T2={ccT2} T4={ccT4} T5={ccT5}", + "btnJsonImport": "JSON import", + "jsonImportTitle": "Reward index JSON import", + "jsonImportHint": "Current Reward Index rows (excluding BIGWIN) are filled below. Edit and submit; id must be 0–25, grid_number must be 5–30. Submit applies to the table and saves.", + "jsonImportParseFail": "Invalid JSON", + "jsonImportNotArray": "Root must be a JSON array", + "jsonImportItemInvalid": "Item {n} is not a valid object", + "jsonImportMissingField": "Item {n} is missing field: {field}", + "jsonImportIdRange": "id must be 0–25; item {n} has {v}", + "jsonImportGridRange": "grid_number must be 5–30; item {n} has {v}", + "jsonImportDupId": "Duplicate id in JSON: {list}", + "jsonImportDupGrid": "Duplicate grid_number in JSON: {list}", + "jsonImportFullIdSet": "For 26 rows, id must be exactly 0–25 once each", + "jsonImportFullGridSet": "For 26 rows, grid_number must be exactly 5–30 once each", + "jsonImportUnknownId": "Unknown id: {id} (export from the current list first)", + "jsonImportTierInvalid": "Invalid tier at item {n}", + "jsonImportEmpty": "Nothing to submit" }, "weightRatio": { "title": "T1–T5 Weight Ratio (Clockwise / Counter-clockwise)", diff --git a/saiadmin-artd/src/locales/langs/zh/dice/reward_config.json b/saiadmin-artd/src/locales/langs/zh/dice/reward_config.json index 6e16267..c65a1fe 100644 --- a/saiadmin-artd/src/locales/langs/zh/dice/reward_config.json +++ b/saiadmin-artd/src/locales/langs/zh/dice/reward_config.json @@ -50,7 +50,50 @@ "warnDupGrid": "色子点数在本表内不能重复,重复的点数为:{list}", "warnNoBigwinToSave": "暂无 BIGWIN 档位配置可保存", "warnBigwinDupGrid": "大奖权重本表内点数不能重复,重复的点数为:{list}", - "infoNoBigwin": "暂无 BIGWIN 档位配置,请先在「奖励索引」中设置 tier 为 BIGWIN" + "infoNoBigwin": "暂无 BIGWIN 档位配置,请先在「奖励索引」中设置 tier 为 BIGWIN", + "btnRuleGenerate": "按规则生成", + "ruleGenerateTitle": "按规则生成奖励索引", + "ruleGenerateRules": "【生成逻辑(与创建奖励对照一致)】\n• 盘面 26 格按 id 升序为位置 0~25;每条配置的 grid_number 为 5~30 且不重复。\n• 摇取点数 D(5~30):起点为「grid_number=D」所在格位的 id(即 start_index),顺时针落点位置 = (起点位置 + D) mod 26,逆时针落点 = 起点位置 − D(若小于 0 则 +26)。\n• 对照表每条记录的「色子点数」列为摇取点数 D;档位、真实结算、显示文案取自落点格位对应 id 的配置。\n\n【豹子摇取点数】\n摇取点数为 5、10、15、20、25、30 时,其顺/逆时针落点档位不能为 T4、T5(避免对照表上出现豹子点数 + 惩罚/再来一次)。\n\n【real_ev 与 tier】\nreal < −100 → T4;−100 < real < 0 → T3;0 < real < 100 → T2;100 < real < 500 → T1;T5「再来一次」real_ev=0。下方可为各档位填写统一的 real_ev 标准,生成时写入配置;细则可稍后在表格中再改。\n\n【本弹窗输入】\n条数:T1/T2「不少于」;T4、T5「固定」——顺时针与逆时针的加权条数(每条摇取结果计一次)须分别恰好等于所填数值;T4 与 T5 分开填写。\nreal_ev 标准:同档位各格使用同一数值。生成时 T1~T4 的 ui_text / ui_text_en 均为「100+真实结算」;T5 固定为「再来一次」/「Once again」。备注仍区分完美回本/小赚等。", + "ruleGenT1Row": "T1 大奖", + "ruleGenT2Row": "T2 小赚/回本", + "ruleGenT3RealEvOnly": "T3 抽水", + "ruleGenT4Row": "T4 惩罚", + "ruleGenT5Row": "T5 再来一次", + "ruleGenMinCount": "最少条数", + "ruleGenFixedCount": "固定条数(顺/逆)", + "ruleGenRealEvStd": "real_ev 标准", + "ruleGenRealEvEditHint": "生成并保存后,仍可在本页表格中逐条修改显示文案、英文、真实结算与备注。", + "ruleGenInvalidT1RealEv": "T1 的 real_ev 须满足:100 < 值 < 500", + "ruleGenInvalidT2RealEv": "T2 的 real_ev 须满足:0 < 值 < 100", + "ruleGenInvalidT3RealEv": "T3 的 real_ev 须满足:-100 < 值 < 0", + "ruleGenInvalidT4RealEv": "T4 的 real_ev 须满足:值 < -100", + "ruleGenInvalidT5RealEv": "T5「再来一次」的 real_ev 须为 0", + "ruleGenT1Min": "T1 最少条数(顺/逆)", + "ruleGenT2Min": "T2 最少条数(顺/逆)", + "ruleGenT4Max": "T4 固定条数(顺/逆)", + "ruleGenT5Max": "T5 固定条数(顺/逆)", + "ruleGenScopeHint": "T1/T2 为「不少于」;T4、T5 为「恰好」:顺时针与逆时针加权条数须分别等于所填固定值。", + "ruleGenApply": "生成并保存", + "ruleGenNeedFullGrid": "当前列表缺少 id 0~25 的奖励索引行或色子点数不完整,无法生成", + "ruleGenFreqFail": "无法计算盘面频率,请检查 grid_number", + "ruleGenUnknownId": "不存在奖励索引 id:{id}", + "ruleGenSuccess": "已按规则生成并保存。顺时针加权:T1={cwT1} T2={cwT2} T4={cwT4} T5={cwT5};逆时针加权:T1={ccT1} T2={ccT2} T4={ccT4} T5={ccT5}", + "btnJsonImport": "JSON 导入", + "jsonImportTitle": "奖励索引 JSON 导入", + "jsonImportHint": "当前「奖励索引」表数据(不含 BIGWIN)已填入下方,可编辑后提交;奖励索引 id 须为 0~25,色子点数 grid_number 须为 5~30。提交后将写入表格并保存。", + "jsonImportParseFail": "JSON 解析失败,请检查格式", + "jsonImportNotArray": "JSON 根节点必须为数组", + "jsonImportItemInvalid": "第 {n} 项不是有效对象", + "jsonImportMissingField": "第 {n} 项缺少字段:{field}", + "jsonImportIdRange": "奖励索引 id 须为 0~25,第 {n} 项为 {v}", + "jsonImportGridRange": "色子点数 grid_number 须为 5~30,第 {n} 项为 {v}", + "jsonImportDupId": "JSON 内奖励索引 id 重复:{list}", + "jsonImportDupGrid": "JSON 内色子点数重复:{list}", + "jsonImportFullIdSet": "共 26 条时,奖励索引 id 必须且仅能各出现一次(0~25)", + "jsonImportFullGridSet": "共 26 条时,色子点数必须且仅能各出现一次(5~30)", + "jsonImportUnknownId": "不存在奖励索引 id:{id}(请从当前列表导出后编辑)", + "jsonImportTierInvalid": "第 {n} 项所属档位 tier 无效", + "jsonImportEmpty": "没有可提交的条目" }, "weightRatio": { "title": "T1-T5 权重配比(顺时针/逆时针)", diff --git a/saiadmin-artd/src/views/plugin/dice/reward_config/index/index.vue b/saiadmin-artd/src/views/plugin/dice/reward_config/index/index.vue index 9ed06be..de82b4c 100644 --- a/saiadmin-artd/src/views/plugin/dice/reward_config/index/index.vue +++ b/saiadmin-artd/src/views/plugin/dice/reward_config/index/index.vue @@ -21,6 +21,16 @@
{{ $t('page.configPage.tipIndex') }}
+
+ + {{ $t('page.configPage.btnRuleGenerate') }} + +
+ + +
{{ $t('page.configPage.ruleGenerateRules') }}
+ + +
+
+ {{ $t('page.configPage.ruleGenMinCount') }} + +
+
+ {{ $t('page.configPage.ruleGenRealEvStd') }} + +
+
+
+ +
+
+ {{ $t('page.configPage.ruleGenMinCount') }} + +
+
+ {{ $t('page.configPage.ruleGenRealEvStd') }} + +
+
+
+ +
+
+ {{ $t('page.configPage.ruleGenRealEvStd') }} + +
+
+
+ +
+
+ {{ $t('page.configPage.ruleGenFixedCount') }} + +
+
+ {{ $t('page.configPage.ruleGenRealEvStd') }} + +
+
+
+ +
+
+ {{ $t('page.configPage.ruleGenFixedCount') }} + +
+
+ {{ $t('page.configPage.ruleGenRealEvStd') }} + +
+
+
+

{{ $t('page.configPage.ruleGenScopeHint') }}

+

{{ $t('page.configPage.ruleGenRealEvEditHint') }}

+
+ +