This commit is contained in:
aozhiwei 2020-07-31 22:29:12 +08:00
parent 68cd3da524
commit 499ef5db53
3 changed files with 115 additions and 36 deletions

View File

@ -102,7 +102,10 @@ class GameOverController{
'parameter' => $rank_meta['parameter'],
'drop' => $rank_meta['drop'],
'ad_drop' => $rank_meta['ad_drop'],
'ad_num' => $rank_meta['ad_num']
'ad_num' => $rank_meta['ad_num'],
'js_num' => $rank_meta['js_num'],
'js_drop' => $rank_meta['js_drop'],
'zbmode_param' => $rank_meta['zbmode_param'],
);
return $d;
}
@ -124,34 +127,23 @@ class GameOverController{
return;
}
$rank = $_REQUEST['rank'];
//$id = 12120;
// $conn = $this->getMysql($account_id);
// if (!$conn) {
// phpcommon\sendError(ERR_USER_BASE + 2, '没有这个玩家');
// die();
// return;
// }
// $row = $conn->execQueryOne('SELECT id FROM equip WHERE accountid=:account_id;',
// array(
// ':account_id' => $account_id
// ));
// if ($row) {
// $id = $row['id'];
// }
// $e = $this->getEquip($id);
// if (!$e) {
// phpcommon\sendError(ERR_USER_BASE + 2, '没有这个道具');
// die();
// return;
// }
// $count = 3;
// if ($e['upgrade_priority'] == 1) {
// $count = 1;
// }
$type = 0;
$coin = 0;
$score = 0;
$kills = 0;
if (isset($_REQUEST['type'])) {
$type = $_REQUEST['type'];
}
if ($type == 1) {
$ar = $this->getRankReward($rank);
$coin = $ar['zbmode_param'];
if (isset($_REQUEST['kills'])) {
$score = $_REQUEST['kills'] * 10;
}
}
//道具物品
$first_list = array();
//$first_list = $this->fixReward($first_list);
$first_list = $this->randomReward($rank);
$first_list = $this->randomReward($rank, $type);
$first_db = array(
'first_uuid' => $first_uuid,
'first_list' => $first_list,
@ -164,6 +156,8 @@ class GameOverController{
'errmsg'=> '',
'first_uuid' => $first_uuid,
'item_list' => $first_list,
'coin' => $coin,
'score' => $score,
));
}
@ -247,20 +241,20 @@ class GameOverController{
return $item_list;
}
protected function randomReward($rank)
protected function randomReward($rank,$type)
{
//随机奖励
//$e = $this->getEquip($id);
$r = $this->getRankReward($rank);
$b = $this->getDrop($r['ad_drop']);
$count = $r['ad_num'];
if ($type == 1) {
$b = $this->getDrop($r['js_drop']);
$count = $r['js_num'];
}
$item_list = array();
//$b = $this->getbox(6);
//$count = 3;
$item_id_array = $this->getExplode($b['item_id']);
$item_num_array = $this->getExplode($b['num']);
$weight_array = $this->getExplode($b['weight']);
//$time_array = $this->getExplode($b['time']);
$reward_array = array();
for ($c = 0; $c < $count; $c++) {
$weight_sum = 0;
@ -268,18 +262,15 @@ class GameOverController{
for ($ii = 0; $ii < count($weight_array); $ii++) {
$flag = $this->removal($reward_array, $item_id_array[$ii][0]);
if ($flag == 1) {
//error_log(222222222);
continue;
}
$weight_sum += $weight_array[$ii][0];
}
$random = Rand(0, $weight_sum);
$weight = 0;
//error_log(json_encode($weight_array));
for ($ii = 0; $ii < count($weight_array); $ii++) {
$flag = $this->removal($reward_array, $item_id_array[$ii][0]);
if ($flag == 1) {
//error_log(1111111);
continue;
}
$weight += $weight_array[$ii][0];
@ -300,7 +291,6 @@ class GameOverController{
'time' => $time
));
}
//error_log(json_encode($item_list));
return $item_list;
}

View File

@ -126,6 +126,23 @@ class RoleController{
return $seaPoint;
}
protected function getRankReward($rank)
{
$rank_meta_table = require('../res/rankReward@rankReward.php');
$rank_meta = getRankRewardConfig($rank_meta_table, $rank);
$d = array(
'rank' => $rank_meta['rank'],
'parameter' => $rank_meta['parameter'],
'drop' => $rank_meta['drop'],
'ad_drop' => $rank_meta['ad_drop'],
'ad_num' => $rank_meta['ad_num'],
'js_num' => $rank_meta['js_num'],
'js_drop' => $rank_meta['js_drop'],
'zbmode_param' => $rank_meta['zbmode_param'],
);
return $d;
}
public function roleInfo()
{
$account_id = $_REQUEST['account_id'];
@ -592,6 +609,72 @@ class RoleController{
}
public function battleReport()
{
if (!isset($_REQUEST['room_mode']) || $_REQUEST['room_mode'] == 0) {
$this->oldBattleReport();
} else {
$this->bioBattleReport();
}
}
public function bioBattleReport()
{
$account_id = $_REQUEST['account_id']; //账号
$conn = $this->getMysql($account_id);
if (!$conn) {
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
return;
}
$rank = $_REQUEST['rank'];
$ar = $this->getRankReward($rank);
$coin_num = $ar['zbmode_param'];
$row = $conn->execQueryOne('SELECT newhand, game_times, vip_score, daily_time, coin_num, season_games FROM user WHERE accountid=:accountid;',
array(
':accountid' => $account_id
));
if (!$row) {
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家1');
return;
}
$newhand = $row['newhand'];
$p1 = $this->getParameter(NEWHAND_NUM1);
$fight_times = $p1['param_value'];
$p2 = $this->getParameter(NEWHAND_NUM2);
$view_times = $p2['param_value'];
if ($row['game_times'] + 1 == $fight_times && $row['vip_score'] >= $view_times) {
$newhand = 1;
}
$nowTime = phpcommon\getdayseconds(time());
$daily_time = $row['daily_time'];
if ($daily_time == 0 || ($nowTime - phpcommon\getdayseconds($daily_time) > 0)) {
$daily_time = time();
}
$ret = $conn->execScript('UPDATE user SET game_times=:game_times, coin_num=:coin_num, modify_time=:modify_time, first_fight=1, season_games=:season_games, newhand=:newhand, daily_time=:daily_time ' .
'WHERE accountid=:accountid;',
array(
':game_times' => $row['game_times'] + 1,
':accountid' => $account_id,
':coin_num' => $row['coin_num'] + $coin_num,
':modify_time' => time(),
':daily_time' => $daily_time,
':season_games' => $row['season_games'] + 1,
':newhand' => $newhand,
));
if (!$ret) {
die();
return;
}
//刷新任务
$quest = new classes\Quest();
$quest->triggerQuest(QUEST_DAY_FIGHT, 1, 1, $account_id);
echo json_encode(array(
'errcode' => 0,
'errmsg' => '',
));
}
public function oldBattleReport()
{
$account_id = $_REQUEST['account_id']; //账号
$conn = $this->getMysql($account_id);

View File

@ -42,6 +42,7 @@ class TeamController{
$hat_id = 0;
$rank = 1;
$equip_id = 0;
$model = false;
if (isset($_REQUEST['cloth_id'])) {
$cloth_id = $_REQUEST['cloth_id'];
}
@ -60,6 +61,9 @@ class TeamController{
if (isset($_REQUEST['equip_id'])) {
$equip_id = $_REQUEST['equip_id'];
}
if (isset($_REQUEST['model'])) {
$model = $_REQUEST['model'];
}
$account_id = $_REQUEST['account_id'];
$conn = $this->getMysql($account_id);
$row = $conn->execQueryOne('SELECT game_times, win_times, kills, create_time FROM user WHERE accountid=:accountid;',
@ -71,6 +75,7 @@ class TeamController{
'team_uuid' => $team_uuid,
'auto_fill' => $_REQUEST['auto_fill'],
'state' => 0,
'model' => $model,
'member_list' => array(
array(
'idx' => 1,
@ -148,6 +153,7 @@ class TeamController{
'auto_fill' => $user_db['auto_fill'],
'state' => $user_db['state'],
'member_list' => $member_list,
'model' => $user_db['model'],
));
}