Файл: www/inc/account.php
Строк: 930
<?php
if(isset($_SESSION['auth']) && $_SESSION['auth']==1){
$account = mysql_fetch_array(mysql_query("SELECT * FROM `account` WHERE id='".$_SESSION['id']."'"));
mysql_query("UPDATE `account` SET `last_active`='".time()."' WHERE `id`='".$account['id']."'");
$lvl = mysql_fetch_array(mysql_query("SELECT * FROM `lvl` WHERE `id`='".($account["lvl"]+1)."'"));
/*************Обнуляем характеристики************/
//Сложение
$account['adding'] = 0;
//Воля
$account['will'] = 0;
//Реакция
$account['reaction'] = 0;
//Очки здоровья
$account['max_hp']=0;
//Очки маны
$account['max_mp']=0;
//Защита от ударов
$account['feature_armor_weapon']=0;
//Защита от стрел
$account['feature_armor_arrow']=0;
//Защита от магии
$account['feature_armor_magic']=0;
//Урон от ударов
$account['feature_attack_weapon']=0;
//Урон от стрел
$account['feature_attack_arrow']=0;
//Урон от магии
$account['feature_attack_magic']=0;
//Восстановление жизни
$account['hp_regen']=0;
//Восстановление маны
$account['mp_regen']=0;
//Минимальный урон(оружие)
$account['min_damag']=0;
//Максимальный урон(оружие)
$account['max_damag']=0;
///////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////CLAN///////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
if ($account['clan']){
$cln=mysql_fetch_assoc(mysql_query("SELECT * FROM `clan` WHERE `id`='".$account['clan']."'"));
$account['power']=$account['power']+$cln['power'];
$account['wit']=$account['wit']+$cln['wit'];
$account['spirit']=$account['spirit']+$cln['spirit'];
$account['dexterity']=$account['dexterity']+$cln['dexterity'];
$account['vitality']=$account['vitality']+$cln['vitality'];
}
/********************************************************************************************************************
****************************************************Баффы!************************************************************
***********************************************************************************************************************/
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `effect` WHERE `baph`='1' AND (`account`='".$account['id']."' AND (`target_type`='' OR `target_type`='0')) OR (`target_type`='user' AND `target`='".$account['id']."')"),0)){
$qb=mysql_query("SELECT * FROM `effect` WHERE `baph`='1' AND `account`='".$account['id']."' OR (`target_type`='user' AND `target`='".$account['id']."')");
while($resultb=mysql_fetch_assoc($qb)){
if (time()-$resultb['time']>=$resultb['effect_time']){
mysql_query("DELETE FROM `effect` WHERE `id`='".$resultb['id']."'");
header("Location: ?");
exit;
}
//Сложение
$account['adding']+=$resultb['baph_adding'];
//Воля
$account['will']+=$resultb['baph_will'];
//Реакция
$account['reaction']+=$resultb['baph_reaction'];
//Очки здоровья
$account['max_hp']+=$resultb['baph_max_hp'];
//Очки маны
$account['max_mp']+=$resultb['baph_max_mp'];
//Защита от ударов
$account['feature_armor_weapon']+=$resultb['baph_feature_armor_weapon'];
//Защита от стрел
$account['feature_armor_arrow']+=$resultb['baph_feature_armor_arrow'];
//Защита от магии
$account['feature_armor_magic']+=$resultb['baph_feature_armor_magic'];
//Урон от ударов
$account['feature_attack_weapon']+=$resultb['baph_feature_attack_weapon'];
//Урон от стрел
$account['feature_attack_arrow']+=$resultb['baph_feature_attack_arrow'];
//Урон от магии
$account['feature_attack_magic']+=$resultb['baph_feature_attack_magic'];
//Восстановление жизни
$account['hp_regen']+=$resultb['baph_hp_regen'];
//Восстановление маны
$account['mp_regen']+=$resultb['baph_mp_regen'];
//Power
$account['power']+=$resultb['baph_power'];
//Wit
$account['wit']+=$resultb['baph_wit'];
//Dexterity
$account['dexterity']+=$resultb['baph_dexterity'];
//Vitality
$account['vitality']+=$resultb['baph_vitality'];
//Spirit
$account['spirit']+=$resultb['baph_spirit'];
}
}
/**********************************************************************************************************************
*******************************************Бонусы характеристик от вещей************************************************
*************************************************************************************************************************/
if(!empty($account['armor_head'])){ //Шлем
$head=mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id`='".$account['armor_head']."'"));
if ($head['feature_pover']!=NULL){
$account['power']=$account['power']+$head['feature_power'];
}
if ($head['feature_vitality']!=NULL){
$account['vitality']=$account['vitality']+$head['feature_vitality'];
}
if ($head['feature_dexterity']!=NULL){
$account['dexterity']=$account['dexterity']+$head['feature_dexterity'];
}
if ($head['feature_wit']!=NULL){
$account['wit']=$account['wit']+$head['feature_wit'];
}
if ($head['feature_spirit']!=NULL){
$account['spirit']=$account['spirit']+$head['feature_spirit'];
}
if ($head['feature_armor_arrow']!=NULL){
$account['feature_armor_arrow']=$account['feature_armor_arrow']+$head['feature_armor_arrow']*1.25;
}
if ($head['feature_armor_weapon']!=NULL){
$account['feature_armor_weapon']=$account['feature_armor_weapon']+$head['feature_armor_weapon']*1.25;
}
if ($head['feature_armor_magic']!=NULL){
$account['feature_armor_magic']=$account['feature_armor_magic']+$head['feature_armor_magic']*1.25;
}
if ($head['feature_attack_arrow']!=NULL){
$account['feature_attack_arrow']=$account['feature_attack_arrow']+$head['feature_attack_arrow']*1.50;
}
if ($head['feature_attack_weapon']!=NULL){
$account['feature_attack_weapon']=$account['feature_attack_weapon']+$head['feature_attack_weapon']*1.50;
}
if ($head['feature_attack_magic']!=NULL){
$account['feature_attack_magic']=$account['feature_attack_magic']+$head['feature_attack_magic']*1.50;
}
if ($head['feature_hp_regen']!=NULL){
$account['hp_regen']=$account['hp_regen']+$head['feature_hp_regen'];
}
if ($head['feature_mp_regen']!=NULL){
$account['mp_regen']=$account['mp_regen']+$head['feature_mp_regen'];
}
}
if(!empty($account['armor_body'])){ //Нагрудник
$body=mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id`='".$account['armor_body']."'"));
if ($body['feature_pover']!=NULL){
$account['power']=$account['power']+$body['feature_power'];
}
if ($body['feature_vitality']!=NULL){
$account['vitality']=$account['vitality']+$body['feature_vitality'];
}
if ($body['feature_dexterity']!=NULL){
$account['dexterity']=$account['dexterity']+$body['feature_dexterity'];
}
if ($body['feature_wit']!=NULL){
$account['wit']=$account['wit']+$body['feature_wit'];
}
if ($body['feature_spirit']!=NULL){
$account['spirit']=$account['spirit']+$body['feature_spirit'];
}
if ($body['feature_armor_arrow']!=NULL){
$account['feature_armor_arrow']=$account['feature_armor_arrow']+$body['feature_armor_arrow']*1.25;
}
if ($body['feature_armor_weapon']!=NULL){
$account['feature_armor_weapon']=$account['feature_armor_weapon']+$body['feature_armor_weapon']*1.25;
}
if ($body['feature_armor_magic']!=NULL){
$account['feature_armor_magic']=$account['feature_armor_magic']+$body['feature_armor_magic']*1.25;
}
if ($body['feature_attack_arrow']!=NULL){
$account['feature_attack_arrow']=$account['feature_attack_arrow']+$body['feature_attack_arrow']*1.50;
}
if ($body['feature_attack_weapon']!=NULL){
$account['feature_attack_weapon']=$account['feature_attack_weapon']+$body['feature_attack_weapon']*1.50;
}
if ($body['feature_attack_magic']!=NULL){
$account['feature_attack_magic']=$account['feature_attack_magic']+$body['feature_attack_magic']*1.50;
}
if ($body['feature_hp_regen']!=NULL){
$account['hp_regen']=$account['hp_regen']+$body['feature_hp_regen'];
}
if ($body['feature_mp_regen']!=NULL){
$account['mp_regen']=$account['mp_regen']+$body['feature_mp_regen'];
}
}
if(!empty($account['armor_pants'])){ //Набедреник
$pants=mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id`='".$account['armor_pants']."'"));
if ($pants['feature_pover']!=NULL){
$account['power']=$account['power']+$pants['feature_power'];
}
if ($pants['feature_vitality']!=NULL){
$account['vitality']=$account['vitality']+$pants['feature_vitality'];
}
if ($pants['feature_dexterity']!=NULL){
$account['dexterity']=$account['dexterity']+$pants['feature_dexterity'];
}
if ($pants['feature_wit']!=NULL){
$account['wit']=$account['wit']+$pants['feature_wit'];
}
if ($pants['feature_spirit']!=NULL){
$account['spirit']=$account['spirit']+$pants['feature_spirit'];
}
if ($pants['feature_armor_arrow']!=NULL){
$account['feature_armor_arrow']=$account['feature_armor_arrow']+$pants['feature_armor_arrow']*1.25;
}
if ($pants['feature_armor_weapon']!=NULL){
$account['feature_armor_weapon']=$account['feature_armor_weapon']+$pants['feature_armor_weapon']*1.25;
}
if ($pants['feature_armor_magic']!=NULL){
$account['feature_armor_magic']=$account['feature_armor_magic']+$pants['feature_armor_magic']*1.25;
}
if ($pants['feature_attack_arrow']!=NULL){
$account['feature_attack_arrow']=$account['feature_attack_arrow']+$pants['feature_attack_arrow']*1.50;
}
if ($pants['feature_attack_weapon']!=NULL){
$account['feature_attack_weapon']=$account['feature_attack_weapon']+$pants['feature_attack_weapon']*1.50;
}
if ($pants['feature_attack_magic']!=NULL){
$account['feature_attack_magic']=$account['feature_attack_magic']+$pants['feature_attack_magic']*1.50;
}
if ($pants['feature_hp_regen']!=NULL){
$account['hp_regen']=$account['hp_regen']+$pants['feature_hp_regen'];
}
if ($pants['feature_mp_regen']!=NULL){
$account['mp_regen']=$account['mp_regen']+$pants['feature_mp_regen'];
}
}
if(!empty($account['armor_gloves'])){ //Набедреник
$gloves=mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id`='".$account['armor_gloves']."'"));
if ($gloves['feature_pover']!=NULL){
$account['power']=$account['power']+$gloves['feature_power'];
}
if ($gloves['feature_vitality']!=NULL){
$account['vitality']=$account['vitality']+$gloves['feature_vitality'];
}
if ($gloves['feature_dexterity']!=NULL){
$account['dexterity']=$account['dexterity']+$gloves['feature_dexterity'];
}
if ($gloves['feature_wit']!=NULL){
$account['wit']=$account['wit']+$gloves['feature_wit'];
}
if ($gloves['feature_spirit']!=NULL){
$account['spirit']=$account['spirit']+$gloves['feature_spirit'];
}
if ($gloves['feature_armor_arrow']!=NULL){
$account['feature_armor_arrow']=$account['feature_armor_arrow']+$gloves['feature_armor_arrow']*1.25;
}
if ($gloves['feature_armor_weapon']!=NULL){
$account['feature_armor_weapon']=$account['feature_armor_weapon']+$gloves['feature_armor_weapon']*1.25;
}
if ($gloves['feature_armor_magic']!=NULL){
$account['feature_armor_magic']=$account['feature_armor_magic']+$gloves['feature_armor_magic']*1.25;
}
if ($gloves['feature_attack_arrow']!=NULL){
$account['feature_attack_arrow']=$account['feature_attack_arrow']+$gloves['feature_attack_arrow']*1.50;
}
if ($gloves['feature_attack_weapon']!=NULL){
$account['feature_attack_weapon']=$account['feature_attack_weapon']+$gloves['feature_attack_weapon']*1.50;
}
if ($gloves['feature_attack_magic']!=NULL){
$account['feature_attack_magic']=$account['feature_attack_magic']+$gloves['feature_attack_magic']*1.50;
}
if ($gloves['feature_hp_regen']!=NULL){
$account['hp_regen']=$account['hp_regen']+$gloves['feature_hp_regen'];
}
if ($gloves['feature_mp_regen']!=NULL){
$account['mp_regen']=$account['mp_regen']+$gloves['feature_mp_regen'];
}
}
if(!empty($account['armor_belt'])){ //Пояс
$belt=mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id`='".$account['armor_belt']."'"));
if ($belt['feature_pover']!=NULL){
$account['power']=$account['power']+$belt['feature_power'];
}
if ($belt['feature_vitality']!=NULL){
$account['vitality']=$account['vitality']+$belt['feature_vitality'];
}
if ($belt['feature_dexterity']!=NULL){
$account['dexterity']=$account['dexterity']+$belt['feature_dexterity'];
}
if ($belt['feature_wit']!=NULL){
$account['wit']=$account['wit']+$belt['feature_wit'];
}
if ($belt['feature_spirit']!=NULL){
$account['spirit']=$account['spirit']+$belt['feature_spirit'];
}
if ($belt['feature_armor_arrow']!=NULL){
$account['feature_armor_arrow']=$account['feature_armor_arrow']+$belt['feature_armor_arrow']*1.25;
}
if ($belt['feature_armor_weapon']!=NULL){
$account['feature_armor_weapon']=$account['feature_armor_weapon']+$belt['feature_armor_weapon']*1.25;
}
if ($belt['feature_armor_magic']!=NULL){
$account['feature_armor_magic']=$account['feature_armor_magic']+$belt['feature_armor_magic']*1.25;
}
if ($belt['feature_attack_arrow']!=NULL){
$account['feature_attack_arrow']=$account['feature_attack_arrow']+$belt['feature_attack_arrow']*1.50;
}
if ($belt['feature_attack_weapon']!=NULL){
$account['feature_attack_weapon']=$account['feature_attack_weapon']+$belt['feature_attack_weapon']*1.50;
}
if ($belt['feature_attack_magic']!=NULL){
$account['feature_attack_magic']=$account['feature_attack_magic']+$belt['feature_attack_magic']*1.50;
}
if ($belt['feature_hp_regen']!=NULL){
$account['hp_regen']=$account['hp_regen']+$belt['feature_hp_regen'];
}
if ($belt['feature_mp_regen']!=NULL){
$account['mp_regen']=$account['mp_regen']+$belt['feature_mp_regen'];
}
}
if(!empty($account['armor_ring'])){ //Кольцо
$ring=mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id`='".$account['armor_ring']."'"));
if ($ring['feature_pover']!=NULL){
$account['power']=$account['power']+$ring['feature_power'];
}
if ($ring['feature_vitality']!=NULL){
$account['vitality']=$account['vitality']+$ring['feature_vitality'];
}
if ($ring['feature_dexterity']!=NULL){
$account['dexterity']=$account['dexterity']+$ring['feature_dexterity'];
}
if ($ring['feature_wit']!=NULL){
$account['wit']=$account['wit']+$ring['feature_wit'];
}
if ($ring['feature_spirit']!=NULL){
$account['spirit']=$account['spirit']+$ring['feature_spirit'];
}
if ($ring['feature_armor_arrow']!=NULL){
$account['feature_armor_arrow']=$account['feature_armor_arrow']+$ring['feature_armor_arrow']*1.25;
}
if ($ring['feature_armor_weapon']!=NULL){
$account['feature_armor_weapon']=$account['feature_armor_weapon']+$ring['feature_armor_weapon']*1.25;
}
if ($ring['feature_armor_magic']!=NULL){
$account['feature_armor_magic']=$account['feature_armor_magic']+$ring['feature_armor_magic']*1.25;
}
if ($ring['feature_attack_arrow']!=NULL){
$account['feature_attack_arrow']=$account['feature_attack_arrow']+$ring['feature_attack_arrow']*1.50;
}
if ($ring['feature_attack_weapon']!=NULL){
$account['feature_attack_weapon']=$account['feature_attack_weapon']+$ring['feature_attack_weapon']*1.50;
}
if ($ring['feature_attack_magic']!=NULL){
$account['feature_attack_magic']=$account['feature_attack_magic']+$ring['feature_attack_magic']*1.50;
}
if ($ring['feature_hp_regen']!=NULL){
$account['hp_regen']=$account['hp_regen']+$ring['feature_hp_regen'];
}
if ($ring['feature_mp_regen']!=NULL){
$account['mp_regen']=$account['mp_regen']+$ring['feature_mp_regen'];
}
}
if(!empty($account['armor_neckleace'])){ //Ожерелье
$neckleace=mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id`='".$account['armor_neckleace']."'"));
if ($neckleace['feature_pover']!=NULL){
$account['power']=$account['power']+$neckleace['feature_power'];
}
if ($neckleace['feature_vitality']!=NULL){
$account['vitality']=$account['vitality']+$neckleace['feature_vitality'];
}
if ($neckleace['feature_dexterity']!=NULL){
$account['dexterity']=$account['dexterity']+$neckleace['feature_dexterity'];
}
if ($neckleace['feature_wit']!=NULL){
$account['wit']=$account['wit']+$neckleace['feature_wit'];
}
if ($neckleace['feature_spirit']!=NULL){
$account['spirit']=$account['spirit']+$neckleace['feature_spirit'];
}
if ($neckleace['feature_armor_arrow']!=NULL){
$account['feature_armor_arrow']=$account['feature_armor_arrow']+$neckleace['feature_armor_arrow']*1.25;
}
if ($neckleace['feature_armor_weapon']!=NULL){
$account['feature_armor_weapon']=$account['feature_armor_weapon']+$neckleace['feature_armor_weapon']*1.25;
}
if ($neckleace['feature_armor_magic']!=NULL){
$account['feature_armor_magic']=$account['feature_armor_magic']+$neckleace['feature_armor_magic']*1.25;
}
if ($neckleace['feature_attack_arrow']!=NULL){
$account['feature_attack_arrow']=$account['feature_attack_arrow']+$neckleace['feature_attack_arrow']*1.50;
}
if ($neckleace['feature_attack_weapon']!=NULL){
$account['feature_attack_weapon']=$account['feature_attack_weapon']+$neckleace['feature_attack_weapon']*1.50;
}
if ($neckleace['feature_attack_magic']!=NULL){
$account['feature_attack_magic']=$account['feature_attack_magic']+$neckleace['feature_attack_magic']*1.50;
}
if ($neckleace['feature_hp_regen']!=NULL){
$account['hp_regen']=$account['hp_regen']+$neckleace['feature_hp_regen'];
}
if ($neckleace['feature_mp_regen']!=NULL){
$account['mp_regen']=$account['mp_regen']+$neckleace['feature_mp_regen'];
}
}
if(!empty($account['armor_earring'])){ //Серьги
$earring=mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id`='".$account['armor_earring']."'"));
if ($earring['feature_pover']!=NULL){
$account['power']=$account['power']+$earring['feature_power'];
}
if ($earring['feature_vitality']!=NULL){
$account['vitality']=$account['vitality']+$earring['feature_vitality'];
}
if ($earring['feature_dexterity']!=NULL){
$account['dexterity']=$account['dexterity']+$earring['feature_dexterity'];
}
if ($earring['feature_wit']!=NULL){
$account['wit']=$account['wit']+$earring['feature_wit'];
}
if ($earring['feature_spirit']!=NULL){
$account['spirit']=$account['spirit']+$earring['feature_spirit'];
}
if ($earring['feature_armor_arrow']!=NULL){
$account['feature_armor_arrow']=$account['feature_armor_arrow']+$earring['feature_armor_arrow']*1.25;
}
if ($earring['feature_armor_weapon']!=NULL){
$account['feature_armor_weapon']=$account['feature_armor_weapon']+$earring['feature_armor_weapon']*1.25;
}
if ($earring['feature_armor_magic']!=NULL){
$account['feature_armor_magic']=$account['feature_armor_magic']+$earring['feature_armor_magic']*1.25;
}
if ($earring['feature_attack_arrow']!=NULL){
$account['feature_attack_arrow']=$account['feature_attack_arrow']+$earring['feature_attack_arrow']*1.50;
}
if ($earring['feature_attack_weapon']!=NULL){
$account['feature_attack_weapon']=$account['feature_attack_weapon']+$earring['feature_attack_weapon']*1.50;
}
if ($earring['feature_attack_magic']!=NULL){
$account['feature_attack_magic']=$account['feature_attack_magic']+$earring['feature_attack_magic']*1.50;
}
if ($earring['feature_hp_regen']!=NULL){
$account['hp_regen']=$account['hp_regen']+$earring['feature_hp_regen'];
}
if ($earring['feature_mp_regen']!=NULL){
$account['mp_regen']=$account['mp_regen']+$earring['feature_mp_regen'];
}
}
if(!empty($account['armor_shoulder'])){ //Ожерелье
$shoulder=mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id`='".$account['armor_shoulder']."'"));
if ($shoulder['feature_pover']!=NULL){
$account['power']=$account['power']+$shoulder['feature_power'];
}
if ($shoulder['feature_vitality']!=NULL){
$account['vitality']=$account['vitality']+$shoulder['feature_vitality'];
}
if ($shoulder['feature_dexterity']!=NULL){
$account['dexterity']=$account['dexterity']+$shoulder['feature_dexterity'];
}
if ($shoulder['feature_wit']!=NULL){
$account['wit']=$account['wit']+$shoulder['feature_wit'];
}
if ($shoulder['feature_spirit']!=NULL){
$account['spirit']=$account['spirit']+$shoulder['feature_spirit'];
}
if ($shoulder['feature_armor_arrow']!=NULL){
$account['feature_armor_arrow']=$account['feature_armor_arrow']+$shoulder['feature_armor_arrow']*1.25;
}
if ($shoulder['feature_armor_weapon']!=NULL){
$account['feature_armor_weapon']=$account['feature_armor_weapon']+$shoulder['feature_armor_weapon']*1.25;
}
if ($shoulder['feature_armor_magic']!=NULL){
$account['feature_armor_magic']=$account['feature_armor_magic']+$shoulder['feature_armor_magic']*1.25;
}
if ($shoulder['feature_attack_arrow']!=NULL){
$account['feature_attack_arrow']=$account['feature_attack_arrow']+$shoulder['feature_attack_arrow']*1.50;
}
if ($shoulder['feature_attack_weapon']!=NULL){
$account['feature_attack_weapon']=$account['feature_attack_weapon']+$shoulder['feature_attack_weapon']*1.50;
}
if ($shoulder['feature_attack_magic']!=NULL){
$account['feature_attack_magic']=$account['feature_attack_magic']+$shoulder['feature_attack_magic']*1.50;
}
if ($shoulder['feature_hp_regen']!=NULL){
$account['hp_regen']=$account['hp_regen']+$shoulder['feature_hp_regen'];
}
if ($shoulder['feature_mp_regen']!=NULL){
$account['mp_regen']=$account['mp_regen']+$shoulder['feature_mp_regen'];
}
}
if(!empty($account['weapon_right'])){ //Левая рука(оружие)
$weaponright=mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id`='".$account['weapon_right']."'"));
if ($weaponright['feature_pover']!=NULL){
$account['power']=$account['power']+$weaponright['feature_power'];
}
if ($weaponright['feature_vitality']!=NULL){
$account['vitality']=$account['vitality']+$weaponright['feature_vitality'];
}
if ($weaponright['feature_dexterity']!=NULL){
$account['dexterity']=$account['dexterity']+$weaponright['feature_dexterity'];
}
if ($weaponright['feature_wit']!=NULL){
$account['wit']=$account['wit']+$weaponright['feature_wit'];
}
if ($weaponright['feature_spirit']!=NULL){
$account['spirit']=$account['spirit']+$weaponright['feature_spirit'];
}
if ($weaponright['feature_armor_arrow']!=NULL){
$account['feature_armor_arrow']=$account['feature_armor_arrow']+$weaponright['feature_armor_arrow']*1.25;
}
if ($weaponright['feature_armor_weapon']!=NULL){
$account['feature_armor_weapon']=$account['feature_armor_weapon']+$weaponright['feature_armor_weapon']*1.25;
}
if ($weaponright['feature_armor_magic']!=NULL){
$account['feature_armor_magic']=$account['feature_armor_magic']+$weaponright['feature_armor_magic']*1.25;
}
if ($weaponright['feature_attack_arrow']!=NULL){
$account['feature_attack_arrow']=$account['feature_attack_arrow']+$weaponright['feature_attack_arrow']*1.50;
}
if ($weaponright['feature_attack_weapon']!=NULL){
$account['feature_attack_weapon']=$account['feature_attack_weapon']+$weaponright['feature_attack_weapon']*1.50;
}
if ($weaponright['feature_attack_magic']!=NULL){
$account['feature_attack_magic']=$account['feature_attack_magic']+$weaponright['feature_attack_magic']*1.50;
}
if ($weaponright['feature_hp_regen']!=NULL){
$account['hp_regen']=$account['hp_regen']+$weaponright['feature_hp_regen'];
}
if ($weaponright['feature_mp_regen']!=NULL){
$account['mp_regen']=$account['mp_regen']+$weaponright['feature_mp_regen'];
}
if ($weaponright['attack_min_damag']!=NULL && $weaponright['attack_max_damag']!=NULL){
$account['min_damag']=$account['min_damag']+$weaponright['attack_min_damag'];
$account['max_damag']=$account['max_damag']+$weaponright['attack_max_damag'];
}
}
if(!empty($account['weaponshield_left'])){ //Левая рука(оружие или щит)
$weaponshieldleft=mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id`='".$account['weaponshield_left']."'"));
if ($weaponshieldleft['feature_pover']!=NULL){
$account['power']=$account['power']+$weaponshieldleft['feature_power'];
}
if ($weaponshieldleft['feature_vitality']!=NULL){
$account['vitality']=$account['vitality']+$weaponshieldleft['feature_vitality'];
}
if ($weaponshieldleft['feature_dexterity']!=NULL){
$account['dexterity']=$account['dexterity']+$weaponshieldleft['feature_dexterity'];
}
if ($weaponshieldleft['feature_wit']!=NULL){
$account['wit']=$account['wit']+$weaponshieldleft['feature_wit'];
}
if ($weaponshieldleft['feature_spirit']!=NULL){
$account['spirit']=$account['spirit']+$weaponshieldleft['feature_spirit'];
}
if ($weaponshieldleft['feature_armor_arrow']!=NULL){
$account['feature_armor_arrow']=$account['feature_armor_arrow']+$weaponshieldleft['feature_armor_arrow']*1.25;
}
if ($weaponshieldleft['feature_armor_weapon']!=NULL){
$account['feature_armor_weapon']=$account['feature_armor_weapon']+$weaponshieldleft['feature_armor_weapon']*1.25;
}
if ($weaponshieldleft['feature_armor_magic']!=NULL){
$account['feature_armor_magic']=$account['feature_armor_magic']+$weaponshieldleft['feature_armor_magic']*1.25;
}
if ($weaponshieldleft['feature_attack_arrow']!=NULL){
$account['feature_attack_arrow']=$account['feature_attack_arrow']+$weaponshieldleft['feature_attack_arrow']*1.50;
}
if ($weaponshieldleft['feature_attack_weapon']!=NULL){
$account['feature_attack_weapon']=$account['feature_attack_weapon']+$weaponshieldleft['feature_attack_weapon']*1.50;
}
if ($weaponshieldleft['feature_attack_magic']!=NULL){
$account['feature_attack_magic']=$account['feature_attack_magic']+$weaponshieldleft['feature_attack_magic']*1.50;
}
if ($weaponshieldleft['feature_hp_regen']!=NULL){
$account['hp_regen']=$account['hp_regen']+$weaponshieldleft['feature_hp_regen'];
}
if ($weaponshieldleft['feature_mp_regen']!=NULL){
$account['mp_regen']=$account['mp_regen']+$weaponshieldleft['feature_mp_regen'];
}
if ($weaponshieldleft['attack_min_damag']!=NULL && $weaponshieldleft['attack_max_damag']!=NULL){
$account['min_damag']=$account['min_damag']+$weaponshieldleft['attack_min_damag'];
$account['max_damag']=$account['max_damag']+$weaponshieldleft['attack_max_damag'];
}
}
/************************************************************************************
****************************************Эффекты****************************************
****************************************************************************************/
/*************************************************************************************
************************Характеристики*************************************************
****************************************************************************************/
//Сложение
$addingmin=0.02*$account['power'];
$account['adding'] += round($account['power']-$addingmin);
//Воля
$willmin=0.02*$account['wit'];
$account['will'] += round($account['wit']-$willmin);
//Реакция
$reactionmin=0.02*$account['dexterity'];
$account['reaction'] += round($account['dexterity']-$reactionmin);
//Очки здоровья
$account['max_hp']+=100+(($account['vitality'] - 5)*11);
//Очки маны
$account['max_mp']+=100+(($account['wit'] - 5)*7);
//Защита от ударов
$armorweaponmin=floor($account['power']/2)*0.01;
$account['feature_armor_weapon']+=($account['power']*0.55)-$armorweaponmin;
//Защита от стрел
$armorarrowmin=floor($account['dexterity']/2)*0.01;
$account['feature_armor_arrow']+=($account['dexterity']*0.55)-$armorarrowmin;
//Защита от магии
$armormagicmin=floor($account['wit']/2)*0.01;
$account['feature_armor_magic']+=($account['wit']*0.55)-$armormagicmin;
//Урон от ударов
$account['feature_attack_weapon']+=floor($account['power']/2)*1;
//Урон от стрел
$account['feature_attack_arrow']+=floor($account['dexterity']/2)*1;
//Урон от магии
$account['feature_attack_magic']+=floor($account['wit']/2)*1;
//Восстановление жизни
$account['hp_regen']+=round(($account['power']*0.1)-(($account['power']*0.1)/2));
//Восстановление маны
$account['mp_regen']+=round(($account['spirit']*0.1)-(($account['spirit']*0.1)/2));
/****************Восстановление здоровья и маны**************************/
if (!$account['battle'] && !$account['duel_battle']){
$date=time();
$k_pointm=(time()-$account['last_mp'])*$account['mp_regen'];
$k_pointh=(time()-$account['last_hp'])*$account['hp_regen'];
$newhp=$account['hp']+$k_pointh;
$newmp=$account['mp']+$k_pointm;
if($newhp>$account['max_hp']){$newhp=$account['max_hp'];}
if($newmp>$account['max_mp']){$newmp=$account['max_mp'];}
mysql_query("UPDATE `account` SET `hp`='".$newhp."',`mp`='".$newmp."' WHERE `id`='".$account['id']."'");
//mysql_query("UPDATE `account SET `mp`='".$newmp."' WHERE `id` = '".$account['id']."' LIMIT 1");
mysql_query("UPDATE `account` SET `last_hp`='".$date."' WHERE `id`='".$account['id']."'");
mysql_query("UPDATE `account` SET `last_mp`='".$date."' WHERE `id`='".$account['id']."'");
$account['hp']=mysql_result(mysql_query("SELECT `hp` FROM `account` WHERE `id`='".$account['id']."'"),0);
$account['mp']=mysql_result(mysql_query("SELECT `mp` FROM `account` WHERE `id`='".$account['id']."'"),0);
}
//<Эффекты
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `effect`
WHERE (`account`='".$account['id']."' AND `target`='0') OR (`target_type`='user' AND `target`='".$account['id']."')"),0)){
$q=mysql_query("SELECT * FROM `effect`
WHERE (`account`='".$account['id']."' AND `target`='0') OR (`target_type`='user' AND `target`='".$account['id']."')");
while($result=mysql_fetch_assoc($q)){
if ($result['effect_hp_regen'] OR $result['effect_hp_regen_percent']){
if ($result['last_cast']-$result['time']>=$result['effect_time']){
mysql_query("DELETE FROM `effect` WHERE `id`='".$result['id']."'");
header("Location: ?");
exit;
}
if ($result['effect_hp_regen_percent']){
$result['effect_hp_regen']=floor($account['max_hp']/100)*$result['effect_hp_regen_percent'];
}
$col_hp_reg=floor(floor(time()-$result['last_cast'])/$result['effect_every_sec']);
if ($col_hp_reg){
for($d=1;$d<=$col_hp_reg;$d++){
$hps=floor($account['hp']+$result['effect_hp_regen']);
if ($hps>$account['max_hp']){
$hps=$account['max_hp'];
}
mysql_query("UPDATE `account` SET `hp`='".$hps."' WHERE `id`='".$account['id']."'");
mysql_query("INSERT INTO `battle_log`(
`account`,
`mess`)VALUES(
'".$account['id']."',
'<img src="/data/img/skill/".mysql_result(mysql_query("SELECT `icon` FROM `skill` WHERE `id`='".$result['skill']."'"),0).".jpg" width="10px" height="10px"><font color="#3d8e2f">Вы исцелились на ".$result['effect_hp_regen']." единиц</font>')");
mysql_query("UPDATE `effect` SET `last_cast`='".($result['last_cast']+$result['effect_every_sec'])."' WHERE `id`='".$result['id']."'");
$result['last_cast']=mysql_result(mysql_query("SELECT `last_cast` FROM `effect` WHERE `id`='".$result['id']."'"),0);
if ($result['last_cast']-$result['time']>=$result['effect_time']){
mysql_query("DELETE FROM `effect` WHERE `id`='".$result['id']."'");
header("Location: ?");
exit;
}
$account['hp']=mysql_result(mysql_query("SELECT `hp` FROM `account` WHERE `id`='".$account['id']."'"),0);
}
}
}
}
}
///Эффекты
if ($account['battle'] || $account['duel_battle']){
if ($_SERVER['PHP_SELF']!='/battle.php'){header("Location: /battle.php");}
}
}else{
header ("Location: /?"); exit;
}
?>