1
This commit is contained in:
parent
82bdfb1c88
commit
8816392dd6
@ -79,6 +79,7 @@ define('DIAMONDBOX10', 62); //钻石视频宝箱花费钻石数
|
|||||||
define('REDLIMIT', 68); //红包上限
|
define('REDLIMIT', 68); //红包上限
|
||||||
define('RECOMMEND_FOREVER_WEIGHT',85); //精选道具概率
|
define('RECOMMEND_FOREVER_WEIGHT',85); //精选道具概率
|
||||||
define('RECOMMEND_TIME', 84); //道具精选时间
|
define('RECOMMEND_TIME', 84); //道具精选时间
|
||||||
|
define('GAMEOVER_REWARD_TIMES', 87); //战斗结束奖励倍数
|
||||||
require 'config_loader.php';
|
require 'config_loader.php';
|
||||||
|
|
||||||
|
|
||||||
|
@ -199,7 +199,6 @@ class AddReward {
|
|||||||
$status = $this->getStatus($item_id, $status,$accountid);
|
$status = $this->getStatus($item_id, $status,$accountid);
|
||||||
} else if ($t == 1){
|
} else if ($t == 1){
|
||||||
$status = 0;
|
$status = 0;
|
||||||
error_log(11111111111111);
|
|
||||||
$this->updateStatus($item_id, $accountid);
|
$this->updateStatus($item_id, $accountid);
|
||||||
}
|
}
|
||||||
$ret = $conn->execScript('INSERT INTO bag(accountid, id, color_id, status, active_time, create_time, modify_time) ' .
|
$ret = $conn->execScript('INSERT INTO bag(accountid, id, color_id, status, active_time, create_time, modify_time) ' .
|
||||||
@ -222,7 +221,6 @@ class AddReward {
|
|||||||
$item_id = 10003;
|
$item_id = 10003;
|
||||||
$item_num = $price;
|
$item_num = $price;
|
||||||
$time = 0;
|
$time = 0;
|
||||||
error_log(3333333333);
|
|
||||||
$this->addDiamond($item_id, $item_num, $accountid);
|
$this->addDiamond($item_id, $item_num, $accountid);
|
||||||
} else {
|
} else {
|
||||||
$nowTime = $row['active_time'];
|
$nowTime = $row['active_time'];
|
||||||
@ -241,7 +239,6 @@ class AddReward {
|
|||||||
$status = $this->getStatus($item_id, $status,$accountid);
|
$status = $this->getStatus($item_id, $status,$accountid);
|
||||||
} else if ($t == 1){
|
} else if ($t == 1){
|
||||||
$status = 0;
|
$status = 0;
|
||||||
error_log(2222222222);
|
|
||||||
$this->updateStatus($item_id, $accountid);
|
$this->updateStatus($item_id, $accountid);
|
||||||
}
|
}
|
||||||
$ret = $conn->execScript('UPDATE bag SET active_time=:active_time, status=:status, modify_time=:modify_time ' .
|
$ret = $conn->execScript('UPDATE bag SET active_time=:active_time, status=:status, modify_time=:modify_time ' .
|
||||||
|
@ -30,6 +30,18 @@ class RoleController{
|
|||||||
return $r;
|
return $r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function getParameter($para_id)
|
||||||
|
{
|
||||||
|
$parameter_meta_cluster = require('../res/parameter@parameter.php');
|
||||||
|
$parameter_meta = getParameterConfig($parameter_meta_cluster, $para_id);
|
||||||
|
$p = array(
|
||||||
|
'id' => $parameter_meta['id'],
|
||||||
|
'name' => $parameter_meta['param_name'],
|
||||||
|
'value' => $parameter_meta['param_value'],
|
||||||
|
);
|
||||||
|
return $p;
|
||||||
|
}
|
||||||
|
|
||||||
protected function getActivityRewardConfig($activityReward_id)
|
protected function getActivityRewardConfig($activityReward_id)
|
||||||
{
|
{
|
||||||
$g_conf_activityReward_cluster = require('../res/activityReward@activityReward.php');
|
$g_conf_activityReward_cluster = require('../res/activityReward@activityReward.php');
|
||||||
@ -74,19 +86,6 @@ class RoleController{
|
|||||||
return $arr;
|
return $arr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
protected function getParameter($para_id)
|
|
||||||
{
|
|
||||||
$g_conf_para_cluster = require('../res/parameter@parameter.php');
|
|
||||||
$para_conf = getParameterConfig($g_conf_para_cluster, $para_id);
|
|
||||||
$p = array(
|
|
||||||
'id' => $para_conf['id'],
|
|
||||||
'param_name' => $para_conf['param_name'],
|
|
||||||
'param_value' => $para_conf['param_value'],
|
|
||||||
);
|
|
||||||
return $p;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function roleInfo()
|
public function roleInfo()
|
||||||
{
|
{
|
||||||
$account_id = $_REQUEST['account_id'];
|
$account_id = $_REQUEST['account_id'];
|
||||||
@ -261,7 +260,6 @@ class RoleController{
|
|||||||
|
|
||||||
public function battleReport()
|
public function battleReport()
|
||||||
{
|
{
|
||||||
error_log(111111111122222222222222221);
|
|
||||||
$account_id = $_REQUEST['account_id']; //账号
|
$account_id = $_REQUEST['account_id']; //账号
|
||||||
$conn = $this->getMysql($account_id);
|
$conn = $this->getMysql($account_id);
|
||||||
if (!$conn) {
|
if (!$conn) {
|
||||||
@ -417,42 +415,6 @@ class RoleController{
|
|||||||
if ($team_status == 1) {
|
if ($team_status == 1) {
|
||||||
$quest->triggerQuest(QUEST_DAY_TEAM, 1, 1, $account_id);
|
$quest->triggerQuest(QUEST_DAY_TEAM, 1, 1, $account_id);
|
||||||
}
|
}
|
||||||
//额外奖励
|
|
||||||
$p = $this->getParameter(REWARD_TIMES);
|
|
||||||
$times = $p['param_value'] - 1;
|
|
||||||
$extra_coin = $coin_num * $times;
|
|
||||||
$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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$extra_drop = "";
|
|
||||||
$skin_id = $skin_id_array[$keys][0];
|
|
||||||
$skin_num = $skin_num_array[$keys][0];
|
|
||||||
$p_battle_reward = $this->getParameter(MAX_BATTLE_REWARD);
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
echo json_encode(array(
|
echo json_encode(array(
|
||||||
'errcode' => 0,
|
'errcode' => 0,
|
||||||
@ -461,7 +423,6 @@ class RoleController{
|
|||||||
'alive_time_his' => $alive_time_his,
|
'alive_time_his' => $alive_time_his,
|
||||||
'harm_his' => $harm_his,
|
'harm_his' => $harm_his,
|
||||||
'add_HP_his' => $add_HP_his,
|
'add_HP_his' => $add_HP_his,
|
||||||
'extra_drop' => $extra_drop
|
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -562,94 +523,6 @@ class RoleController{
|
|||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function fightReward()
|
|
||||||
{
|
|
||||||
$account_id = $_REQUEST['account_id'];
|
|
||||||
$room_uuid = $_REQUEST['room_uuid'];
|
|
||||||
//登录校验
|
|
||||||
$login = loginVerify($account_id, $_REQUEST['session_id']);
|
|
||||||
if (!$login) {
|
|
||||||
phpcommon\sendError(ERR_USER_BASE + 1, 'session无效');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$conn = $this->getMysql($account_id);
|
|
||||||
$record_list = array();
|
|
||||||
if (!$conn) {
|
|
||||||
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$row = $conn->execQueryOne('SELECT * FROM history_record WHERE accountid=:accountid AND room_uuid=:room_uuid;',
|
|
||||||
array(
|
|
||||||
':accountid' => $account_id,
|
|
||||||
':room_uuid' => $room_uuid
|
|
||||||
));
|
|
||||||
if (!$row) {
|
|
||||||
phpcommon\sendError(ERR_USER_BASE + 2, '没有这场战斗记录');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($row['status'] == 1) {
|
|
||||||
phpcommon\sendError(ERR_USER_BASE + 3, '战斗奖励已领取');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
$coin_num = $row['coin'];
|
|
||||||
$p = $this->getParameter(REWARD_TIMES);
|
|
||||||
$times = $p['param_value'] - 1;
|
|
||||||
$coin_num = $row['coin'] * $times;
|
|
||||||
$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);
|
|
||||||
$rowUser = $conn->execQueryOne('SELECT * FROM user WHERE accountid=:accountid;',
|
|
||||||
array(
|
|
||||||
':accountid' => $account_id
|
|
||||||
));
|
|
||||||
if ($rowUser['battle_re_times'] < $p_battle_reward['param_value']) {
|
|
||||||
$keys_num = $rowUser['keys_num'] + 1;
|
|
||||||
$battle_re_times = $rowUser['battle_re_times'] + 1;
|
|
||||||
$addreward->addReward($skin_id, $skin_num, $account_id);
|
|
||||||
$ret = $conn->execScript('UPDATE user SET battle_re_times=:battle_re_times, keys_num=:keys_num, modify_time=:modify_time ' .
|
|
||||||
' WHERE accountid=:accountid;',
|
|
||||||
array(
|
|
||||||
':keys_num' => $keys_num,
|
|
||||||
':battle_re_times' => $battle_re_times,
|
|
||||||
':modify_time' => time(),
|
|
||||||
':accountid' => $account_id
|
|
||||||
));
|
|
||||||
if (!$ret) {
|
|
||||||
die();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
echo json_encode(array(
|
|
||||||
'errcode' => 0,
|
|
||||||
'errmsg' => '',
|
|
||||||
));
|
|
||||||
}
|
|
||||||
|
|
||||||
public function collectReward()
|
public function collectReward()
|
||||||
{
|
{
|
||||||
@ -835,5 +708,27 @@ class RoleController{
|
|||||||
$switch = json_decode($user_db_str, true);
|
$switch = json_decode($user_db_str, true);
|
||||||
return $switch;
|
return $switch;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getFightReward()
|
||||||
|
{
|
||||||
|
$account_id = $_REQUEST['account_id'];
|
||||||
|
//登录校验
|
||||||
|
$login = loginVerify($account_id, $_REQUEST['session_id']);
|
||||||
|
if (!$login) {
|
||||||
|
phpcommon\sendError(ERR_USER_BASE + 1, 'session无效');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
$coin_num = $_REQUEST['coin_num'];
|
||||||
|
$addreward = new classes\AddReward();
|
||||||
|
$p = $this->getParameter(GAMEOVER_REWARD_TIMES);
|
||||||
|
$times = $p['value'] - 1;
|
||||||
|
$addreward->addReward(10001, $coin_num * $times, $account_id, 0, 0);
|
||||||
|
$coin_num = $addreward->getCoinNum($account_id);
|
||||||
|
echo json_encode(array(
|
||||||
|
'errcode' => 0,
|
||||||
|
'errmsg'=> '',
|
||||||
|
'coin_nums' => $coin_num,
|
||||||
|
));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user