This commit is contained in:
wangwei01 2019-07-23 17:04:14 +08:00
parent fce518d5b6
commit 4bf4eabaf5

View File

@ -255,31 +255,6 @@ class RoleController{
}
//额外奖励
$times = $this->getRewardTimes($coin_num);
$extra_coin = $coin_num * ($times - 1);
$d = $this->getDrop(24004);
if (!$d) {
phpcommon\sendError(ERR_USER_BASE + 3, '没有这个奖励');
return;
}
$skin_id_array = $this->getExplode($d['item_id']);
$weight_sum = 0;
$keys = 0;
$skin_num_array = $this->getExplode($d['num']);
$weight_array = $this->getExplode($d['weight']);
for ($i = 0; $i < count($weight_array); $i++) {
$weight_sum += $weight_array[$i][0];
}
srand($room_uuid);
$random = Rand(0, $weight_sum);
$weight = 0;
for ($i = 0; $i < count($weight_array); $i++) {
$weight += $weight_array[$i][0];
if ($weight > $random) {
$keys = $i;
break;
}
}
error_log(11111111);
$extra_drop = "";
$skin_id = $skin_id_array[$keys][0];
@ -288,7 +263,7 @@ class RoleController{
if ($row['battle_re_times'] >= $p_battle_reward['param_value']) {
$extra_drop = '10001:' . $extra_coin;
} else {
$extra_drop = '10001:' . $extra_coin . '|10002:1' . '|' . $skin_id . ':' . $skin_num;
$extra_drop = '10001:' . $extra_coin . '|10002:1';
}
error_log($extra_drop);
echo json_encode(array(
@ -430,31 +405,6 @@ class RoleController{
$coin_num = $row['coin'];
$times = $this->getRewardTimes($coin_num);
$coin_num = $row['coin'] * ($times - 1);
$d = $this->getDrop(24004);
if (!$d) {
phpcommon\sendError(ERR_USER_BASE + 3, '没有这个奖励');
return;
}
$skin_id_array = $this->getExplode($d['item_id']);
$weight_sum = 0;
$keys = 0;
$skin_num_array = $this->getExplode($d['num']);
$weight_array = $this->getExplode($d['weight']);
for ($i = 0; $i < count($weight_array); $i++) {
$weight_sum += $weight_array[$i][0];
}
srand($room_uuid);
$random = Rand(0, $weight_sum);
$weight = 0;
for ($i = 0; $i < count($weight_array); $i++) {
$weight += $weight_array[$i][0];
if ($weight > $random) {
$keys = $i;
break;
}
}
$skin_id = $skin_id_array[$keys][0];
$skin_num = $skin_num_array[$keys][0];
$p_battle_reward = $this->getParameter(MAX_BATTLE_REWARD);
$addreward = new classes\AddReward();
$addreward->addReward(10001, $coin_num, $account_id);