game/modules_data/titul.php

171 lines
6.1 KiB
PHP
Raw Normal View History

2022-07-01 12:45:43 +00:00
<?php
use Insallah\Achievements;
use Insallah\Db;
if (!defined('GAME')) {
die();
2022-06-06 21:30:34 +00:00
}
2022-07-01 12:45:43 +00:00
if (empty($u)) {
$u = user::start();
2022-06-06 21:30:34 +00:00
}
2022-07-01 12:45:43 +00:00
$a = new Achievements($u);
$ai = $a->getCheckedInfo();
2022-06-06 21:30:34 +00:00
2022-07-01 12:45:43 +00:00
if (isset($_GET['nagr'])) {
$nagrtxt = 'За выполненное достижение Вы получили ';
if ($a->hasNoTier4Access($_GET['nagr'])) {
$nagrtxt = 'Вы не можете получить эту награду на этом уровне!';
} elseif ( //бабка задание zb
in_array($_GET['nagr'], [11, 12, 13, 14, 15]) &&
in_array($ai['zb_n'], [0, 1, 2, 3, 4]) &&
$ai['klaszb'] > $ai['zb_n']
) {
$ai['zb_n'] += 1;
$a->updateTier('zb');
$a->givePrizeItems(10020, 'zb');
$nagrtxt .= 'Жетон успеха X' . $a->getData()['zb']['prize'][$ai['zb_n']];
} elseif ( //Хаот задание vx
in_array($_GET['nagr'], [21, 22, 23, 24, 25]) &&
in_array($ai['vx_n'], [0, 1, 2, 3, 4]) &&
$ai['klasvx'] > $ai['vx_n']
) {
$ai['vx_n'] += 1;
$a->updateTier('vx');
$u->addEkr($a->getData()['vx']['prize'][$ai['vx_n']]);
$nagrtxt .= $a->getData()['vx']['prize'][$ai['vx_n']] . $a->getData()['vx']['prize'][0];
} elseif ( //Сундуки трупожора snt
in_array($_GET['nagr'], [31, 32, 33, 34, 35]) &&
in_array($ai['snt_n'], [0, 1, 2, 3, 4]) &&
$ai['klassnt'] > $ai['snt_n']
) {
$ai['snt_n'] += 1;
$a->updateTier('snt');
$u->addEkr($a->getData()['snt']['prize'][$ai['snt_n']]);
$nagrtxt .= $a->getData()['snt']['prize'][$ai['snt_n']] . $a->getData()['snt']['prize'][0];
} elseif ( //Руны 8 лвл. rp
in_array($_GET['nagr'], [41, 42, 43, 44, 45]) &&
in_array($ai['rp_n'], [0, 1, 2, 3, 4]) &&
$ai['klasrp'] > $ai['rp_n']
) {
$ai['rp_n'] += 1;
$a->updateTier('rp');
$a->givePrizeItems(10038, 'rp');
$nagrtxt .= 'Плохие Заготовки X' . $a->getData()['rp']['prize'][$ai['rp_n']];
} elseif ( //Руны 9 лвл. rn
in_array($_GET['nagr'], [51, 52, 53, 54, 55]) &&
in_array($ai['rn_n'], [0, 1, 2, 3, 4]) &&
$ai['klasrn'] > $ai['rn_n']
) {
$ai['rn_n'] += 1;
$a->updateTier('rn');
$a->givePrizeItems(10039, 'rn');
$nagrtxt .= 'Нормальные Заготовки X' . $a->getData()['rn']['prize'][$ai['rn_n']];
} elseif ( //Руны 10 лвл. rb
in_array($_GET['nagr'], [61, 62, 63, 64, 65]) &&
in_array($ai['rb_n'], [0, 1, 2, 3, 4]) &&
$ai['klasrb'] > $ai['rb_n']
) {
$ai['rb_n'] += 1;
$a->updateTier('rb');
$a->givePrizeItems(10040, 'rb');
$nagrtxt .= 'Идеальные Заготовки X' . $a->getData()['rb']['prize'][$ai['rb_n']];
} elseif ( //Героик pg
in_array($_GET['nagr'], [71, 72, 73, 74, 75]) &&
in_array($ai['pg_n'], [0, 1, 2, 3, 4]) &&
$ai['klaspg'] > $ai['pg_n']
) {
$ai['pg_n'] += 1;
$a->updateTier('pg');
$a->givePrizeItems(10020, 'pg');
$nagrtxt .= 'Жетон Успеха X' . $a->getData()['pg']['prize'][$ai['pg_n']];
} elseif ( //Продать бабушке найденные вещи в пещере bv
in_array($_GET['nagr'], [81, 82, 83, 84, 85]) &&
in_array($ai['bv_n'], [0, 1, 2, 3, 4]) &&
$ai['klasbv'] > $ai['bv_n']
) {
$ai['bv_n'] += 1;
$a->updateTier('bv');
$u->addKr($a->getData()['bv']['prize'][$ai['bv_n']]);
$nagrtxt .= $a->getData()['bv']['prize'][$ai['bv_n']] . $a->getData()['bv']['prize'][0];
} elseif ( //Клан вар kw
in_array($_GET['nagr'], [91, 92, 93, 94, 95]) &&
in_array($ai['kw_n'], [0, 1, 2, 3, 4]) &&
$ai['klaskw'] > $ai['kw_n']
) {
$ai['kw_n'] += 1;
$a->updateTier('kw');
$a->givePrizeItems(4917, 'kw');
$nagrtxt .= 'Клановый опыт +50000 X' . $a->getData()['kw']['prize'][$ai['kw_n']];
} elseif ( //Башня смерти задание bs
in_array($_GET['nagr'], [101, 102, 103, 104, 105]) &&
in_array($ai['bs_n'], [0, 1, 2, 3, 4]) &&
$ai['klasbs'] > $ai['bs_n']
) {
$ai['bs_n'] += 1;
$a->updateTier('bs');
$u->addEkr($a->getData()['bs']['prize'][$ai['bs_n']]);
$nagrtxt .= $a->getData()['bs']['prize'][$ai['bs_n']] . $a->getData()['bs']['prize'][0];
} elseif ( //Турниры победы trn
in_array($_GET['nagr'], [111, 112, 113, 114, 115]) &&
in_array($ai['trn_n'], [0, 1, 2, 3, 4]) &&
$ai['klastrn'] > $ai['trn_n']
) {
$ai['trn_n'] += 1;
$a->updateTier('trn');
$u->addEkr($a->getData()['trn']['prize'][$ai['trn_n']]);
$nagrtxt .= $a->getData()['trn']['prize'][$ai['trn_n']] . $a->getData()['trn']['prize'][0];
}
//Тоже бы вынести в класс чата.
Db::sql('insert into chat (new, city, room, `to`, `text`, `time`, type) values (?,?,?,?,?,?,?)',
[1, $u->info['city'], $u->info['room'], $u->info['login'], $nagrtxt, -1, 6]);
}
2022-06-06 21:30:34 +00:00
?>
2022-07-01 12:45:43 +00:00
<style>
/* for table() function */
table.prizelist {
border-spacing: 1px;
border-collapse: separate;
min-width: 600px;
}
table.prizelist tr {
background-color: #C7C7C7;
}
table.prizelist td {
padding: 3px;
text-align: center;
}
table.prizelist td:first-child {
width: 100px;
}
table.prizelist tr:first-child,
table.prizelist td:first-child {
background-color: #a5a5a5;
}
</style>
<div style="text-align: right;">
<input class="btn" type="button" value="Подсказка"
onclick="window.open('/encicl/help/titul.html', 'help', 'height=300,width=500,location=no,menubar=no,status=no,toolbar=no,scrollbars=yes')">
<input class="btn" type="button" value="Вернуться" onClick="top.frames['main'].location = 'main.php';" name=edit>
</div>
<H3>Достижения</H3>
<?= $a->getList(); ?>
<script>
let elem = document.getElementById('se-pre-con');
elem.parentNode.removeChild(elem);
</script>