Вход Регистрация
Файл: www/skills.php
Строк: 186
<?php

include 'inc/mysql.php';

include 
'inc/check.php';

include 
'inc/functions.php';

top();

include 
'inc/account.php';
 
$titlestr='Умения';
include 
'inc/interface.php';

if(isset(
$_SESSION['auth']) && $_SESSION['auth']==1){

echo 
'
<div class="title">
Умения
</div>
'
;
echo 
'<div class="help">';
echo 
'Очки умений: '.mysql_result(mysql_query("SELECT `skill_point` FROM `account` WHERE `id`='".$account['id']."'"),0).'</div>';
if (isset(
$_GET['skill']) && is_numeric($_GET['skill'])){
    
$skill=intval($_GET['skill']);
    if (
mysql_result(mysql_query("SELECT COUNT(*) FROM `skills` WHERE `id`='".$skill."' AND `class`='".$account['class']."' AND `specialization`='".$account['specialization']."'"),0)){
        
$skill=mysql_fetch_assoc(mysql_query("SELECT * FROM `skills` WHERE `id`='".$skill."'  AND `class`='".$account['class']."' AND `specialization`='".$account['specialization']."'"));
        if (
mysql_result(mysql_query("SELECT COUNT(*) FROM `skill` WHERE `ident_id`='".$skill['ident_id']."' AND `account`='".$account['id']."'"),0)){
            
$skilladd=mysql_fetch_assoc(mysql_query("SELECT * FROM `skill` WHERE `ident_id`='".$skill['ident_id']."' AND `account`='".$account['id']."'"));
            if (
$skill['min_lvl']>$account['lvl'] OR !$account['skill_point']){
                
header("Location: ?");
                exit;
            }elseif(
$skilladd['lvl']!=$skill['lvl']-1){
                
header("Location: ?");
                exit;
            }else{
                
mysql_query("DELETE FROM `skill` WHERE `id`='".$skilladd['id']."'");
                
mysql_query("INSERT INTO `skill` VALUES(
                    `id`,
                    '"
.$skill['name']."',
                    '"
.$skill['class']."',
                    '"
.$skill['specialization']."',
                    '"
.$skill['damage']."',
                    '"
.$skill['heal']."',
                    '"
.$skill['fear']."',
                    '"
.$skill['stun']."',
                    '"
.$skill['sleep']."',
                    '"
.$skill['paralich']."',
                    '"
.$skill['effect_damage']."',
                    '"
.$skill['effect_hp_regen']."',
                    '"
.$skill['no_fear']."',
                    '"
.$skill['no_stun']."',
                    '"
.$skill['no_sleep']."',
                    '"
.$skill['no_paralich']."',
                    '"
.$skill['about']."',
                    '"
.$skill['hp_regen_percent']."',
                    '"
.$skill['effect_hp_regen_percent']."',
                    '"
.$account['id']."',
                    '"
.$skill['type']."',
                    '"
.$skill['res_time']."',
                    '0',
                    '"
.$skill['icon']."',
                    '"
.$skill['effect_time']."',
                    '"
.$skill['effect_every_sec']."',
                    '"
.$skill['dota']."',
                    '"
.$skill['baph']."',
                    '"
.$skill['baph_adding']."',
                    '"
.$skill['baph_will']."',
                    '"
.$skill['baph_reaction']."',
                    '"
.$skill['baph_max_hp']."',
                    '"
.$skill['baph_max_mp']."',
                    '"
.$skill['baph_feature_armor_weapon']."',
                    '"
.$skill['baph_feature_armor_arrow']."',
                    '"
.$skill['baph_feature_armor_magic']."',
                    '"
.$skill['baph_feature_attack_weapon']."',
                    '"
.$skill['baph_feature_attack_arrow']."',
                    '"
.$skill['baph_feature_attack_magic']."',
                    '"
.$skill['baph_hp_regen']."',
                    '"
.$skill['baph_mp_regen']."',
                    '"
.$skill['baph_power']."',
                    '"
.$skill['baph_wit']."',
                    '"
.$skill['baph_dexterity']."',
                    '"
.$skill['baph_vitality']."',
                    '"
.$skill['baph_spirit']."',
                    '"
.$skill['debaph']."',
                    '"
.$skill['ident_id']."',
                    '"
.$skill['mp_need_from_cast']."',
                    '"
.$skill['lvl']."'
                    )"
) or die('<div class="err">'.mysql_error().'</div>');
                    
mysql_query("UPDATE `account` SET `skill_point`='".($account['skill_point']-1)."' WHERE `id`='".$account['id']."'");
                    
header("Location: ?");
                    exit;
            }
        }else{
            if (
$skill['min_lvl']>$account['lvl'] OR !$account['skill_point']){
                
header("Location: ?");
                exit;
            }else{
                
mysql_query("INSERT INTO `skill` VALUES(
                    `id`,
                    '"
.$skill['name']."',
                    '"
.$skill['class']."',
                    '"
.$skill['specialization']."',
                    '"
.$skill['damage']."',
                    '"
.$skill['heal']."',
                    '"
.$skill['fear']."',
                    '"
.$skill['stun']."',
                    '"
.$skill['sleep']."',
                    '"
.$skill['paralich']."',
                    '"
.$skill['effect_damage']."',
                    '"
.$skill['effect_hp_regen']."',
                    '"
.$skill['no_fear']."',
                    '"
.$skill['no_stun']."',
                    '"
.$skill['no_sleep']."',
                    '"
.$skill['no_paralich']."',
                    '"
.$skill['about']."',
                    '"
.$skill['hp_regen_percent']."',
                    '"
.$skill['effect_hp_regen_percent']."',
                    '"
.$account['id']."',
                    '"
.$skill['type']."',
                    '"
.$skill['res_time']."',
                    '0',
                    '"
.$skill['icon']."',
                    '"
.$skill['effect_time']."',
                    '"
.$skill['effect_every_sec']."',
                    '"
.$skill['dota']."',
                    '"
.$skill['baph']."',
                    '"
.$skill['baph_adding']."',
                    '"
.$skill['baph_will']."',
                    '"
.$skill['baph_reaction']."',
                    '"
.$skill['baph_max_hp']."',
                    '"
.$skill['baph_max_mp']."',
                    '"
.$skill['baph_feature_armor_weapon']."',
                    '"
.$skill['baph_feature_armor_arrow']."',
                    '"
.$skill['baph_feature_armor_magic']."',
                    '"
.$skill['baph_feature_attack_weapon']."',
                    '"
.$skill['baph_feature_attack_arrow']."',
                    '"
.$skill['baph_feature_attack_magic']."',
                    '"
.$skill['baph_hp_regen']."',
                    '"
.$skill['baph_mp_regen']."',
                    '"
.$skill['baph_power']."',
                    '"
.$skill['baph_wit']."',
                    '"
.$skill['baph_dexterity']."',
                    '"
.$skill['baph_vitality']."',
                    '"
.$skill['baph_spirit']."',
                    '"
.$skill['debaph']."',
                    '"
.$skill['ident_id']."',
                    '"
.$skill['mp_need_from_cast']."',
                    '"
.$skill['lvl']."'
                    )"
);
                    
mysql_query("UPDATE `account` SET `skill_point`='".($account['skill_point']-1)."' WHERE `id`='".$account['id']."'");
                    
header("Location: ?");
                    exit;
            }
        }
    }else{
        
header("Location: ?");
        exit;
    }
}
$cop=10;

