const elem = document.getElementById('se-pre-con');elem.parentNode.removeChild(elem);"; if (!defined('GAME')) { die(); } $slot = mysql_fetch_array(mysql_query('SELECT * FROM `users_animal_slot` WHERE `uid` = "' . $u->info['id'] . '" LIMIT 1')); if (!isset($slot['id'])) { if (mysql_query('INSERT INTO `users_animal_slot` ( `uid`,`slots`,`ekr` ) VALUES ( "' . $u->info['id'] . '","2","0" )')) { $slot = mysql_fetch_array(mysql_query('SELECT * FROM `users_animal_slot` WHERE `uid` = "' . $u->info['id'] . '" LIMIT 1')); } else { $u->error = 'Ошибка в работе базы данных...'; } } $slot['price_next'] = 5; $petox = mysql_fetch_array(mysql_query('SELECT * FROM `obraz_pet` WHERE `uid` = "' . $u->info['id'] . '" LIMIT 1')); $petox = $petox[0]; $an_eda = [ 0.05, 0.07, 0.10, 0.15, 0.20, 0.30, 0.40, 0.50, 0.60, 0.70, 0.80, 1.00, 1.50, 2.00, 2.50, 3.00, 3.50, 4.00, 4.50, 5.00, 5.50, 7.00, ]; if (isset($_GET['buy_slot'])) { if ($u->info['money2'] < $slot['price_nex']) { $u->error = 'Недостаточно денег'; } elseif ($u->info['money2'] < 5) { $u->error = 'Недостаточно екр!'; } elseif (isset($slot['id']) && $slot['slots'] < 7) { $slot['slots']++; $u->info['money2'] -= 5; mysql_query('UPDATE `users_animal_slot` SET `slots` = "' . $slot['slots'] . '" WHERE `id` = "' . $slot['id'] . '" LIMIT 1'); mysql_query('UPDATE `users` SET `money2` = "' . $u->info['money2'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); $u->error = 'Куплен слот для зверя.'; } else { $u->error = 'Нельзя купить больше слотов'; } } elseif (isset($_GET['pet'])) { $newpetname = (new \Validator\Login())->setLogin($_GET['petname'])->get(); $_GET['pet'] = round((int)$_GET['pet']); $ax = mysql_fetch_array(mysql_query('SELECT COUNT(*) FROM `users_animal` WHERE `uid` = "' . $u->info['id'] . '" AND `delete` = 0 LIMIT 1')); $ax = $ax[0]; if ($_GET['pet'] < 1 || $_GET['pet'] > 7) { $u->error = 'Нельзя привзвать такого зверя'; } elseif ($ax >= $slot['slots']) { $u->error = 'Нет свободных слотов для зверя'; } elseif ($u->info['money'] < 50) { $u->error = 'Недостаточно денег'; } elseif (!empty($_GET['petname']) && !$newpetname) { $u->error = 'Неверная кличка зверя, выберите другую'; } else { $u->error = 'Зверь пришел к Вам!'; $u->addKr(-50); // $anm['type'] = $_GET['pet']; // if ($anm['type'] == 1) { $anm['name'] = 'Кот'; $anm['sex'] = 0; $anm['obraz'] = [1 => '20864.gif', 2 => '21301.gif', 3 => '21139.gif', 4 => '20427.gif']; $anm['stats'] = 's1=2|s2=5|s3=2|s4=5|rinv=40|m9=5|m6=10'; } elseif ($anm['type'] == 2) { $anm['name'] = 'Сова'; $anm['sex'] = 1; $anm['obraz'] = [1 => '21415.gif', 2 => '21722.gif', 3 => '21550.gif']; $anm['stats'] = 's1=2|s2=2|s3=5|s4=5|rinv=40|m9=5|m6=10'; } elseif ($anm['type'] == 3) { $anm['name'] = 'Светляк'; $anm['sex'] = 0; $anm['obraz'] = [1 => '22277.gif', 2 => '22265.gif', 3 => '22333.gif', 4 => '22298.gif']; $anm['stats'] = 's1=3|s2=10|s3=3|s4=4|rinv=40|m9=5|m6=10'; } elseif ($anm['type'] == 4) { $anm['name'] = 'Чертяка'; $anm['sex'] = 0; $anm['obraz'] = [1 => '22177.gif', 2 => '21976.gif', 3 => '21877.gif']; $anm['stats'] = 's1=25|s2=3|s3=3|s4=25|rinv=40|m9=5|m6=10'; } elseif ($anm['type'] == 5) { $anm['name'] = 'Пес'; $anm['sex'] = 0; $anm['obraz'] = [1 => '22352.gif', 2 => '23024.gif', 3 => '22900.gif', 4 => '22501.gif', 5 => '22700.gif']; $anm['stats'] = 's1=5|s2=3|s3=3|s4=5|rinv=40|m9=5|m6=10'; } elseif ($anm['type'] == 6) { $anm['name'] = 'Свин'; $anm['sex'] = 0; $anm['obraz'] = [1 => '24000.gif', 2 => '25000.gif', 3 => '27000.gif', 4 => '28000.gif']; $anm['stats'] = 's1=5|s2=3|s3=3|s4=5|rinv=40|m9=5|m6=10'; } elseif ($anm['type'] == 7) { $anm['name'] = 'Дракон'; $anm['sex'] = 0; $anm['obraz'] = [1 => '21338_pgtpdbx.gif']; $anm['stats'] = 's1=5|s2=3|s3=3|s4=5|rinv=40|m9=5|m6=10'; } // if (!empty($_GET['petname'])) { $anm['name'] = htmlspecialchars($newpetname, null); } // $anm['obraz'] = $anm['obraz'][rand(1, count($anm['obraz']))]; $anm['obraz'] = str_replace('.gif', '', $anm['obraz']); $anm['obraz'] = str_replace('.jpg', '', $anm['obraz']); $anm['obraz'] = str_replace('.png', '', $anm['obraz']); $ins = mysql_query( 'INSERT INTO `users_animal` (`type`,`name`,`uid`,`obraz`,`stats`,`sex`,`eda`) VALUES ("' . $anm['type'] . '","' . $anm['name'] . '","' . $u->info['id'] . '","' . $anm['obraz'] . '","' . $anm['stats'] . '","' . $anm['sex'] . '","0")' ); if ($ins) { Delo::add( 1, 'System.inventory', $u->info['id'], '"System.inventory": Персонаж призвал зверя "' . $newpetname . '" (' . $_GET['pet'] . ') - 50 кр.', ); } else { $u->error = 'Не удалось призвать зверя, что-то здесь не так ...'; } // } // } elseif (isset($_GET['eda'])) { $anm = mysql_fetch_array(mysql_query('SELECT * FROM `users_animal` WHERE `id` = "' . mysql_real_escape_string($_GET['eda']) . '" AND `uid` = "' . $u->info['id'] . '" AND `delete` = 0 LIMIT 1')); $x = round((int)$_GET['vvv']); if ($x > 100 - $anm['eda']) { $x = 100 - $anm['eda']; } if ($x < 1) { $x = 1; } if ($x > 100) { $x = 100; } if (!isset($anm['id'])) { $u->error = 'Зверь не найден.'; } elseif ($anm['eda'] >= 100) { $u->error = 'Зверь сыт и не нуждается в еде.'; } elseif ($an_eda[$anm['level']] * $_GET['vvv'] > $u->info['money']) { $u->error = 'Недостаточно денег.'; } else { $u->error = 'Покормили зверя "' . $anm['name'] . '" на ' . $x . ' ед. за ' . ($x * $an_eda[$anm['level']]) . ' кр.'; $u->info['money'] -= ($x * $an_eda[$anm['level']]); $anm['eda'] += $x; mysql_query('UPDATE `users` SET `money` = "' . $u->info['money'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); mysql_query('UPDATE `users_animal` SET `eda` = "' . $anm['eda'] . '" WHERE `id` = "' . $anm['id'] . '" LIMIT 1'); } } elseif (isset($_GET['pet_del'])) { if (mysql_query( 'UPDATE `users_animal` SET `delete` = "' . time() . '" WHERE `id` = "' . mysql_real_escape_string($_GET['pet_del']) . '" AND `delete` = 0 AND `uid` = "' . $u->info['id'] . '" LIMIT 1' )) { $u->error = 'Зверь был выгнан.'; } else { $u->error = 'Зверь не найден.'; } } elseif (isset($_GET['rename'])) { $anm = mysql_fetch_array( mysql_query('SELECT * FROM `users_animal` WHERE `id` = "' . mysql_real_escape_string($_GET['rename']) . '" AND `uid` = "' . $u->info['id'] . '" AND `delete` = 0 LIMIT 1') ); $_GET['vvv'] = htmlspecialchars($_GET['vvv'], null); if (!isset($anm['id'])) { $u->error = 'Зверь не найден.'; } elseif (30 > $u->info['money']) { $u->error = 'Недостаточно денег.'; } else { $u->info['money'] -= 30; $anm['name'] = preg_replace('/\W/', '', $_GET['vvv']); //$_GET['vvv']; $u->error = 'Кличка зверя изменена на "' . $anm['name'] . '" за 30 кр.'; mysql_query('UPDATE `users` SET `money` = "' . $u->info['money'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'); mysql_query('UPDATE `users_animal` SET `name` = "' . mysql_real_escape_string($anm['name']) . '" WHERE `id` = "' . mysql_real_escape_string($anm['id']) . '" LIMIT 1'); } } elseif (isset($_GET['shadow']) && $petox > 0) { if (isset($_GET['rechange'])) { $u->error = 'Образ питомца снят.'; mysql_query('UPDATE `obraz_pet` SET `use` = 0 WHERE `uid` = "' . $u->info['id'] . '"'); } elseif (isset($_GET['change'])) { $u->error = 'Образ питомца установлен.'; mysql_query('UPDATE `obraz_pet` SET `use` = 0 WHERE `uid` = "' . $u->info['id'] . '"'); mysql_query('UPDATE `obraz_pet` SET `use` = 1 WHERE `uid` = "' . $u->info['id'] . '" AND `id` = "' . mysql_real_escape_string($_GET['change']) . '" LIMIT 1'); } } ?>
';
$sp = mysql_query('SELECT * FROM `obraz_pet` WHERE `uid` = "' . $u->info['id'] . '"');
while ($pl = mysql_fetch_array($sp)) {
echo ' ';
//
echo ' ';
}
echo '';
if ($pl['use'] == 0) {
echo '';
} else {
echo '';
}
echo ' ';
//
echo ' | ';
} else {
$sp = mysql_query('SELECT * FROM `users_animal` WHERE `uid` = "' . $u->info['id'] . '" AND `delete` = 0 LIMIT 6');
$i = 1;
while ($pl = mysql_fetch_array($sp)) {
//
if (isset($_GET['selected']) && $pl['id'] == $_GET['selected']) {
if ($u->info['animal'] != $pl['id']) {
$u->info['animal'] = $pl['id'];
} else {
$u->info['animal'] = 0;
}
mysql_query('UPDATE `users` SET `animal` = "' . $u->info['animal'] . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1');
}
//
//$kp = 0.05; //цена корма
$kp = $an_eda[$pl['level']];
//
echo '';
//
echo ' ';
//
echo '';
//
echo ' ';
echo 'Уровень: ' . $pl['level'] . ' ';
//
echo 'Опыт: ' . $pl['exp'] . ' Сытность: ' . $pl['eda'] . '/100 '; // echo '= 100) { echo ' disabled="disabled" '; } else { echo ' onclick="top.eda(' . $pl['id'] . ',\'' . $pl['name'] . '\',' . (0 + $kp) . ',' . (0 + 100 - $pl['eda']) . ');" '; } echo 'type="button" value="Покормить" class="btn an_w120'; if ($pl['eda'] < 1) { echo ' btn-danger'; } echo '">'; // if ($pl['id'] != $u->info['animal'] || (isset($_GET['selected']) && $pl['id'] != $_GET['selected'])) { echo ''; } else { echo ''; } // echo ' | ';
$i++;
}
if ($i <= 6) {
$j = 0;
while ($i <= 6) {
if ($i <= $slot['slots']) {
echo '