2018-01-28 16:40:49 +00:00
< ? php
session_start ();
2020-09-29 22:39:06 +00:00
require_once " functions.php " ;
2018-01-28 16:40:49 +00:00
$effect = mysql_fetch_array ( mysql_query ( " SELECT * FROM `effects` WHERE `owner` = ' { $user [ 'id' ] } ' LIMIT 1 " ));
2021-02-01 19:20:23 +00:00
if ( $user -> getRoom () != 31 ) {
2020-10-29 23:30:05 +00:00
exit ( 'Для распределения статов необходимо находиться в прихожей "Башни смерти"' );
}
if ( isset ( $effect [ 'id' ])) {
exit ( 'Для распределения статов на В а с не дожно быть никаких эффектов' );
}
2021-03-11 18:58:38 +00:00
\Battles\DressedItems :: undressAllItems ( $user [ 'id' ]);
2018-01-28 16:40:49 +00:00
2020-10-29 23:30:05 +00:00
if (( int ) $_GET [ 'delsn' ] > 0 ) {
mysql_query ( " DELETE FROM `deztow_charstams` WHERE `id` = ' " . ( int ) $_GET [ 'delsn' ] . " ' AND `name` = ' " . $_GET [ 'ddname' ] . " ' AND `owner` = ' " . ( int ) $user [ 'id' ] . " ' LIMIT 1 " );
2018-01-28 16:40:49 +00:00
}
2020-10-29 23:30:05 +00:00
if ( $_POST [ 'name' ]) {
$stats = 83 ;
2018-01-28 16:40:49 +00:00
2020-10-29 23:30:05 +00:00
if ( $stats == abs ( $_POST [ 'sila' ]) + abs ( $_POST [ 'lovk' ]) + abs ( $_POST [ 'inta' ]) + abs ( $_POST [ 'vinos' ]) + abs ( $_POST [ 'intel' ])) {
mysql_query ( " INSERT `deztow_charstams` (`owner`, `name`, `sila`, `lovk`, `inta`, `vinos`, `intel`) VALUES (' " . $user [ 'id' ] . " ', ' " . $_POST [ 'name' ] . " ', ' " . abs ( $_POST [ 'sila' ]) . " ', ' " . abs ( $_POST [ 'lovk' ]) . " ', ' " . abs ( $_POST [ 'inta' ]) . " ', ' " . abs ( $_POST [ 'vinos' ]) . " ', ' " . abs ( $_POST [ 'intel' ]) . " ') ON DUPLICATE KEY UPDATE `sila` = ' " . abs ( $_POST [ 'sila' ]) . " ', `lovk` = ' " . abs ( $_POST [ 'lovk' ]) . " ', `inta` = ' " . abs ( $_POST [ 'inta' ]) . " ', `vinos` = ' " . abs ( $_POST [ 'vinos' ]) . " ', `intel` = ' " . abs ( $_POST [ 'intel' ]) . " ' " );
echo " <font color=red><b>Сохранено!</b></font> " . mysql_error ();
} else {
echo " <font color=red><b>Что-то не то с о статами... сумму проверьте. Необходимо использовать все статы!</b></font> " ;
}
2018-01-28 16:40:49 +00:00
}
2020-10-29 23:30:05 +00:00
$tec = mysql_fetch_array ( mysql_query ( " SELECT `id`, `owner`, `name`, `sila`, `lovk`, `inta`, `vinos`, `intel`, `mudra`, `def` FROM `deztow_charstams` WHERE `owner` = ' { $user [ 'id' ] } ' AND `id` = ' " . ( int ) $_GET [ 'id' ] . " ' LIMIT 1 " ));
2018-01-28 16:40:49 +00:00
2020-10-29 23:30:05 +00:00
if ( ! isset ( $tec [ 'id' ])) {
$tec [ 'sila' ] = 3 ;
$tec [ 'lovk' ] = 3 ;
$tec [ 'inta' ] = 3 ;
$tec [ 'vinos' ] = 10 ;
$tec [ 'intel' ] = 0 ;
2018-01-28 16:40:49 +00:00
}
2020-10-29 23:30:05 +00:00
if ( $_GET [ 'setdef' ]) {
mysql_query ( " UPDATE `deztow_charstams` SET `def` = 1 WHERE `owner` = ' { $user [ 'id' ] } ' AND `id` = " . ( int ) $_GET [ 'setdef' ] . " LIMIT 1 " );
mysql_query ( " UPDATE `deztow_charstams` SET `def` = 0 WHERE `owner` = ' { $user [ 'id' ] } ' AND `id` != " . ( int ) $_GET [ 'setdef' ] . " " );
echo " <font color=red><b>Сохранено.</b></font> " . mysql_error ();
2018-01-28 16:40:49 +00:00
}
2020-09-30 19:12:34 +00:00
2020-10-28 20:21:08 +00:00
\Battles\Template :: header ( 'towerstamp' );
2018-01-28 16:40:49 +00:00
?>
2020-10-29 23:30:05 +00:00
< h3 > Профили характеристик </ h3 >
Статы не позволяют сходить в БС ? Раскиньте ваши статы так , как вы хотите , и участвуйте в турнире ! Выбранный по умолчанию профиль , загрузится сам . Вы можете создавать неограниченное число профилей , и менять их за секунды до турнира !
< br />< br />
< table width = 100 % bordercolor = silver border = 1 cellpadding = 0 cellspacing = 0 >
2018-01-28 16:40:49 +00:00
< tr bgcolor = silver >
2020-10-29 23:30:05 +00:00
< td > Название </ td >
< td width = 25 %> По ум .</ td >
< td > Удалить </ td >
</ tr >
< ? php
$data = mysql_query ( " SELECT `id`, `name`, `def` FROM `deztow_charstams` WHERE `owner` = ' { $user [ 'id' ] } ' " );
while ( $row = mysql_fetch_array ( $data )) {
echo " <tr onclick='location.href= \" towerstamp.php?id= { $row [ 'id' ] } \" ;' style='cursor: hand;'><td><b> { $row [ 'name' ] } </b></td><td><a href='?setdef= " . ( $row [ 'def' ] ? " " : $row [ 'id' ]) . " '> " . ( $row [ 'def' ] ? " <font color=red>По умолчанию</font> " : " Установить " ) . " </a></td><td><a href='?delsn= " . $row [ 'id' ] . " &ddname= " . $row [ 'name' ] . " ' title= \" Удалить набор \" >X</a></td></tr> \n " ;
}
?>
</ table >< br />
< input type = " button " value = " Обновить " onclick = " window.location.href='towerstamp.php'; " />
< script >
function countall () {
document . all [ 'stats' ] . value = 83 - Math . abs ( document . all [ 'sila' ] . value ) - Math . abs ( document . all [ 'lovk' ] . value ) - Math . abs ( document . all [ 'inta' ] . value ) - Math . abs ( document . all [ 'vinos' ] . value ) - Math . abs ( document . all [ 'intel' ] . value );
}
2018-01-28 16:40:49 +00:00
function check_stats () {
2019-01-16 17:45:30 +00:00
const stats = document . getElementById ( 'stats' ) . value ;
const sila = document . getElementById ( 'sila' ) . value ;
const lovk = document . getElementById ( 'lovk' ) . value ;
const inta = document . getElementById ( 'inta' ) . value ;
const vinos = document . getElementById ( 'vinos' ) . value ;
2020-10-29 23:30:05 +00:00
if ( stats != 0 ) {
alert ( 'Проверьте количество распределенных статов' );
} else if ( sila < 3 ) {
alert ( 'Сила не может быть меньше 3 ...' );
} else if ( lovk < 3 ) {
alert ( 'Ловкость не может быть меньше 3 ...' );
} else if ( inta < 3 ) {
alert ( 'Интуиция не может быть меньше 3 ...' );
} else if ( vinos < 3 ) {
alert ( 'Выносливость не может быть меньше 3 ...' );
} else {
document . getElementById ( 'sub' ) . submit ();
}
2018-01-28 16:40:49 +00:00
}
2020-10-29 23:30:05 +00:00
</ script >
< form method = " POST " id = " sub " >
Назв .: < input type = " text " name = " name " value = " <?= $tec['name'] ?> " />
< table cellpadding = 0 cellspacing = 0 >
< tr bgcolor = silver >
< td > Характеристика & nbsp ; </ td >
< td > Знач .</ td >
</ tr >
< tr >
< td > Сила </ td >
< td >< input type = " text " id = " sila " size = " 4 " onblur = " countall(); " value = " <?= $tec['sila'] ?> " name = " sila " />
</ td >
</ tr >
< tr >
< td > Ловкость </ td >
< td >< input type = " text " id = " lovk " size = " 4 " onblur = " countall(); " value = " <?= $tec['lovk'] ?> " name = " lovk " />
</ td >
</ tr >
< tr >
< td > Интуиция </ td >
< td >< input type = " text " id = " inta " size = " 4 " onblur = " countall(); " value = " <?= $tec['inta'] ?> " name = " inta " />
</ td >
</ tr >
< tr >
< td > Выносливость </ td >
< td >< input type = " text " id = " vinos " size = " 4 " onblur = " countall(); " value = " <?= $tec['vinos'] ?> " name = " vinos " />
</ td >
</ tr >
< tr >
< td > Интеллект </ td >
< td >< input type = " text " id = " intel " size = " 4 " onblur = " countall(); " value = " <?= $tec['intel'] ?> " name = " intel " />
</ td >
</ tr >
< tr >
< td > Свободных </ td >
< td >< input type = " text " id = " stats " name = " stats " size = " 4 " disabled = " disabled " value = " 64 " /></ td >
</ tr >
</ table >
< input type = " button " onclick = " check_stats() " value = " Сохранить/изменить " />
</ form >