1.将创建奖励对照表的10,15,20,25的默认权重设置为10

This commit is contained in:
2026-06-05 13:44:14 +08:00
parent 5e54859a30
commit b20a1d276f
3 changed files with 33 additions and 10 deletions

View File

@@ -52,7 +52,7 @@
"createRefPreviewClockwise": "Clockwise",
"createRefPreviewCounterclockwise": "Counter-clockwise",
"createRefPreviewTipUnchanged": "Dice points mapping is unchanged: weights in the preview are reused from current dice_reward; importing will not override existing weights.",
"createRefPreviewTipChanged": "Dice points mapping has changed: preview weights use defaults (100 by default; sums 5/10/15/20/25/30 default to 1). After importing, adjust weights in the Dice Reward page if needed.",
"createRefPreviewTipChanged": "Dice points mapping has changed: preview weights use defaults (100 for normal sums; 10 for sums 10/15/20/25; 1 for 5/30). After importing, adjust weights in the Dice Reward page if needed.",
"createRefPreviewSkipped": "{n} dice point(s) are missing in the reward index and were skipped (please complete all 26 points from 5 to 30).",
"createRefPreviewRefresh": "Refresh preview",
"createRefPreviewImport": "Import",

View File

@@ -52,7 +52,7 @@
"createRefPreviewClockwise": "顺时针",
"createRefPreviewCounterclockwise": "逆时针",
"createRefPreviewTipUnchanged": "检测到色子点数映射未变化预览中权重将复用当前奖励对照表dice_reward的权重导入时不会覆盖现有权重。",
"createRefPreviewTipChanged": "检测到色子点数映射已变化:预览中权重将使用默认值(默认 100点数和为 5/10/15/20/25/30 默认 1确认导入后可再到「奖励对照」页面调整权重。",
"createRefPreviewTipChanged": "检测到色子点数映射已变化:预览中权重将使用默认值(普通点数默认 100点数和 10/15/20/25 默认 105/30 默认 1确认导入后可再到「奖励对照」页面调整权重。",
"createRefPreviewSkipped": "有 {n} 个点数在当前奖励索引中缺失,已跳过生成(请先补齐 530 共 26 个点数)。",
"createRefPreviewRefresh": "刷新预览",
"createRefPreviewImport": "确认导入",

View File

@@ -20,6 +20,16 @@ class DiceRewardLogic
private const WEIGHT_MIN = 1;
private const WEIGHT_MAX = 10000;
/** 豹子边点 5/30对照表默认最低权重 */
private const CORNER_BIGWIN_GRIDS = [5, 30];
/** 中间大奖候选点 10/15/20/25对照表默认权重 */
private const MID_BIGWIN_GRIDS = [10, 15, 20, 25];
private const REFERENCE_MID_WEIGHT = 10;
private const REFERENCE_NORMAL_WEIGHT = 100;
/** 档位键 */
private const TIER_KEYS = ['T1', 'T2', 'T3', 'T4', 'T5', 'BIGWIN'];
@@ -381,14 +391,13 @@ class DiceRewardLogic
$compare = $this->compareReferenceRows($computed['rows'], $existing);
$unchanged = $compare['unchanged'];
$specialGrids = [5, 10, 15, 20, 25, 30];
$previewRows = [];
foreach ($computed['rows'] as $row) {
$key = $row['direction'] . ':' . $row['grid_number'];
$gridNumber = isset($row['grid_number']) ? (int) $row['grid_number'] : 0;
$weight = $unchanged
? self::WEIGHT_MIN
: (in_array($gridNumber, $specialGrids, true) ? self::WEIGHT_MIN : 100);
: $this->defaultReferenceWeightForGrid($gridNumber);
$oldStart = null;
$oldEnd = null;
$oldTier = null;
@@ -401,12 +410,12 @@ class DiceRewardLogic
$oldRemark = isset($existing[$key]['remark']) ? (string) $existing[$key]['remark'] : null;
$oldWeight = isset($existing[$key]['weight']) ? (int) $existing[$key]['weight'] : null;
}
// 映射未变化时:通常复用旧权重;但若旧权重为 1 且非特殊点数,则按新默认建议展示为 100方便管理员快速落配置
// 映射未变化时:通常复用旧权重;旧权重为 1 时按点数类型补全为新默认建议值
if ($unchanged && $oldWeight !== null) {
$oldWeight = (int) $oldWeight;
$weight = max(self::WEIGHT_MIN, min(self::WEIGHT_MAX, $oldWeight));
if ($weight === self::WEIGHT_MIN && !in_array($gridNumber, $specialGrids, true)) {
$weight = 100;
if ($weight === self::WEIGHT_MIN) {
$weight = $this->defaultReferenceWeightForGrid($gridNumber);
}
}
@@ -467,7 +476,7 @@ class DiceRewardLogic
* - 实际中奖real_ev = DiceRewardConfig::where('id', $end_index)->first()->real_ev
* - 备注remark = 按本条对照档位(推断后 T1-T5的默认备注T1 大奖、T2 小赚…),非落点格盘面 remark 字段
* - 类型type = DiceRewardConfig::where('id', $end_index)->first()->type-2=唯一惩罚,-1=抽水,0=回本,1=再来一次,2=小赚,3=大奖格)
* - weight 默认 1后续在权重编辑弹窗设置
* - weight 默认10/15/20/25 为 105/30 为 1其余为 100
*
* 例如顺时针摇取点数为 5 时start_index = 配置中 grid_number=5 对应格位的 id
* 结束位置 = (起始位置 + grid_number) % 26再取该位置的 config 的 id 作为 end_index。
@@ -510,7 +519,7 @@ class DiceRewardLogic
$m->tier = $row['tier'];
$m->direction = (int) $row['direction'];
$m->end_index = (int) $row['end_index'];
$m->weight = self::WEIGHT_MIN;
$m->weight = $this->defaultReferenceWeightForGrid((int) $row['grid_number']);
$m->grid_number = (int) $row['grid_number'];
$m->start_index = (int) $row['start_index'];
$m->ui_text = (string) ($row['ui_text'] ?? '');
@@ -654,7 +663,7 @@ class DiceRewardLogic
return [
'tier' => $tier,
'direction' => $direction,
'weight' => self::WEIGHT_MIN,
'weight' => $this->defaultReferenceWeightForGrid($gridNumber),
'grid_number' => $gridNumber,
'start_index' => $startId,
'end_index' => isset($landingConfig['id']) ? (int) $landingConfig['id'] : 0,
@@ -685,6 +694,20 @@ class DiceRewardLogic
return 'T5';
}
/**
* 创建奖励对照表时按色子点数和的默认权重
*/
private function defaultReferenceWeightForGrid(int $gridNumber): int
{
if (in_array($gridNumber, self::MID_BIGWIN_GRIDS, true)) {
return self::REFERENCE_MID_WEIGHT;
}
if (in_array($gridNumber, self::CORNER_BIGWIN_GRIDS, true)) {
return self::WEIGHT_MIN;
}
return self::REFERENCE_NORMAL_WEIGHT;
}
/**
* 档位默认备注
*/