This commit is contained in:
aozhiwei 2019-05-28 10:27:56 +08:00
parent 3b3c1cae09
commit 54ff341538
4 changed files with 16 additions and 40 deletions

View File

@ -71,7 +71,9 @@ class Quest{
if ($row['quest_num'] + $quest_num >= $q['value']) {
$quest_num = $q['value'];
$quest_state = 1;
$this->triggerQuest(QUEST_DAY_COMPLETE, 1, 1, $account_id);
if ($quest_type == 1) {
$this->triggerQuest(QUEST_DAY_COMPLETE, 1, 1, $account_id);
}
} else {
$quest_num = $row['quest_num'] + $quest_num;
$quest_state = 0;
@ -108,7 +110,9 @@ class Quest{
if ($quest_num >= $q['value']) {
$quest_num = $q['value'];
$quest_state = 1;
$this->triggerQuest(QUEST_DAY_COMPLETE, 1, 1, $account_id);
if ($quest_type == 1) {
$this->triggerQuest(QUEST_DAY_COMPLETE, 1, 1, $account_id);
}
}
}
$ret = $conn->execScript('INSERT INTO quest(accountid, quest_id, quest_num, quest_type, quest_state) ' .

View File

@ -39,20 +39,20 @@ class EquipController{
$e = $this->getEquip($equip_id);
if (!$e) {
phpcommon\sendError(ERR_USER_BASE + 2, '没有这个装备');
return;
die();
}
$conn = $this->getMysql($account_id);
if (!$conn) {
phpcommon\sendError(ERR_USER_BASE + 1, '没有这个玩家');
return;
die();
}
$rowCoin = $conn->execQueryOne('SELECT * FROM user WHERE accountid=:accountid;',
array(
':accountid' => $account_id
));
if ($rowCoin['coin_num'] < $e['equip_cost']) {
phpcommon\sendError(ERR_USER_BASE + 3, '金币不足');
return;
phpcommon\sendError(ERR_USER_BASE + 3, '金币不足');
die();
}
$ret = $conn->execScript('UPDATE user SET coin_num=:coin_num ' .
' WHERE accountid=:accountid;',

View File

@ -52,7 +52,7 @@ class RankController{
$kill_db = json_decode($kill_rank_db);
$i = 0;
foreach ($kill_db as $kill) {
if ($i > 99) {
if ($i > 49) {
break;
}
if ($kill_db[$i][0] == $account_id) {
@ -76,7 +76,7 @@ class RankController{
$alive_db = json_decode($alive_rank_db);
$i = 0;
foreach ($alive_db as $alive) {
if ($i > 99) {
if ($i > 49) {
break;
}
if ($alive_db[$i][0] == $account_id) {
@ -100,7 +100,7 @@ class RankController{
$harm_db = json_decode($harm_rank_db);
$i = 0;
foreach ($harm_db as $harm) {
if ($i > 99) {
if ($i > 49) {
break;
}
if ($harm_db[$i][0] == $account_id) {
@ -124,7 +124,7 @@ class RankController{
$rate_db = json_decode($rate_rank_db);
$i = 0;
foreach ($rate_db as $rate) {
if ($i > 99) {
if ($i > 49) {
break;
}
if ($rate_db[$i][0] == $account_id) {
@ -148,7 +148,7 @@ class RankController{
$win_db = json_decode($win_rank_db);
$i = 0;
foreach ($win_db as $win) {
if ($i > 99) {
if ($i > 49) {
break;
}
if ($win_db[$i][0] == $account_id) {

View File

@ -110,35 +110,7 @@ class RoleController{
array(
':accountid' => $account_id
));
if (!$row) {
if ($rank == 1) {
$win_times = 1;
} else {
$win_times = 0;
}
$ret = $conn->execScript('INSERT INTO user(accountid, game_times, win_times, kills, harm, add_HP, alive_time, kill_his, alive_time_his, harm_his, add_HP_his, coin_num, integral) ' .
' VALUES(:accountid, :game_times, :win_times, :kills, :harm, :add_HP, :alive_time, :kill_his, :alive_time_his, :harm_his, :add_HP_his, :coin_num, :integral);',
array(
':accountid' => $account_id,
':game_times' => 1,
':win_times' => $win_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,
':integral' => $integral
));
if (!$ret) {
die();
return;
}
} else {
if ($row) {
if ($kill_his < $row['kill_his']) {
$kill_his = $row['kill_his'];
}