1.将创建奖励对照表的10,15,20,25的默认权重设置为10
This commit is contained in:
@@ -52,7 +52,7 @@
|
|||||||
"createRefPreviewClockwise": "Clockwise",
|
"createRefPreviewClockwise": "Clockwise",
|
||||||
"createRefPreviewCounterclockwise": "Counter-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.",
|
"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).",
|
"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",
|
"createRefPreviewRefresh": "Refresh preview",
|
||||||
"createRefPreviewImport": "Import",
|
"createRefPreviewImport": "Import",
|
||||||
|
|||||||
@@ -52,7 +52,7 @@
|
|||||||
"createRefPreviewClockwise": "顺时针",
|
"createRefPreviewClockwise": "顺时针",
|
||||||
"createRefPreviewCounterclockwise": "逆时针",
|
"createRefPreviewCounterclockwise": "逆时针",
|
||||||
"createRefPreviewTipUnchanged": "检测到色子点数映射未变化:预览中权重将复用当前奖励对照表(dice_reward)的权重;导入时不会覆盖现有权重。",
|
"createRefPreviewTipUnchanged": "检测到色子点数映射未变化:预览中权重将复用当前奖励对照表(dice_reward)的权重;导入时不会覆盖现有权重。",
|
||||||
"createRefPreviewTipChanged": "检测到色子点数映射已变化:预览中权重将使用默认值(默认 100;点数和为 5/10/15/20/25/30 默认 1);确认导入后可再到「奖励对照」页面调整权重。",
|
"createRefPreviewTipChanged": "检测到色子点数映射已变化:预览中权重将使用默认值(普通点数默认 100;点数和 10/15/20/25 默认 10;5/30 默认 1);确认导入后可再到「奖励对照」页面调整权重。",
|
||||||
"createRefPreviewSkipped": "有 {n} 个点数在当前奖励索引中缺失,已跳过生成(请先补齐 5~30 共 26 个点数)。",
|
"createRefPreviewSkipped": "有 {n} 个点数在当前奖励索引中缺失,已跳过生成(请先补齐 5~30 共 26 个点数)。",
|
||||||
"createRefPreviewRefresh": "刷新预览",
|
"createRefPreviewRefresh": "刷新预览",
|
||||||
"createRefPreviewImport": "确认导入",
|
"createRefPreviewImport": "确认导入",
|
||||||
|
|||||||
@@ -20,6 +20,16 @@ class DiceRewardLogic
|
|||||||
private const WEIGHT_MIN = 1;
|
private const WEIGHT_MIN = 1;
|
||||||
private const WEIGHT_MAX = 10000;
|
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'];
|
private const TIER_KEYS = ['T1', 'T2', 'T3', 'T4', 'T5', 'BIGWIN'];
|
||||||
|
|
||||||
@@ -381,14 +391,13 @@ class DiceRewardLogic
|
|||||||
$compare = $this->compareReferenceRows($computed['rows'], $existing);
|
$compare = $this->compareReferenceRows($computed['rows'], $existing);
|
||||||
$unchanged = $compare['unchanged'];
|
$unchanged = $compare['unchanged'];
|
||||||
|
|
||||||
$specialGrids = [5, 10, 15, 20, 25, 30];
|
|
||||||
$previewRows = [];
|
$previewRows = [];
|
||||||
foreach ($computed['rows'] as $row) {
|
foreach ($computed['rows'] as $row) {
|
||||||
$key = $row['direction'] . ':' . $row['grid_number'];
|
$key = $row['direction'] . ':' . $row['grid_number'];
|
||||||
$gridNumber = isset($row['grid_number']) ? (int) $row['grid_number'] : 0;
|
$gridNumber = isset($row['grid_number']) ? (int) $row['grid_number'] : 0;
|
||||||
$weight = $unchanged
|
$weight = $unchanged
|
||||||
? self::WEIGHT_MIN
|
? self::WEIGHT_MIN
|
||||||
: (in_array($gridNumber, $specialGrids, true) ? self::WEIGHT_MIN : 100);
|
: $this->defaultReferenceWeightForGrid($gridNumber);
|
||||||
$oldStart = null;
|
$oldStart = null;
|
||||||
$oldEnd = null;
|
$oldEnd = null;
|
||||||
$oldTier = null;
|
$oldTier = null;
|
||||||
@@ -401,12 +410,12 @@ class DiceRewardLogic
|
|||||||
$oldRemark = isset($existing[$key]['remark']) ? (string) $existing[$key]['remark'] : null;
|
$oldRemark = isset($existing[$key]['remark']) ? (string) $existing[$key]['remark'] : null;
|
||||||
$oldWeight = isset($existing[$key]['weight']) ? (int) $existing[$key]['weight'] : null;
|
$oldWeight = isset($existing[$key]['weight']) ? (int) $existing[$key]['weight'] : null;
|
||||||
}
|
}
|
||||||
// 映射未变化时:通常复用旧权重;但若旧权重为 1 且非特殊点数,则按新默认建议展示为 100(方便管理员快速落配置)
|
// 映射未变化时:通常复用旧权重;旧权重为 1 时按点数类型补全为新默认建议值
|
||||||
if ($unchanged && $oldWeight !== null) {
|
if ($unchanged && $oldWeight !== null) {
|
||||||
$oldWeight = (int) $oldWeight;
|
$oldWeight = (int) $oldWeight;
|
||||||
$weight = max(self::WEIGHT_MIN, min(self::WEIGHT_MAX, $oldWeight));
|
$weight = max(self::WEIGHT_MIN, min(self::WEIGHT_MAX, $oldWeight));
|
||||||
if ($weight === self::WEIGHT_MIN && !in_array($gridNumber, $specialGrids, true)) {
|
if ($weight === self::WEIGHT_MIN) {
|
||||||
$weight = 100;
|
$weight = $this->defaultReferenceWeightForGrid($gridNumber);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -467,7 +476,7 @@ class DiceRewardLogic
|
|||||||
* - 实际中奖:real_ev = DiceRewardConfig::where('id', $end_index)->first()->real_ev
|
* - 实际中奖:real_ev = DiceRewardConfig::where('id', $end_index)->first()->real_ev
|
||||||
* - 备注:remark = 按本条对照档位(推断后 T1-T5)的默认备注(T1 大奖、T2 小赚…),非落点格盘面 remark 字段
|
* - 备注:remark = 按本条对照档位(推断后 T1-T5)的默认备注(T1 大奖、T2 小赚…),非落点格盘面 remark 字段
|
||||||
* - 类型:type = DiceRewardConfig::where('id', $end_index)->first()->type(-2=唯一惩罚,-1=抽水,0=回本,1=再来一次,2=小赚,3=大奖格)
|
* - 类型:type = DiceRewardConfig::where('id', $end_index)->first()->type(-2=唯一惩罚,-1=抽水,0=回本,1=再来一次,2=小赚,3=大奖格)
|
||||||
* - weight 默认 1,后续在权重编辑弹窗设置
|
* - weight 默认:10/15/20/25 为 10,5/30 为 1,其余为 100
|
||||||
*
|
*
|
||||||
* 例如顺时针摇取点数为 5 时:start_index = 配置中 grid_number=5 对应格位的 id,
|
* 例如顺时针摇取点数为 5 时:start_index = 配置中 grid_number=5 对应格位的 id,
|
||||||
* 结束位置 = (起始位置 + grid_number) % 26,再取该位置的 config 的 id 作为 end_index。
|
* 结束位置 = (起始位置 + grid_number) % 26,再取该位置的 config 的 id 作为 end_index。
|
||||||
@@ -510,7 +519,7 @@ class DiceRewardLogic
|
|||||||
$m->tier = $row['tier'];
|
$m->tier = $row['tier'];
|
||||||
$m->direction = (int) $row['direction'];
|
$m->direction = (int) $row['direction'];
|
||||||
$m->end_index = (int) $row['end_index'];
|
$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->grid_number = (int) $row['grid_number'];
|
||||||
$m->start_index = (int) $row['start_index'];
|
$m->start_index = (int) $row['start_index'];
|
||||||
$m->ui_text = (string) ($row['ui_text'] ?? '');
|
$m->ui_text = (string) ($row['ui_text'] ?? '');
|
||||||
@@ -654,7 +663,7 @@ class DiceRewardLogic
|
|||||||
return [
|
return [
|
||||||
'tier' => $tier,
|
'tier' => $tier,
|
||||||
'direction' => $direction,
|
'direction' => $direction,
|
||||||
'weight' => self::WEIGHT_MIN,
|
'weight' => $this->defaultReferenceWeightForGrid($gridNumber),
|
||||||
'grid_number' => $gridNumber,
|
'grid_number' => $gridNumber,
|
||||||
'start_index' => $startId,
|
'start_index' => $startId,
|
||||||
'end_index' => isset($landingConfig['id']) ? (int) $landingConfig['id'] : 0,
|
'end_index' => isset($landingConfig['id']) ? (int) $landingConfig['id'] : 0,
|
||||||
@@ -685,6 +694,20 @@ class DiceRewardLogic
|
|||||||
return 'T5';
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 档位默认备注
|
* 档位默认备注
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user