Файл: files/core.php
Строк: 178
<?
if($udata['kv']<30)
{
header('location: tren.php');exit;
}
//шмот
$st_hp=mysql_result(mysql_query("SELECT SUM(hp) FROM `item` WHERE `status`='on' and `usr`='".$udata['id']."' and `tip`!='pet1' and `tip`!='pet2'"),0);
$st_sila=mysql_result(mysql_query("SELECT SUM(sila) FROM `item` WHERE `status`='on' and `usr`='".$udata['id']."' and `tip`!='pet1' and `tip`!='pet2'"),0);
$st_arm=mysql_result(mysql_query("SELECT SUM(arm) FROM `item` WHERE `status`='on' and `usr`='".$udata['id']."' and `tip`!='pet1' and `tip`!='pet2'"),0);
$st_krit=mysql_result(mysql_query("SELECT SUM(krit) FROM `item` WHERE `status`='on' and `usr`='".$udata['id']."' and `tip`!='pet1' and `tip`!='pet2'"),0);
$st_blok=mysql_result(mysql_query("SELECT SUM(blok) FROM `item` WHERE `status`='on' and `usr`='".$udata['id']."' and `tip`!='pet1' and `tip`!='pet2'"),0);
//души
$soul_hp=mysql_result(mysql_query("SELECT SUM(ef) FROM `soul` WHERE `status`='1' and `usr`='".$udata['id']."' and `tip`='hp'"),0);
$soul_hp2=mysql_result(mysql_query("SELECT SUM(ef2) FROM `soul` WHERE `status`='1' and `usr`='".$udata['id']."' and `tip2`='hp'"),0);
$soul_sila=mysql_result(mysql_query("SELECT SUM(ef) FROM `soul` WHERE `status`='1' and `usr`='".$udata['id']."' and `tip`='sila'"),0);
$soul_sila2=mysql_result(mysql_query("SELECT SUM(ef2) FROM `soul` WHERE `status`='1' and `usr`='".$udata['id']."' and `tip2`='sila'"),0);
$soul_arm=mysql_result(mysql_query("SELECT SUM(ef) FROM `soul` WHERE `status`='1' and `usr`='".$udata['id']."' and `tip`='arm'"),0);
$soul_arm2=mysql_result(mysql_query("SELECT SUM(ef2) FROM `soul` WHERE `status`='1' and `usr`='".$udata['id']."' and `tip2`='arm'"),0);
//титул
$tit_hp=mysql_result(mysql_query("SELECT SUM(hp) FROM `titul` WHERE `status`='1' and `usr`='".$udata['id']."'"),0);
$tit_sila=mysql_result(mysql_query("SELECT SUM(sila) FROM `titul` WHERE `status`='1' and `usr`='".$udata['id']."'"),0);
$tit_arm=mysql_result(mysql_query("SELECT SUM(arm) FROM `titul` WHERE `status`='1' and `usr`='".$udata['id']."'"),0);
$tit_krit=mysql_result(mysql_query("SELECT SUM(krit) FROM `titul` WHERE `status`='1' and `usr`='".$udata['id']."'"),0);
$tit_blok=mysql_result(mysql_query("SELECT SUM(blok) FROM `titul` WHERE `status`='1' and `usr`='".$udata['id']."'"),0);
if($udata['clan']!=0)
{
$st_hp_gi=mysql_num_rows(mysql_query("SELECT * FROM `sectors` WHERE `tip`='hp' and `clan`='".$udata['clan']."'"));
$hp_gi=$st_hp_gi*100;
$st_arm_gi=mysql_num_rows(mysql_query("SELECT * FROM `sectors` WHERE `tip`='arm' and `clan`='".$udata['clan']."'"));
$arm_gi=$st_arm_gi*15;
$st_sila_gi=mysql_num_rows(mysql_query("SELECT * FROM `sectors` WHERE `tip`='sila' and `clan`='".$udata['clan']."'"));
$sila_gi=$st_sila_gi*10;
$st_krit_gi=mysql_num_rows(mysql_query("SELECT * FROM `sectors` WHERE `tip`='krit' and `clan`='".$udata['clan']."'"));
$krit_gi=$st_krit_gi*2;
$st_blok_gi=mysql_num_rows(mysql_query("SELECT * FROM `sectors` WHERE `tip`='blok' and `clan`='".$udata['clan']."'"));
$blok_gi=$st_blok_gi*2;
}
else
{
$hp_gi=0;
$arm_gi=0;
$sila_gi=0;
$krit_gi=0;
$blok_gi=0;
}
//комплект
$komp = mysql_num_rows( mysql_query("SELECT * FROM `item` WHERE `usr`='".$udata['id']."' and `status`='on' and `komp`!='0'"));
if($komp>=3)
{
$golova=mysql_num_rows(mysql_query("SELECT * FROM `item` WHERE `usr`='".$udata['id']."' and `status`='on' and `komp`!='0' and `tip`='golova'"));
if($golova!=0)
{
$k_g=mysql_fetch_array(mysql_query("SELECT * FROM `item` WHERE `usr`='".$udata['id']."' and `status`='on' and `komp`!='0' and `tip`='golova'"));
$k_kol=mysql_num_rows(mysql_query("SELECT * FROM `item` WHERE `usr`='".$udata['id']."' and `status`='on' and `komp`='".$k_g['komp']."'"));
}
else
{
$telo=mysql_num_rows(mysql_query("SELECT * FROM `item` WHERE `usr`='".$udata['id']."' and `status`='on' and `komp`!='0' and `tip`='telo'"));
if($telo!=0)
{
$k_g=mysql_fetch_array(mysql_query("SELECT * FROM `item` WHERE `usr`='".$udata['id']."' and `status`='on' and `komp`!='0' and `tip`='telo'"));
$k_kol=mysql_num_rows(mysql_query("SELECT * FROM `item` WHERE `usr`='".$udata['id']."' and `status`='on' and `komp`='".$k_g['komp']."'"));
}
else
{
$wearop=mysql_num_rows(mysql_query("SELECT * FROM `item` WHERE `usr`='".$udata['id']."' and `status`='on' and `komp`!='0' and `tip`='wearop'"));
if($wearop!=0)
{
$k_g=mysql_fetch_array(mysql_query("SELECT * FROM `item` WHERE `usr`='".$udata['id']."' and `status`='on' and `komp`!='0' and `tip`='wearop'"));
$k_kol=mysql_num_rows(mysql_query("SELECT * FROM `item` WHERE `usr`='".$udata['id']."' and `status`='on' and `komp`='".$k_g['komp']."'"));
}
}
}
$kggf=mysql_query("SELECT * FROM `komp` WHERE `id`='".$k_g['komp']."'");
$gre=mysql_fetch_array($kggf);
if($k_kol==3)
{
$khp=$gre['hp'];
$ksila=$gre['sila'];
$karm=$gre['arm'];
$kkrit=0;
$kblok=0;
}
elseif($k_kol==4)
{
$khp=$gre['hp'];
$ksila=$gre['sila'];
$karm=$gre['arm'];
if($gre['krit']>0 and $gre['blok']>0)
{
$kkrit=$gre['krit'];
$kblok=0;
}
elseif($gre['krit']>0 and $gre['blok']==0)
{
$kkrit=round($gre['krit']/2);
$kblok=0;
}
elseif($gre['krit']==0 and $gre['blok']>0)
{
$kblok=round($gre['blok']/2);
$kkrit=0;
}
}
elseif($k_kol==5)
{
$khp=$gre['hp'];
$ksila=$gre['sila'];
$karm=$gre['arm'];
$kkrit=$gre['krit'];
$kblok=$gre['blok'];
}
}
else
{
$khp=0;
$ksila=0;
$karm=0;
$kkrit=0;
$kblok=0;
}
//достижения
$stats_dost=mysql_fetch_array(mysql_query("SELECT * FROM `users_dost` WHERE `usr`='".$udata['id']."'"));
$hp=$st_hp+$soul_hp+$soul_hp2+$tit_hp+$khp+$stats_dost['hp']+$udata['hp1'];
$sila=$st_sila+$soul_sila+$soul_sila2+$tit_sila+$ksila+$stats_dost['sila']+$udata['sila1'];
$arm=$st_arm+$soul_arm+$soul_arm2+$tit_arm+$karm+$stats_dost['arm']+$udata['arm1'];
$krit=$st_krit+$tit_krit+$kkrit+$krit_gi;
$blok=$st_blok+$tit_blok+$kblok+$blok_gi;
//звезды
$st_zv=mysql_result(mysql_query("SELECT SUM(zvezd) FROM `item` WHERE `status`='on' and `usr`='".$udata['id']."'"),0);
if($st_zv>=5 and $st_zv<10)
{
$hp=round($hp+$hp/100*5);
$sila=round($sila+$sila/100*5);
$arm=round($arm+$arm/100*5);
}
elseif($st_zv>=10 and $st_zv<15)
{
$hp=round($hp+$hp/100*10);
$sila=round($sila+$sila/100*10);
$arm=round($arm+$arm/100*10);
}
elseif($st_zv>=15 and $st_zv<20)
{
$hp=round($hp+$hp/100*15);
$sila=round($sila+$sila/100*15);
$arm=round($arm+$arm/100*15);
}
elseif($st_zv>=20 and $st_zv<25)
{
$hp=round($hp+$hp/100*20);
$sila=round($sila+$sila/100*20);
$arm=round($arm+$arm/100*20);
}
elseif($st_zv>=25 and $st_zv<30)
{
$hp=round($hp+$hp/100*25);
$sila=round($sila+$sila/100*25);
$arm=round($arm+$arm/100*25);
}
elseif($st_zv>=30)
{
$hp=round($hp+$hp/100*30);
$sila=round($sila+$sila/100*30);
$arm=round($arm+$arm/100*30);
}
$hpl=$hp;
$silal=$sila;
$arml=$arm;
$sgs=$hpl+$silal+$arml;
mysql_query("UPDATE `users` SET `stats`='".$sgs."' WHERE `id`='".$udata['id']."'");
$hpz=$hp*14;
$silaz=$sila*1;
$armz=$arm*0.5;
$r_s_f=mysql_result(mysql_query("SELECT SUM(sila_fire) FROM `users_runes` WHERE `status`='2' and `usr`='".$udata['id']."'"),0);
$r_s_w=mysql_result(mysql_query("SELECT SUM(sila_water) FROM `users_runes` WHERE `status`='2' and `usr`='".$udata['id']."'"),0);
$r_s_a=mysql_result(mysql_query("SELECT SUM(sila_air) FROM `users_runes` WHERE `status`='2' and `usr`='".$udata['id']."'"),0);
$r_s_g=mysql_result(mysql_query("SELECT SUM(sila_ground) FROM `users_runes` WHERE `status`='2' and `usr`='".$udata['id']."'"),0);
$r_a_f=mysql_result(mysql_query("SELECT SUM(arm_fire) FROM `users_runes` WHERE `status`='2' and `usr`='".$udata['id']."'"),0);
$r_a_w=mysql_result(mysql_query("SELECT SUM(arm_water) FROM `users_runes` WHERE `status`='2' and `usr`='".$udata['id']."'"),0);
$r_a_a=mysql_result(mysql_query("SELECT SUM(arm_air) FROM `users_runes` WHERE `status`='2' and `usr`='".$udata['id']."'"),0);
$r_a_g=mysql_result(mysql_query("SELECT SUM(arm_ground) FROM `users_runes` WHERE `status`='2' and `usr`='".$udata['id']."'"),0);
$hp_r=mysql_result(mysql_query("SELECT SUM(hp_regen) FROM `users_runes` WHERE `status`='2' and `usr`='".$udata['id']."'"),0);
$sfer_time=mysql_result(mysql_query("SELECT SUM(sfer_time) FROM `users_runes` WHERE `status`='2' and `usr`='".$udata['id']."'"),0);
$hp_r=$hp_r+$udata['lvl']*5;
$statas=mysql_query("SELECT * FROM `users_stats` WHERE `usr`='".$udata['id']."'");
$nst=mysql_num_rows($statas);
if($nst==0)
{
mysql_query("INSERT INTO `users_stats` SET
`id`='',
`usr`='".$udata['id']."',
`hp_max`='".$hpz."',
`hp_regen`='".$hp_r."',
`sila`='".$silaz."',
`arm`='".$armz."',
`krit`='".$krit."',
`blok`='".$blok."',
`sila_fire`='".$r_s_f."',
`sila_water`='".$r_s_w."',
`sila_air`='".$r_s_a."',
`sila_ground`='".$r_s_g."',
`arm_fire`='".$r_a_f."',
`arm_water`='".$r_a_w."',
`arm_air`='".$r_a_a."',
`arm_ground`='".$r_a_g."',
`sfer_time`='".$sfer_time."'
");
}
else
{
mysql_query("UPDATE `users_stats` SET
`hp_max`='".$hpz."',
`hp_regen`='".$hp_r."',
`sila`='".$silaz."',
`arm`='".$armz."',
`krit`='".$krit."',
`blok`='".$blok."',
`sila_fire`='".$r_s_f."',
`sila_water`='".$r_s_w."',
`sila_air`='".$r_s_a."',
`sila_ground`='".$r_s_g."',
`arm_fire`='".$r_a_f."',
`arm_water`='".$r_a_w."',
`arm_air`='".$r_a_a."',
`arm_ground`='".$r_a_g."',
`sfer_time`='".$sfer_time."'
WHERE `usr`='".$udata['id']."'
");
}
//потом убрать
mysql_query("UPDATE `users` SET `hp`='".$hpz."', `sila`='".$silaz."', `arm`='".$armz."', `krit`='".$krit."', `blok`='".$blok."' WHERE `id`='".$udata['id']."'");
///
$tr=mysql_query("SELECT * FROM `pit` WHERE `usr`='".$udata['id']."' and `status`='1'");
$t=mysql_fetch_array($tr);
$pit_hp=mysql_result(mysql_query("SELECT SUM(hp) FROM `item` WHERE `status`='on' and `usr`='".$udata['id']."' and `pet`='".$t['id']."'"),0);
$pit_sila=mysql_result(mysql_query("SELECT SUM(sila) FROM `item` WHERE `status`='on' and `usr`='".$udata['id']."' and `pet`='".$t['id']."'"),0);
$pit_arm=mysql_result(mysql_query("SELECT SUM(arm) FROM `item` WHERE `status`='on' and `usr`='".$udata['id']."' and `pet`='".$t['id']."'"),0);
$hpq=($t['hp1']+$pit_hp)*14;
$silaq=$t['sila1']+$pit_sila;
$arm1=round(($t['arm1']+$pit_arm)/2);
mysql_query("UPDATE `pit` SET `hp`='".$hpq."', `sila`='".$silaq."', `arm`='".$arm1."' WHERE `id`='".$t['id']."'");
include('files/syst.php');
?>