WIP: new battle

This commit is contained in:
2024-12-10 13:09:03 +02:00
parent 73862ca752
commit d41147da45
18 changed files with 1010 additions and 1111 deletions
+39 -75
View File
@@ -35,8 +35,6 @@ if (
$_GET['events'] = 1;
}
$storage = new ItemStorage();
//Возможности текущего титула
$tt = [
0 => ['000000000', 'Доступные каналы'],
@@ -67,10 +65,10 @@ if ($u->info['clan_prava'] != 'glava') {
mysql_query('SELECT * FROM `clan_tituls` WHERE `id` = "' . $u->info['clan_prava'] . '" LIMIT 1')
);
if (!isset($utitl['id'])) {
$utitl = mysql_fetch_array(mysql_query('SELECT * FROM `clan_tituls` WHERE `id` = 2 LIMIT 1'));
$utitl = mysql_fetch_array(mysql_query('select * from clan_tituls where id = 2 limit 1'));
}
} else {
$utitl = mysql_fetch_array(mysql_query('SELECT * FROM `clan_tituls` WHERE `id` = 1 LIMIT 1'));
$utitl = mysql_fetch_array(mysql_query('select * from clan_tituls where id = 1 limit 1'));
}
if (isset($utitl['id'])) {
@@ -379,18 +377,18 @@ $lvl_prava = [
<script>
function openMod(title, dat) {
var d = document.getElementById('useMagic');
if (d != undefined) {
document.getElementById('modtitle').innerHTML =
'<table width="100%" border="0" cellspacing="0" cellpadding="0">' +
'<tr>' +
'<td valign="top">' + title + '</td>' +
'<td width="30" valign="top">' +
'<div align="right">' +
'<a title="Закрыть" onClick="closeMod(); return false;" href="#">x</a>' +
'</div>' +
'</td>' +
'</tr>' +
'</table>';
if (d) {
document.getElementById('modtitle').innerHTML = `
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td valign="top">${title}</td>
<td width="30" valign="top">
<div align="right">
<a title="Закрыть" onClick="closeMod(); return false;" href="#">x</a>
</div>
</td>
</tr>
</table>`;
document.getElementById('moddata').innerHTML = dat;
d.style.display = '';
}
@@ -398,7 +396,7 @@ $lvl_prava = [
function closeMod() {
var d = document.getElementById('useMagic');
if (d != undefined) {
if (d) {
document.getElementById('modtitle').innerHTML = '';
document.getElementById('moddata').innerHTML = '';
d.style.display = 'none';
@@ -406,61 +404,25 @@ $lvl_prava = [
}
function addNewEvent() {
openMod('Добавить событие',
'<form method="post" action="main.php?clan&events&add=<?=$code?>">" +
"Заголовок: <input name="
titleadd
" value="
" style="
335
px;
" type="
text
"><br>" +
"<textarea name="
textadd
" style="
412
px;
" rows="
5
"></textarea><br>" +
"<div align="
right
"><input type="
submit
" value="
Добавить
событие
"></div>" +
"</form>');
const html = `
<form method="post" action="main.php?clan&events&add=<?=$code?>">
Заголовок: <input name="titleadd" style="335px;" type="text"><br>
<textarea name="textadd" style="412px;" rows="5"></textarea><br>
<div align="right"><input type="submit" value="Добавить событие"></div>
</form>
`;
openMod('Добавить событие', html);
}
function addNewTitul() {
openMod('Добавить титул',
'<form method="post" action="main.php?clan&titul&add=<?=$code?>">" +
"Название титула: <input name="
tituladd
" value="
" style="
235
px;
" type="
text
"><br>" +
"<small style="
left
">(не более 30-ти символов)</small>" +
"<input style="
right
" type="
submit
" value="
Добавить
титул
">" +
"</div>" +
"</form>');
const html = `
<form method="post" action="main.php?clan&titul&add=<?=$code?>">
Название титула: <input name="tituladd" style="235px;" type="text"><br>
<small style="left">(не более 30-ти символов)</small>
<input style="right" type="submit" value="Добавить титул">
</form>
`;
openMod('Добавить титул', html);
}
// С этим мигающим кулаком надо что-то делать..
@@ -527,6 +489,8 @@ if (!$res) {
?>
<?php
$storage = new ItemStorage();
if ($u->info['clan_prava'] != 'glava') {
if (isset($_GET['clan_exit']) && $u->newAct($_GET['sd4']) == true) {
if ($u->info['money'] >= 50) {
@@ -547,7 +511,7 @@ if ($u->info['clan_prava'] != 'glava') {
'UPDATE `users` SET `clan` = 0, `clan_zv` = 0, `align` = 0, `clan_prava` = "0|0|0|0", `money` = `money` - 50 , `clan_delay` = "' . time() . '" WHERE `id` = "' . $u->info['id'] . '" LIMIT 1'
);
}
$ar = $u->rem_itm_cl($u->info, $res['id'], 7);
$storage->remove(7);
} else {
echo '<script>setTimeout("alert(\'Для выхода из клана требуется наличие 50 кр.\');",500)</script>';
}
@@ -1126,7 +1090,7 @@ if ($u->info['clan_prava'] != 'glava') {
} elseif ($usr['clan_prava'] == 'galva' && $u->info['clan_prava'] != 'glava') {
echo '<font color="#FF0000"><b>Игрок старше вас по званию, либо звания совпадают</b></font><br>';
} else {
$ar = $u->rem_itm_cl($usr, $res['id'], 8);
$storage->remove(8);
if ($usr['level'] < 10) {
mysql_query(
'UPDATE `users` SET `clan_prava` = 0, `clan` = 0, `clan_zv` = 0, `mod_zvanie` = "", `align` = 0, `clan_delay` = "0" WHERE `id` = "' . $usr['id'] . '" LIMIT 1'
@@ -2346,7 +2310,7 @@ if ($u->info['clan_prava'] != 'glava') {
if ($u->testBattle($btlud['battle']) == true) {
echo '<font color="#FF0000"><b>Нельзя изымать предметы с персонажа в бою</b></font><br>';
} else {
echo $u->ungive_itm_cl($_GET['ungive_itm'], $u->info, $res['id']);
echo $storage->backToOwner($itm['id']);
}
}
} elseif (isset($_GET['take_itm']) && $tt[4][0] == 1) {
@@ -2357,7 +2321,7 @@ if ($u->info['clan_prava'] != 'glava') {
)
);
if (isset($itm['id'])) {
echo $u->take_itm_cl($_GET['take_itm'], $u->info, $res['id']);
echo $storage->take($itm['id']);
}
} elseif (isset($_GET['give_itm'])) {
$itm = mysql_fetch_array(
@@ -2369,7 +2333,7 @@ if ($u->info['clan_prava'] != 'glava') {
if ($itmc >= $lvl_prava[$res['level']][5]) {
echo '<font color="#FF0000"><b>Хранилище переполнено</b></font><br>';
} elseif (isset($itm['id'])) {
echo $storage->put($_GET['give_itm'], $res['id']);
echo $storage->put($itm['id']);
}
}
if ($tt[4][0] == 1) {
@@ -2421,7 +2385,7 @@ if ($u->info['clan_prava'] != 'glava') {
<?php } elseif (isset($_GET['titul']) && $tt[11][0] == 1) { ?>
<script>
function editTitul(id) {
if ($('#edpnltitul' + id).css('display') == 'none') {
if ($('#edpnltitul' + id).css('display') === 'none') {
$('#edpnltitul' + id).css({'display': ''});
} else {
$('#edpnltitul' + id).css({'display': 'none'});