Файл: public_html/core/campaign.func.php
Строк: 47
<?php
function campaignUpdatePassing($uId, $chapter, $quest, $count)
{
global $db;
$userInfo = $db->query("SELECT * FROM `users` WHERE `id` = '".$uId."'")->fetch_object();
if($userInfo->campaign_chapter == $chapter)
{
$questInfo = $db->query("SELECT * FROM `campaign_user` WHERE `quest` = '".$quest."' AND `chapter` = '".$chapter."' AND `user` = '".$uId."'")->fetch_object();
if($questInfo->count < 1) $db->query("UPDATE `campaign_user` SET `count` = '".$count."' WHERE `user` = '".$uId."' AND `chapter` = '".$chapter."' AND `quest` = '".$quest."'");
}
return true;
}
//Quest2_1
$subject2_1 = $db->query("SELECT * FROM `subject` WHERE `name` = 'Шлем десятника'")->fetch_object();
$inventorySubject2_1 = $db->query("SELECT * FROM `inventory` WHERE `user` = '".$u['id']."' AND `item` = '".$subject2_1->id."'")->num_rows;
if($inventorySubject2_1 > 0) campaignUpdatePassing($u['id'], 2, 1, 1);
//Quest2_2
if($u['head_slot_level'] >= 3 || $u['body_slot_level'] >= 3 || $u['boots_slot_level'] >= 3 || $u['weapon_slot_level'] >= 3) campaignUpdatePassing($u['id'], 2, 2, 1);
//Quest3_1
$subject3_1 = $db->query("SELECT * FROM `subject` WHERE `name` = 'Копье метателя'")->fetch_object();
$inventorySubject3_1 = $db->query("SELECT * FROM `inventory` WHERE `user` = '".$u['id']."' AND `item` = '".$subject3_1->id."'")->num_rows;
if($inventorySubject3_1 > 0) campaignUpdatePassing($u['id'], 3, 1, 1);
//Quest5_2
if($u['boots_slot_level'] >= 4) campaignUpdatePassing($u['id'], 5, 2, 1);
//Quest6_3
if($u['weapon_slot_level'] >= 9) campaignUpdatePassing($u['id'], 6, 3, 1);
//Quest8_2
if($u['head_slot_level'] >= 14) campaignUpdatePassing($u['id'], 8, 2, 1);