Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
12dea71de4 |
@ -90,6 +90,19 @@ define('DAILYCOIN_DECAY', 130); //每日金币衰减比例
|
||||
define('DAILYCOIN_TIMES', 131); //每日金币领取次数
|
||||
define('DAILYCOIN_NUM', 132); //每日金币基准数
|
||||
define('SHARE_VIDEO_REWARD', 147); //分享视频奖励
|
||||
define('EQUIPREWARD_PARAMETER', 152); //结算比例
|
||||
define('DIAMONDTOCOIN_NUM', 153); //钻石换金币
|
||||
define('CREAM_TASK_01', 155); //钻石换金币
|
||||
define('CREAM_TASK_02', 156); //钻石换金币
|
||||
|
||||
|
||||
define('CLAN_VIDEO_DIAMOND', 165); //观看视频,领取的钻石数量
|
||||
define('CLAN_DIAMOND', 164); //创建战队需要的钻石数量
|
||||
define('OPENING_SPEAR', 154); //新玩家奖励第一把武器
|
||||
define('OPENING_SPEAR2', 178); //新玩家奖励第二把武器
|
||||
define('LOTTERY_COST', 187); //每日抽奖钻石消耗
|
||||
define('DIAMONDLOTTERY_TIME', 188); //每日消耗钻石抽奖次数
|
||||
|
||||
require 'config_loader.php';
|
||||
|
||||
|
||||
|
@ -132,5 +132,119 @@ class Quest{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//提交假日活动任务
|
||||
public function flushHolidayQuest($quest_id, $quest_num, $account_id)
|
||||
{
|
||||
$conn = $this->getMysql($account_id);
|
||||
if (!$conn) {
|
||||
return;
|
||||
}
|
||||
$user_db = $this->readHolidayDB($account_id);
|
||||
if (!$user_db || empty($user_db)) {
|
||||
return;
|
||||
}
|
||||
$id = $quest_id;
|
||||
$flag = 0;
|
||||
foreach ($user_db['quest_list'] as &$user) {
|
||||
if (isset($user['quest_list']) && !empty($user['quest_list'])) {
|
||||
foreach ($user['quest_list'] as &$us) {
|
||||
if ($us['id'] != $id || $us['status'] != 0) {
|
||||
continue;
|
||||
}
|
||||
if ($id == 72009) {
|
||||
if($quest_num <= $us['condition']) {
|
||||
$us['status'] = 1;
|
||||
$flag = 1;
|
||||
}
|
||||
} else {
|
||||
$us['num'] = $us['num'] + $quest_num;
|
||||
if ($us['num'] >= $us['condition']) {
|
||||
$us['status'] = 1;
|
||||
$flag = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->saveHolidayDB($account_id, $user_db);
|
||||
if ($flag == 1 && $id != 72010) {
|
||||
$this->flushAllQuest($account_id);
|
||||
}
|
||||
}
|
||||
|
||||
public function flushAllQuest($account_id)
|
||||
{
|
||||
$conn = $this->getMysql($account_id);
|
||||
if (!$conn) {
|
||||
return;
|
||||
}
|
||||
$user_db = $this->readHolidayDB($account_id);
|
||||
if (!$user_db || empty($user_db)) {
|
||||
return;
|
||||
}
|
||||
$id = 72010;
|
||||
foreach ($user_db['quest_list'] as &$user) {
|
||||
if (isset($user['quest_list']) && !empty($user['quest_list'])) {
|
||||
foreach ($user['quest_list'] as &$us) {
|
||||
if ($us['id'] != $id || $us['status'] != 0) {
|
||||
continue;
|
||||
}
|
||||
$us['num'] = $us['num'] + 1;
|
||||
if ($us['num'] >= $us['condition']) {
|
||||
$us['status'] = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$this->saveHolidayDB($account_id, $user_db);
|
||||
}
|
||||
|
||||
protected function readHolidayDB($account_id) {
|
||||
$conn = $this->getMysql($account_id);
|
||||
$row = $conn->execQueryOne('SELECT blobdata FROM holiday WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
));
|
||||
if (!empty($row)) {
|
||||
$hol_db_str = $row['blobdata'];
|
||||
$hol_db = json_decode($hol_db_str, true);
|
||||
return $hol_db;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected function saveHolidayDB($account_id, $hol_db) {
|
||||
$conn = $this->getMysql($account_id);
|
||||
$row = $conn->execQueryOne('SELECT accountid FROM holiday WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id
|
||||
));
|
||||
$hol_db_str = "";
|
||||
if (!empty($hol_db)) {
|
||||
$hol_db_str = json_encode($hol_db);
|
||||
}
|
||||
if (!empty($row)) {
|
||||
//update
|
||||
$row = $conn->execScript('UPDATE holiday SET blobdata=:blobdata, modify_time=:modify_time WHERE accountid=:accountid;',
|
||||
array(
|
||||
':accountid' => $account_id,
|
||||
':blobdata' => $hol_db_str,
|
||||
':modify_time' => time()
|
||||
));
|
||||
} else {
|
||||
//insert
|
||||
$row = $conn->execScript('INSERT INTO holiday(accountid, blobdata, create_time, modify_time) ' .
|
||||
' VALUES(:account_id, :blobdata, :create_time, :modify_time) ' .
|
||||
' ON DUPLICATE KEY UPDATE accountid=:account_id, blobdata=:blobdata, modify_time=:modify_time;',
|
||||
array(
|
||||
':account_id' => $account_id,
|
||||
':blobdata' => $hol_db_str,
|
||||
':create_time' => time(),
|
||||
':modify_time' => time(),
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
@ -829,38 +829,54 @@ class RoleController{
|
||||
}*/
|
||||
|
||||
$newhand = $row['newhand'];
|
||||
$newhand2 = $row['newhand2'];
|
||||
$game_times2 = $row['game_times2'];
|
||||
$p1 = $this->getParameter(NEWHAND_NUM1);
|
||||
$fight_times = $p1['param_value'];
|
||||
$p2 = $this->getParameter(NEWHAND_NUM2);
|
||||
$view_times = $p2['param_value'];
|
||||
$p3 = $this->getParameter(CREAM_TASK_01);
|
||||
$fight_times2 = $p3['param_value'];
|
||||
$p4 = $this->getParameter(CREAM_TASK_02);
|
||||
$view_times2 = $p4['param_value'];
|
||||
if ($row['game_times'] + 1 == $fight_times && $row['vip_score'] >= $view_times) {
|
||||
$newhand = 1;
|
||||
}
|
||||
if ($newhand == 2) {
|
||||
if ($row['game_times2'] + 1 == $fight_times2 && $row['view_times2'] >= $view_times2) {
|
||||
$newhand2 = 1;
|
||||
}
|
||||
$game_times2++;
|
||||
}
|
||||
|
||||
$ret = $conn->execScript('UPDATE user SET game_times=:game_times, kills=:kills, harm=:harm, add_HP=:add_HP, alive_time=:alive_time, kill_his=:kill_his, alive_time_his=:alive_time_his, harm_his=:harm_his, add_HP_his=:add_HP_his, coin_num=:coin_num, modify_time=:modify_time, first_fight=1, box_num=:box_num, score=:score, daily_time=:daily_time, season_games=:season_games, sea_max_kill=:sea_max_kill, sea_max_hart=:sea_max_hart, sea_avg_kill=:sea_avg_kill, newhand=:newhand ' .
|
||||
'WHERE accountid=:accountid;',
|
||||
array(
|
||||
':game_times' => $row['game_times'] + 1,
|
||||
':kill_his' => $kill_his,
|
||||
':kills' => $row['kills'] + $kills,
|
||||
':harm_his' => $harm_his,
|
||||
':harm' => $row['harm'] + $harm,
|
||||
':add_HP' => $row['add_HP'] + $add_HP,
|
||||
':alive_time' => $row['alive_time'] + $alive_time,
|
||||
':alive_time_his' => $alive_time_his,
|
||||
':add_HP_his' => $add_HP_his,
|
||||
':accountid' => $account_id,
|
||||
':coin_num' => $row['coin_num'] + $coin_num,
|
||||
':modify_time' => time(),
|
||||
':box_num' => $box_num,
|
||||
':score' => $row['score'] + $score,
|
||||
':daily_time' => $daily_time,
|
||||
':season_games' => $row['season_games'] + 1,
|
||||
':sea_max_kill' => $sea_max_kill,
|
||||
':sea_max_hart' => $sea_max_hart,
|
||||
':sea_avg_kill' => $row['sea_avg_kill'] + $kills,
|
||||
':newhand' => $newhand,
|
||||
));
|
||||
$ret = $conn->execScript(
|
||||
'UPDATE user SET game_times=:game_times, kills=:kills, harm=:harm, add_HP=:add_HP, alive_time=:alive_time, kill_his=:kill_his, alive_time_his=:alive_time_his, harm_his=:harm_his, add_HP_his=:add_HP_his, coin_num=:coin_num, modify_time=:modify_time, first_fight=1, box_num=:box_num, score=:score, daily_time=:daily_time, season_games=:season_games, sea_max_kill=:sea_max_kill, sea_max_hart=:sea_max_hart, sea_avg_kill=:sea_avg_kill, newhand=:newhand, newhand2=:newhand2, game_times2=:game_times2 ' .
|
||||
'WHERE accountid=:accountid;',
|
||||
array(
|
||||
':game_times' => $row['game_times'] + 1,
|
||||
':kill_his' => $kill_his,
|
||||
':kills' => $row['kills'] + $kills,
|
||||
':harm_his' => $harm_his,
|
||||
':harm' => $row['harm'] + $harm,
|
||||
':add_HP' => $row['add_HP'] + $add_HP,
|
||||
':alive_time' => $row['alive_time'] + $alive_time,
|
||||
':alive_time_his' => $alive_time_his,
|
||||
':add_HP_his' => $add_HP_his,
|
||||
':accountid' => $account_id,
|
||||
':coin_num' => $row['coin_num'] + $coin_num,
|
||||
':modify_time' => time(),
|
||||
':box_num' => $box_num,
|
||||
':score' => $row['score'] + $score,
|
||||
':daily_time' => $daily_time,
|
||||
':season_games' => $row['season_games'] + 1,
|
||||
':sea_max_kill' => $sea_max_kill,
|
||||
':sea_max_hart' => $sea_max_hart,
|
||||
':sea_avg_kill' => $row['sea_avg_kill'] + $kills,
|
||||
':newhand' => $newhand,
|
||||
':newhand2' => $newhand2,
|
||||
':game_times2' => $game_times2,
|
||||
)
|
||||
);
|
||||
if (!$ret) {
|
||||
die();
|
||||
return;
|
||||
@ -873,11 +889,17 @@ class RoleController{
|
||||
$quest->triggerQuest(QUEST_DAY_HARM, 1, $harm, $account_id);
|
||||
$quest->triggerQuest(QUEST_DAY_KILL, 1, $kills, $account_id);
|
||||
$quest->triggerQuest(QUEST_DAY_HELP, 1, $rescue_member, $account_id);
|
||||
$quest->flushHolidayQuest(72003, 1, $account_id);
|
||||
$quest->flushHolidayQuest(72006, $harm, $account_id);
|
||||
$quest->flushHolidayQuest(72007, $kills, $account_id);
|
||||
$quest->flushHolidayQuest(72008, (int)($alive_time / 1000 / 60), $account_id);
|
||||
if ($team_status == 1 && $rank <= 5) {
|
||||
$quest->triggerQuest(QUEST_DAY_RANK, 1, 1, $account_id);
|
||||
$quest->flushHolidayQuest(72009, $rank, $account_id);
|
||||
}
|
||||
if ($team_status == 1) {
|
||||
$quest->triggerQuest(QUEST_DAY_TEAM, 1, 1, $account_id);
|
||||
$quest->flushHolidayQuest(72005, 1, $account_id);
|
||||
}
|
||||
|
||||
echo json_encode(array(
|
||||
|
Loading…
x
Reference in New Issue
Block a user