1.将创建奖励对照表的10,15,20,25的默认权重设置为10
This commit is contained in:
@@ -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 为 10,5/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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 档位默认备注
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user