game/modules_data/_animal.php

236 lines
8.7 KiB
PHP
Raw Normal View History

2022-06-06 21:30:34 +00:00
<?php
echo "
<script language='JavaScript'>
var elem = document.getElementById('se-pre-con');
elem.parentNode.removeChild(elem);
</script>
";
if(!defined('GAME'))
{
die();
}
$err = '';
$an = mysql_fetch_array(mysql_query('SELECT * FROM `users_animal` WHERE `id` = "'.$u->info['animal'].'" LIMIT 1'));
if(!isset($an['id']))
{
2023-01-10 16:29:32 +00:00
echo '<br><br><br><br><center>Зверь не найден...</center>';
2022-06-06 21:30:34 +00:00
}else{
if(isset($_GET['delete']) && $_GET['delete'] == $an['id']) {
2023-01-10 16:29:32 +00:00
echo '<font color="red">Зверь был выгнан...</font>';
2022-06-06 21:30:34 +00:00
mysql_query('UPDATE `users` SET `animal` = "0" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
mysql_query('UPDATE `users_animal` SET `delete` = "'.time().'" WHERE `uid` = "'.$u->info['id'].'" AND `id` = "'.$an['id'].'" AND `delete` = "0" LIMIT 1');
}elseif(isset($_GET['anml_login']) && $an['rename'] == 0) {
$n = 1;
function en_ru($txt)
{
$g = false;
$en = preg_match("/^(([a-zA-Z _-])+)$/i", $txt);
2023-01-10 16:29:32 +00:00
$ru = preg_match("/^(([а-яА-Я _-])+)$/i", $txt);
2022-06-06 21:30:34 +00:00
if(($ru && $en) || (!$ru && !$en))
{
$g = true;
}
return $g;
}
$nl = htmlspecialchars($_GET['anml_login'],NULL);
2022-06-06 21:30:34 +00:00
$nl = str_replace(' ','',$nl);
$nl = str_replace(' ','',$nl);
2023-01-10 16:29:32 +00:00
$sr = "!@#$%^&*()\+Ёё|/'`\"-_";
2022-06-06 21:30:34 +00:00
if($nl == '' || strlen($nl) > 10 || strlen($nl) < 2 || en_ru($nl) == true || strpos($sr,$nl)) {
$n = 0;
}else{
}
if($n == 1) {
mysql_query('UPDATE `users_animal` SET `name` = "'.mysql_real_escape_string($nl).'",`rename` = "1" WHERE `uid` = "'.$u->info['id'].'" AND `id` = "'.$an['id'].'" AND `delete` = "0" LIMIT 1');
$an['rename'] = 1;
2023-01-10 16:29:32 +00:00
echo '<font color="red">Вы успешно переименовали питомца в &quot;'.$nl.'&quot;</font>';
2022-06-06 21:30:34 +00:00
}else{
2023-01-10 16:29:32 +00:00
echo '<font color="red">Эта кличка не подходит</font>';
2022-06-06 21:30:34 +00:00
}
}
$anl = mysql_fetch_array(mysql_query('SELECT `bonus` FROM `levels_animal` WHERE `type` = "'.$an['type'].'" AND `level` = "'.$an['level'].'" LIMIT 1'));
$anl = $anl['bonus'];
$anl = $u->lookStats($anl);
2023-01-10 16:29:32 +00:00
$nam = array(1=>'Кот',2=>'Сова',3=>'Светляк',4=>'Чертяка',5=>'Собака',6=>'Свинья',7=>'Дракон');
2022-06-06 21:30:34 +00:00
$sab = mysql_fetch_array(mysql_query('SELECT * FROM `test_bot` WHERE `login` = "'.$nam[$an['type']].' ['.$an['level'].']" LIMIT 1'));
$sa = $u->lookStats($an['stats']);
$sa['hpAll'] += 30+$sa['s4']*6+$sa['hpAll'];
$ne = '';
if(!isset($ne['id']))
{
$ne['exp'] = '??';
if($an['exp'] < 110) {
$ne['exp'] = '110';
}elseif($an['exp'] < 410) {
$ne['exp'] = '410';
}elseif($an['exp'] < 1300) {
$ne['exp'] = '1300';
}elseif($an['exp'] < 2500) {
$ne['exp'] = '2500';
}elseif($an['exp'] < 5000) {
$ne['exp'] = '5000';
}elseif($an['exp'] < 12500) {
$ne['exp'] = '12500';
}elseif($an['exp'] < 30000) {
$ne['exp'] = '30000';
}elseif($an['exp'] < 300000) {
$ne['exp'] = '300000';
}elseif($an['exp'] < 3000000) {
$ne['exp'] = '3000000';
}elseif($an['exp'] < 10000000) {
$ne['exp'] = '10000000';
}elseif($an['exp'] < 52000000) {
$ne['exp'] = '52000000';
}elseif($an['exp'] < 120000000) {
$ne['exp'] = '120000000';
}
}
if(isset($_GET['obj_corm'])) {
$corm = mysql_fetch_array(mysql_query('SELECT `iu`.*,`im`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON `iu`.`item_id` = `im`.`id` WHERE `im`.`type` = "49" AND `iu`.`delete` = "0" AND `iu`.`inShop` = "0" AND `iu`.`inOdet` = "0" AND `iu`.`inTransfer` = "0" AND `iu`.`id` = "'.mysql_real_escape_string($_GET['obj_corm']).'" LIMIT 1'));
if(isset($corm['id'])) {
2023-01-10 16:29:32 +00:00
//кормушка зверя
2022-06-06 21:30:34 +00:00
$see1 = 1;
if($an['type'] == 3 && substr_count($corm['img'],'wisp') == 0) {
2023-01-10 16:29:32 +00:00
//светляк
2022-06-06 21:30:34 +00:00
$see1 = 0;
}elseif($an['type'] == 2 && substr_count($corm['img'],'owl') == 0) {
2023-01-10 16:29:32 +00:00
//сова
2022-06-06 21:30:34 +00:00
$see1 = 0;
}elseif($an['type'] == 1 && substr_count($corm['img'],'cat') == 0) {
2023-01-10 16:29:32 +00:00
//кот
2022-06-06 21:30:34 +00:00
$see1 = 0;
}elseif($an['type'] == 4 && substr_count($corm['img'],'chrt') == 0) {
2023-01-10 16:29:32 +00:00
//чертяка
2022-06-06 21:30:34 +00:00
$see1 = 0;
}elseif($an['type'] == 5 && substr_count($corm['img'],'dog') == 0) {
2023-01-10 16:29:32 +00:00
//собака
2022-06-06 21:30:34 +00:00
$see1 = 0;
}elseif($an['type'] == 6 && substr_count($corm['img'],'pig') == 0) {
2023-01-10 16:29:32 +00:00
//свинья
2022-06-06 21:30:34 +00:00
$see1 = 0;
}elseif($an['type'] == 7 && substr_count($corm['img'],'dragon') == 0) {
2023-01-10 16:29:32 +00:00
//дракон
2022-06-06 21:30:34 +00:00
$see1 = 0;
}
if($see1 == 1) {
if($an['yad'] > time()) {
2023-01-10 16:29:32 +00:00
$err = '&quot;'.$an['name'].'&quot; отвернулся от еды...';
2022-06-06 21:30:34 +00:00
}elseif($an['eda'] < 50) {
$po = $u->lookStats($corm['data']);
$corm['level'] = $po['tr_lvl'];
if($an['level'] >= $corm['level']) {
$rzc = $an['level']-$corm['level'];
if($rzc <= 0) {
$rzc = 20;
}elseif($rzc == 1) {
$rzc = 16;
}elseif($rzc == 2) {
$rzc = 12;
}elseif($rzc == 3) {
$rzc = 8;
}elseif($rzc >= 4) {
$rzc = 4;
}elseif($rzc >= 5) {
$rzc = 2;
}
$an['eda'] += $rzc;
if($an['eda'] > 50) {
$an['eda'] = 50;
}
mysql_query('UPDATE `users_animal` SET `eda` = "'.$an['eda'].'" WHERE `id` = "'.$an['id'].'" LIMIT 1');
mysql_query('UPDATE `items_users` SET `delete` = "'.time().'" WHERE `id` = "'.mysql_real_escape_string($_GET['obj_corm']).'" LIMIT 1');
2023-01-10 16:29:32 +00:00
$err = 'Ваш питомец был успешно накормлен...';
2022-06-06 21:30:34 +00:00
}else{
2023-01-10 16:29:32 +00:00
$err = 'Ваш питомец пока-что не может употреблять подобную пищу ...';
2022-06-06 21:30:34 +00:00
}
}else{
2023-01-10 16:29:32 +00:00
$err = 'Ваш питомец сыт...';
2022-06-06 21:30:34 +00:00
}
}else{
2023-01-10 16:29:32 +00:00
$err = 'Ваш питомец не употребляет подобную пищу...';
2022-06-06 21:30:34 +00:00
}
}else{
2023-01-10 16:29:32 +00:00
$err = 'Предмет не найден';
2022-06-06 21:30:34 +00:00
}
}
$itmAll = $u->genInv(15,'`iu`.`uid`="'.$u->info['id'].'" AND `iu`.`delete`="0" AND `im`.`type` = "49" AND `iu`.`inOdet`="0" AND `iu`.`inShop`="0" ORDER BY `name` ASC');
if($itmAll[0] != 0) {
$itmAll = $itmAll[2];
}else{
2023-01-10 16:29:32 +00:00
$itmAll = '<tr><td align="center" bgcolor="#e2e0e0">ПУСТО</td></tr>';
2022-06-06 21:30:34 +00:00
}
?>
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td width="350" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="150" align="center" valign="top"><b><?=$an['name']?></b> [<?=$an['level']?>]<br><img src="//img.new-combats.tech/i/obraz/<?=$an['sex']?>/<?=$an['obraz']?>.gif" width="120" height="220"></td>
2022-06-06 21:30:34 +00:00
<td valign="top"><p>HP: <?=$sa['hpAll']?></p>
2023-01-10 16:29:32 +00:00
<p>Сила: <?=$sa['s1']?><br>Ловкость: <?=$sa['s2']?><br>Интуиция: <?=$sa['s3']?><br>Выносливость: <?=$sa['s4']?></p>
<p>Уровень: <?=$an['level']?><br>Опыт: <?=$an['exp']?> / <?=$ne['exp']?><br>
Сытость: <?=$an['eda']?></p>
2022-06-06 21:30:34 +00:00
<p>
2023-01-10 16:29:32 +00:00
Освоенные навыки:<br>
&bull; <i>Отсутствуют</i></p>
2022-06-06 21:30:34 +00:00
<p>
2023-01-10 16:29:32 +00:00
Боевые бонусы:<br>
2022-06-06 21:30:34 +00:00
<?
$ba = '';
$i = 0;
while($i<count($u->items['add'])) {
if(isset($anl['add_'.$u->items['add'][$i]])) {
if( $u->items['add'][$i] == 'mib1' ) {
2023-01-10 16:29:32 +00:00
$ba .= '&bull; Броня головы: +'.$anl['add_'.$u->items['add'][$i]].'<br>';
2022-06-06 21:30:34 +00:00
}elseif( $u->items['add'][$i] == 'mib2' ) {
2023-01-10 16:29:32 +00:00
$ba .= '&bull; Броня корпуса: +'.$anl['add_'.$u->items['add'][$i]].'<br>';
2022-06-06 21:30:34 +00:00
}elseif( $u->items['add'][$i] == 'mib3' ) {
2023-01-10 16:29:32 +00:00
$ba .= '&bull; Броня пояса: +'.$anl['add_'.$u->items['add'][$i]].'<br>';
2022-06-06 21:30:34 +00:00
}elseif( $u->items['add'][$i] == 'mib4' ) {
2023-01-10 16:29:32 +00:00
$ba .= '&bull; Броня ног: +'.$anl['add_'.$u->items['add'][$i]].'<br>';
2022-06-06 21:30:34 +00:00
}elseif( $u->items['add'][$i] == 'mab1' || $u->items['add'][$i] == 'mab2' || $u->items['add'][$i] == 'mab3' || $u->items['add'][$i] == 'mab4') {
}else{
$ba .= '&bull; '.$u->is[$u->items['add'][$i]].': +'.$anl['add_'.$u->items['add'][$i]].'<br>';
}
}
$i++;
}
if($ba == '') {
2023-01-10 16:29:32 +00:00
$ba = '&bull; <i>Отсутствуют</i>';
2022-06-06 21:30:34 +00:00
}
echo $ba;
?>
</p>
</td>
</tr>
</table></td>
<td valign="top">
<div>
2023-03-31 16:54:33 +00:00
<div style="float:left"><?php if($an['rename'] == 0) { ?><input type="button" onclick="top.anren();" value="Кличка" /><?php } ?> <input type="button" onclick="if(confirm('Выгнать зверя?')){top.frames['main'].location='main.php?pet=1&delete=<?=$an['id']?>&rnd=<?=$code?>'}" value="Выгнать" /></div>
2023-01-10 16:29:32 +00:00
<div style="float:right"><input type="button" onclick="top.frames['main'].location='main.php?pet=1&rnd=<?=$code?>'" class="btn" value="Обновить" /> <input type="button" onclick="top.frames['main'].location='main.php?rnd=<?=$code?>'" class="btn" value="Вернуться" /></div>
2022-06-06 21:30:34 +00:00
</div>
<div><br />
<?
if($err != '') {
echo '<br><font color="red"><b>'.$err.'</b></font>';
}
?>
<br />
<table width="100%" style="border:1px solid #9E9E9E">
2023-03-31 16:54:33 +00:00
<?= $itmAll; ?>
2022-06-06 21:30:34 +00:00
</table>
</div>
</td>
</tr>
</table>
2023-03-31 16:54:33 +00:00
<?php } ?>