$ca=mysql_result(mysql_query("SELECT COUNT(*) FROM `skills` WHERE `class`='".$account['class']."' AND `specialization`='".$account['specialization']."'"),0);

$cp=ceil($ca/$cop);

if(isset(
$_GET['page']) && is_numeric($_GET['page'])){

$page $_GET['page'];

if(
$_GET['page']>$cp$page=$cp;

if(
$_GET['page']<1)$page=1;

}else{

$page=1;

}

$start=$page*$cop-$cop;
    
$q=mysql_query("SELECT * FROM `skills` WHERE `class`='".$account['class']."' AND `specialization`='".$account['specialization']."' ORDER BY `lvl` ASC LIMIT $start,$cop");
if (!
mysql_num_rows($q)){
    echo 
'<div class="border-top"></div><div class="help">Нет доступных умений</div>';
}
while(
$result=mysql_fetch_assoc($q)){
    
/*if (!empty($array)){
        foreach($array as $key=>$hide){
            if ($key=$result['ident_id']){
                $err=true;
            }
        }
    }
    echo '<pre>';
    print_r($result);
    echo '</pre>';*/
    
if (isset($array[$result['ident_id']])){
        
$err=true;
    }
    if (!isset(
$err)){
        echo 
'<div class="border-top"></div>';
        if (
mysql_result(mysql_query("SELECT COUNT(*) FROM `skill` WHERE `ident_id`='".$result['ident_id']."' AND `account`='".$account['id']."'"),0)){
            
$skill=mysql_fetch_assoc(mysql_query("SELECT * FROM `skill` WHERE `ident_id`='".$result['ident_id']."' AND `account`='".$account['id']."'"));
            echo 
'<div class="tools">';
            echo 
'<table><tr><td><img src="/data/img/skill/'.$skill['icon'].'.jpg" style="float:left; margin-right:10px;"></td><td>'.$skill['name'].'</td></tr></table></div>';
            echo 
'<font color="#8e8171">'.$skillnew['about'].'</font>';
            if (
mysql_result(mysql_query("SELECT COUNT(*) FROM `skills` WHERE `ident_id`='".$skill['ident_id']."' AND `lvl`='".($skill['lvl']+1)."'"),0)){
                if (
$account['skill_point']){
                    
$resnew=mysql_fetch_assoc(mysql_query("SELECT * FROM `skills` WHERE `ident_id`='".$skill['ident_id']."' AND `lvl`='".($skill['lvl']+1)."'"));
                    echo 
'<a class="link" href="?skill='.$resnew['id'].'">Улучшить</a>';
                }
            }
            echo 
'<div class="help">';
            if (
$skill['effect_time']){
                echo 
'Время действия: '.$skill['effect_time'].'<br />';
            }
            echo 
'<font color="#8e8171">'.$skill['about'].'</font><br />';
            if (
mysql_result(mysql_query("SELECT COUNT(*) FROM `skills` WHERE `ident_id`='".$skill['ident_id']."' AND `lvl`='".($skill['lvl']+1)."'"),0)){
                echo 
'Следующий уровень:<br />';
                
$skillnew=mysql_fetch_assoc(mysql_query("SELECT * FROM `skills` WHERE `ident_id`='".$skill['ident_id']."' AND `lvl`='".($skill['lvl']+1)."'"));
                if (
$skillnew['min_lvl']){
                    if (
$skill['min_lvl']>$account['lvl']){
                        echo 
'<font color="#3d060c">Требуется уровень: '.$skillnew['lvl'].'</font><br />';
                    }else{
                        echo 
'<font color="#3d8e2f">Требуется уровень: '.$skillnew['lvl'].'</font><br />';
                    }
                }
            }
            echo 
'</div>';
            
$array[$result['ident_id']]=$result['ident_id'];
        }else{
            echo 
'<div class="tools">';
            echo 
'<table><tr><td><img src="/data/img/skill/'.$result['icon'].'.jpg" style="float:left;margin-right:10px;"></td><td>'.$result['name'].'</td></tr></table></div>';
            echo 
'<div class="help"><font color="#8e8171">'.$result['about'].'</font></div>';
            if (
$account['skill_point'] && !($result['min_lvl']>$account['lvl'])){
                echo 
'<a class="link" href="?skill='.$result['id'].'">Выучить</a>';
            }
            echo 
'<div class="help">';
            if (
$result['effect_time']){
                echo 
'Время действия: '.$result['effect_time'].'<br />';
            }
            if (
$result['min_lvl']){
                if (
$result['min_lvl']>$account['lvl']){
                    echo 
'<font color="#3d060c">Требуется уровень: '.$result['lvl'].'</font><br />';
                }else{
                    echo 
'<font color="#3d8e2f">Требуется уровень: '.$result['lvl'].'</font><br />';
                }
            }
            echo 
'</div>';
            
$array[$result['ident_id']]=$result['ident_id'];
        }
    }else{
        
    }
    unset(
$err);
}
/*echo '<pre>';
    print_r($array);
    echo '</pre>';*/
echo '<div class="nstr">Страница ';
if (
$page-1>=1){
    echo 
'<a href="?page='.($page-1).'"><</a>';
}
if (
$page-1>=1){
    echo 
'<a href="?page='.($page-1).'">'.($page-1).'</a>';
}
echo 
'<b>'.$page.'</b>';
if (
$page+1<=$cp){
    echo 
'<a href="?page='.($page+1).'">'.($page+1).'</a>';
}
if (
$page+1<=$cp){
    echo 
'<a href="?page='.($page+1).'">></a>';
}
echo 
'<a class="navi" href="character.php">Характеристики персонажа</a>';
echo 
'</div>';
}else{

header ("Location: /?"); exit;

}

down();

?>
Онлайн: 5
Реклама