Файл: www/battle.php
Строк: 3441
<?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){
if ($account['battle']){
if (isset($_GET['target_type']) AND isset($_GET['target']) AND is_numeric($_GET['target'])){
$target=intval($_GET['target']);
if ($_GET['target_type']=='mob'){
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `mobs`
WHERE `id`='".$target."'
AND `battle`='".$account['battle']."'"),0)){
mysql_query("UPDATE `account` SET
`battle_attack`='".$target."',
`battle_target_type`='mob'
WHERE
`id`='".$account['id']."'");
header("Location: ?");
exit;
}else{
header("Location: ?");
exit;
}
}elseif($_GET['target_type']=='user'){
if(mysql_result(mysql_query("SELECT COUNT(*) FROM `account`
WHERE `id`='".$target."'
AND `battle`='".$account['battle']."'"),0)){
mysql_query("UPDATE `account` SET
`battle_attack`='".$target."',
`battle_target_type`='user'
WHERE
`id`='".$account['id']."'");
header("Location: ?");
exit;
}else{
header("Location: ?");
exit;
}
}
}
if ($account['battle_target_type']=='mob' && $account['battle_attack']){
$mob=mysql_fetch_array(mysql_query("SELECT * FROM `mobs` WHERE
`id`='".$account['battle_attack']."'"));
$mob['expee'] = round($mobe['exp']/2);
$mob['drop_goldee'] = round($mob['drop_gold']/2);
$mob['exp'] = rand($mob['expee'],$mob['exp']);
$mob['drop_gold'] = rand($mob['drop_goldee'],$mob['drop_gold']);
$mob['exp']=round($mob['exp']/$account['lvl'])*$mob['lvl'];
}else{
$mob=mysql_fetch_array(mysql_query("SELECT * FROM `account` WHERE
`id`='".$account['battle_attack']."'"));
}
/*************Обнуляем характеристики************/
//Сложение
$mob['adding'] = 0;
//Воля
$mob['will'] = 0;
//Реакция
$mob['reaction'] = 0;
if ($account['battle_target_type']=='user'){
$mob['max_hp']=0;
$mob['max_mp']=0;
//Восстановление жизни
$mob['hp_regen']=0;
//Восстановление маны
$mob['mp_regen']=0;
//Минимальный урон(оружие)
$mob['min_damag']=0;
//Максимальный урон(оружие)
$mob['max_damag']=0;
}
//Защита от ударов
$mob['feature_armor_weapon']=0;
//Защита от стрел
$mob['feature_armor_arrow']=0;
//Защита от магии
$mob['feature_armor_magic']=0;
//Урон от ударов
$mob['feature_attack_weapon']=0;
//Урон от стрел
$mob['feature_attack_arrow']=0;
//Урон от магии
$mob['feature_attack_magic']=0;
////Bonus by shmot
if ($account['battle_target_type']=='user'){
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `effect` WHERE `baph`='1' AND `account`='".$mob['id']."' OR (`target_type`='user' AND `target`='".$mob['id']."')"),0)){
$qb=mysql_query("SELECT * FROM `effect` WHERE `baph`='1' AND `account`='".$mob['id']."' OR (`target_type`='user' AND `target`='".$mob['id']."')");
while($resultb=mysql_fetch_assoc($qb)){
if (time()-$resultb['time']>=$resultb['effect_time']){
mysql_query("DELETE FROM `effect` WHERE `id`='".$resultb['id']."'");
break;
}
//Сложение
$mob['adding']+=$resultb['baph_adding'];
//Воля
$mob['will']+=$resultb['baph_will'];
//Реакция
$mob['reaction']+=$resultb['baph_reaction'];
//Очки здоровья
$mob['max_hp']+=$resultb['baph_max_hp'];
//Очки маны
$mob['max_mp']+=$resultb['baph_max_mp'];
//Защита от ударов
$mob['feature_armor_weapon']+=$resultb['baph_feature_armor_weapon'];
//Защита от стрел
$mob['feature_armor_arrow']+=$resultb['baph_feature_armor_arrow'];
//Защита от магии
$mob['feature_armor_magic']+=$resultb['baph_feature_armor_magic'];
//Урон от ударов
$mob['feature_attack_weapon']+=$resultb['baph_feature_attack_weapon'];
//Урон от стрел
$mob['feature_attack_arrow']+=$resultb['baph_feature_attack_arrow'];
//Урон от магии
$mob['feature_attack_magic']+=$resultb['baph_feature_attack_magic'];
//Восстановление жизни
$mob['hp_regen']+=$resultb['baph_hp_regen'];
//Восстановление маны
$mob['mp_regen']+=$resultb['baph_mp_regen'];
//Power
$mob['power']+=$resultb['baph_power'];
//Wit
$mob['wit']+=$resultb['baph_wit'];
//Dexterity
$mob['dexterity']+=$resultb['baph_dexterity'];
//Vitality
$mob['vitality']+=$resultb['baph_vitality'];
//Spirit
$mob['spirit']+=$resultb['baph_spirit'];
}
}
/**********************************************************************************************************************
*******************************************Бонусы характеристик от вещей************************************************
*************************************************************************************************************************/
if(!empty($mob['armor_head'])){ //Шлем
$head=mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id`='".$mob['armor_head']."'"));
if ($head['feature_pover']!=NULL){
$mob['power']=$mob['power']+$head['feature_power'];
}
if ($head['feature_vitality']!=NULL){
$mob['vitality']=$mob['vitality']+$head['feature_vitality'];
}
if ($head['feature_dexterity']!=NULL){
$mob['dexterity']=$mob['dexterity']+$head['feature_dexterity'];
}
if ($head['feature_wit']!=NULL){
$mob['wit']=$mob['wit']+$head['feature_wit'];
}
if ($head['feature_spirit']!=NULL){
$mob['spirit']=$mob['spirit']+$head['feature_spirit'];
}
if ($head['feature_armor_arrow']!=NULL){
$mob['feature_armor_arrow']=$mob['feature_armor_arrow']+$head['feature_armor_arrow']*1.25;
}
if ($head['feature_armor_weapon']!=NULL){
$mob['feature_armor_weapon']=$mob['feature_armor_weapon']+$head['feature_armor_weapon']*1.25;
}
if ($head['feature_armor_magic']!=NULL){
$mob['feature_armor_magic']=$mob['feature_armor_magic']+$head['feature_armor_magic']*1.25;
}
if ($head['feature_attack_arrow']!=NULL){
$mob['feature_attack_arrow']=$mob['feature_attack_arrow']+$head['feature_attack_arrow']*1.50;
}
if ($head['feature_attack_weapon']!=NULL){
$mob['feature_attack_weapon']=$mob['feature_attack_weapon']+$head['feature_attack_weapon']*1.50;
}
if ($head['feature_attack_magic']!=NULL){
$mob['feature_attack_magic']=$mob['feature_attack_magic']+$head['feature_attack_magic']*1.50;
}
if ($head['feature_hp_regen']!=NULL){
$mob['hp_regen']=$mob['hp_regen']+$head['feature_hp_regen'];
}
if ($head['feature_mp_regen']!=NULL){
$mob['mp_regen']=$mob['mp_regen']+$head['feature_mp_regen'];
}
}
if(!empty($mob['armor_body'])){ //Нагрудник
$body=mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id`='".$mob['armor_body']."'"));
if ($body['feature_pover']!=NULL){
$mob['power']=$mob['power']+$body['feature_power'];
}
if ($body['feature_vitality']!=NULL){
$mob['vitality']=$mob['vitality']+$body['feature_vitality'];
}
if ($body['feature_dexterity']!=NULL){
$mob['dexterity']=$mob['dexterity']+$body['feature_dexterity'];
}
if ($body['feature_wit']!=NULL){
$mob['wit']=$mob['wit']+$body['feature_wit'];
}
if ($body['feature_spirit']!=NULL){
$mob['spirit']=$mob['spirit']+$body['feature_spirit'];
}
if ($body['feature_armor_arrow']!=NULL){
$mob['feature_armor_arrow']=$mob['feature_armor_arrow']+$body['feature_armor_arrow']*1.25;
}
if ($body['feature_armor_weapon']!=NULL){
$mob['feature_armor_weapon']=$mob['feature_armor_weapon']+$body['feature_armor_weapon']*1.25;
}
if ($body['feature_armor_magic']!=NULL){
$mob['feature_armor_magic']=$mob['feature_armor_magic']+$body['feature_armor_magic']*1.25;
}
if ($body['feature_attack_arrow']!=NULL){
$mob['feature_attack_arrow']=$mob['feature_attack_arrow']+$body['feature_attack_arrow']*1.50;
}
if ($body['feature_attack_weapon']!=NULL){
$mob['feature_attack_weapon']=$mob['feature_attack_weapon']+$body['feature_attack_weapon']*1.50;
}
if ($body['feature_attack_magic']!=NULL){
$mob['feature_attack_magic']=$mob['feature_attack_magic']+$body['feature_attack_magic']*1.50;
}
if ($body['feature_hp_regen']!=NULL){
$mob['hp_regen']=$mob['hp_regen']+$body['feature_hp_regen'];
}
if ($body['feature_mp_regen']!=NULL){
$mob['mp_regen']=$mob['mp_regen']+$body['feature_mp_regen'];
}
}
if(!empty($mob['armor_pants'])){ //Набедреник
$pants=mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id`='".$mob['armor_pants']."'"));
if ($pants['feature_pover']!=NULL){
$mob['power']=$mob['power']+$pants['feature_power'];
}
if ($pants['feature_vitality']!=NULL){
$mob['vitality']=$mob['vitality']+$pants['feature_vitality'];
}
if ($pants['feature_dexterity']!=NULL){
$mob['dexterity']=$mob['dexterity']+$pants['feature_dexterity'];
}
if ($pants['feature_wit']!=NULL){
$mob['wit']=$mob['wit']+$pants['feature_wit'];
}
if ($pants['feature_spirit']!=NULL){
$mob['spirit']=$mob['spirit']+$pants['feature_spirit'];
}
if ($pants['feature_armor_arrow']!=NULL){
$mob['feature_armor_arrow']=$mob['feature_armor_arrow']+$pants['feature_armor_arrow']*1.25;
}
if ($pants['feature_armor_weapon']!=NULL){
$mob['feature_armor_weapon']=$mob['feature_armor_weapon']+$pants['feature_armor_weapon']*1.25;
}
if ($pants['feature_armor_magic']!=NULL){
$mob['feature_armor_magic']=$mob['feature_armor_magic']+$pants['feature_armor_magic']*1.25;
}
if ($pants['feature_attack_arrow']!=NULL){
$mob['feature_attack_arrow']=$mob['feature_attack_arrow']+$pants['feature_attack_arrow']*1.50;
}
if ($pants['feature_attack_weapon']!=NULL){
$mob['feature_attack_weapon']=$mob['feature_attack_weapon']+$pants['feature_attack_weapon']*1.50;
}
if ($pants['feature_attack_magic']!=NULL){
$mob['feature_attack_magic']=$mob['feature_attack_magic']+$pants['feature_attack_magic']*1.50;
}
if ($pants['feature_hp_regen']!=NULL){
$mob['hp_regen']=$mob['hp_regen']+$pants['feature_hp_regen'];
}
if ($pants['feature_mp_regen']!=NULL){
$mob['mp_regen']=$mob['mp_regen']+$pants['feature_mp_regen'];
}
}
if(!empty($mob['armor_gloves'])){ //Набедреник
$gloves=mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id`='".$mob['armor_gloves']."'"));
if ($gloves['feature_pover']!=NULL){
$mob['power']=$mob['power']+$gloves['feature_power'];
}
if ($gloves['feature_vitality']!=NULL){
$mob['vitality']=$mob['vitality']+$gloves['feature_vitality'];
}
if ($gloves['feature_dexterity']!=NULL){
$mob['dexterity']=$mob['dexterity']+$gloves['feature_dexterity'];
}
if ($gloves['feature_wit']!=NULL){
$mob['wit']=$mob['wit']+$gloves['feature_wit'];
}
if ($gloves['feature_spirit']!=NULL){
$mob['spirit']=$mob['spirit']+$gloves['feature_spirit'];
}
if ($gloves['feature_armor_arrow']!=NULL){
$mob['feature_armor_arrow']=$mob['feature_armor_arrow']+$gloves['feature_armor_arrow']*1.25;
}
if ($gloves['feature_armor_weapon']!=NULL){
$mob['feature_armor_weapon']=$mob['feature_armor_weapon']+$gloves['feature_armor_weapon']*1.25;
}
if ($gloves['feature_armor_magic']!=NULL){
$mob['feature_armor_magic']=$mob['feature_armor_magic']+$gloves['feature_armor_magic']*1.25;
}
if ($gloves['feature_attack_arrow']!=NULL){
$mob['feature_attack_arrow']=$mob['feature_attack_arrow']+$gloves['feature_attack_arrow']*1.50;
}
if ($gloves['feature_attack_weapon']!=NULL){
$mob['feature_attack_weapon']=$mob['feature_attack_weapon']+$gloves['feature_attack_weapon']*1.50;
}
if ($gloves['feature_attack_magic']!=NULL){
$mob['feature_attack_magic']=$mob['feature_attack_magic']+$gloves['feature_attack_magic']*1.50;
}
if ($gloves['feature_hp_regen']!=NULL){
$mob['hp_regen']=$mob['hp_regen']+$gloves['feature_hp_regen'];
}
if ($gloves['feature_mp_regen']!=NULL){
$mob['mp_regen']=$mob['mp_regen']+$gloves['feature_mp_regen'];
}
}
if(!empty($mob['armor_belt'])){ //Пояс
$belt=mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id`='".$mob['armor_belt']."'"));
if ($belt['feature_pover']!=NULL){
$mob['power']=$mob['power']+$belt['feature_power'];
}
if ($belt['feature_vitality']!=NULL){
$mob['vitality']=$mob['vitality']+$belt['feature_vitality'];
}
if ($belt['feature_dexterity']!=NULL){
$mob['dexterity']=$mob['dexterity']+$belt['feature_dexterity'];
}
if ($belt['feature_wit']!=NULL){
$mob['wit']=$mob['wit']+$belt['feature_wit'];
}
if ($belt['feature_spirit']!=NULL){
$mob['spirit']=$mob['spirit']+$belt['feature_spirit'];
}
if ($belt['feature_armor_arrow']!=NULL){
$mob['feature_armor_arrow']=$mob['feature_armor_arrow']+$belt['feature_armor_arrow']*1.25;
}
if ($belt['feature_armor_weapon']!=NULL){
$mob['feature_armor_weapon']=$mob['feature_armor_weapon']+$belt['feature_armor_weapon']*1.25;
}
if ($belt['feature_armor_magic']!=NULL){
$mob['feature_armor_magic']=$mob['feature_armor_magic']+$belt['feature_armor_magic']*1.25;
}
if ($belt['feature_attack_arrow']!=NULL){
$mob['feature_attack_arrow']=$mob['feature_attack_arrow']+$belt['feature_attack_arrow']*1.50;
}
if ($belt['feature_attack_weapon']!=NULL){
$mob['feature_attack_weapon']=$mob['feature_attack_weapon']+$belt['feature_attack_weapon']*1.50;
}
if ($belt['feature_attack_magic']!=NULL){
$mob['feature_attack_magic']=$mob['feature_attack_magic']+$belt['feature_attack_magic']*1.50;
}
if ($belt['feature_hp_regen']!=NULL){
$mob['hp_regen']=$mob['hp_regen']+$belt['feature_hp_regen'];
}
if ($belt['feature_mp_regen']!=NULL){
$mob['mp_regen']=$mob['mp_regen']+$belt['feature_mp_regen'];
}
}
if(!empty($mob['armor_ring'])){ //Кольцо
$ring=mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id`='".$mob['armor_ring']."'"));
if ($ring['feature_pover']!=NULL){
$mob['power']=$mob['power']+$ring['feature_power'];
}
if ($ring['feature_vitality']!=NULL){
$mob['vitality']=$mob['vitality']+$ring['feature_vitality'];
}
if ($ring['feature_dexterity']!=NULL){
$mob['dexterity']=$mob['dexterity']+$ring['feature_dexterity'];
}
if ($ring['feature_wit']!=NULL){
$mob['wit']=$mob['wit']+$ring['feature_wit'];
}
if ($ring['feature_spirit']!=NULL){
$mob['spirit']=$mob['spirit']+$ring['feature_spirit'];
}
if ($ring['feature_armor_arrow']!=NULL){
$mob['feature_armor_arrow']=$mob['feature_armor_arrow']+$ring['feature_armor_arrow']*1.25;
}
if ($ring['feature_armor_weapon']!=NULL){
$mob['feature_armor_weapon']=$mob['feature_armor_weapon']+$ring['feature_armor_weapon']*1.25;
}
if ($ring['feature_armor_magic']!=NULL){
$mob['feature_armor_magic']=$mob['feature_armor_magic']+$ring['feature_armor_magic']*1.25;
}
if ($ring['feature_attack_arrow']!=NULL){
$mob['feature_attack_arrow']=$mob['feature_attack_arrow']+$ring['feature_attack_arrow']*1.50;
}
if ($ring['feature_attack_weapon']!=NULL){
$mob['feature_attack_weapon']=$mob['feature_attack_weapon']+$ring['feature_attack_weapon']*1.50;
}
if ($ring['feature_attack_magic']!=NULL){
$mob['feature_attack_magic']=$mob['feature_attack_magic']+$ring['feature_attack_magic']*1.50;
}
if ($ring['feature_hp_regen']!=NULL){
$mob['hp_regen']=$mob['hp_regen']+$ring['feature_hp_regen'];
}
if ($ring['feature_mp_regen']!=NULL){
$mob['mp_regen']=$mob['mp_regen']+$ring['feature_mp_regen'];
}
}
if(!empty($mob['armor_neckleace'])){ //Ожерелье
$neckleace=mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id`='".$mob['armor_neckleace']."'"));
if ($neckleace['feature_pover']!=NULL){
$mob['power']=$mob['power']+$neckleace['feature_power'];
}
if ($neckleace['feature_vitality']!=NULL){
$mob['vitality']=$mob['vitality']+$neckleace['feature_vitality'];
}
if ($neckleace['feature_dexterity']!=NULL){
$mob['dexterity']=$mob['dexterity']+$neckleace['feature_dexterity'];
}
if ($neckleace['feature_wit']!=NULL){
$mob['wit']=$mob['wit']+$neckleace['feature_wit'];
}
if ($neckleace['feature_spirit']!=NULL){
$mob['spirit']=$mob['spirit']+$neckleace['feature_spirit'];
}
if ($neckleace['feature_armor_arrow']!=NULL){
$mob['feature_armor_arrow']=$mob['feature_armor_arrow']+$neckleace['feature_armor_arrow']*1.25;
}
if ($neckleace['feature_armor_weapon']!=NULL){
$mob['feature_armor_weapon']=$mob['feature_armor_weapon']+$neckleace['feature_armor_weapon']*1.25;
}
if ($neckleace['feature_armor_magic']!=NULL){
$mob['feature_armor_magic']=$mob['feature_armor_magic']+$neckleace['feature_armor_magic']*1.25;
}
if ($neckleace['feature_attack_arrow']!=NULL){
$mob['feature_attack_arrow']=$mob['feature_attack_arrow']+$neckleace['feature_attack_arrow']*1.50;
}
if ($neckleace['feature_attack_weapon']!=NULL){
$mob['feature_attack_weapon']=$mob['feature_attack_weapon']+$neckleace['feature_attack_weapon']*1.50;
}
if ($neckleace['feature_attack_magic']!=NULL){
$mob['feature_attack_magic']=$mob['feature_attack_magic']+$neckleace['feature_attack_magic']*1.50;
}
if ($neckleace['feature_hp_regen']!=NULL){
$mob['hp_regen']=$mob['hp_regen']+$neckleace['feature_hp_regen'];
}
if ($neckleace['feature_mp_regen']!=NULL){
$mob['mp_regen']=$mob['mp_regen']+$neckleace['feature_mp_regen'];
}
}
if(!empty($mob['armor_earring'])){ //Серьги
$earring=mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id`='".$mob['armor_earring']."'"));
if ($earring['feature_pover']!=NULL){
$mob['power']=$mob['power']+$earring['feature_power'];
}
if ($earring['feature_vitality']!=NULL){
$mob['vitality']=$mob['vitality']+$earring['feature_vitality'];
}
if ($earring['feature_dexterity']!=NULL){
$mob['dexterity']=$mob['dexterity']+$earring['feature_dexterity'];
}
if ($earring['feature_wit']!=NULL){
$mob['wit']=$mob['wit']+$earring['feature_wit'];
}
if ($earring['feature_spirit']!=NULL){
$mob['spirit']=$mob['spirit']+$earring['feature_spirit'];
}
if ($earring['feature_armor_arrow']!=NULL){
$mob['feature_armor_arrow']=$mob['feature_armor_arrow']+$earring['feature_armor_arrow']*1.25;
}
if ($earring['feature_armor_weapon']!=NULL){
$mob['feature_armor_weapon']=$mob['feature_armor_weapon']+$earring['feature_armor_weapon']*1.25;
}
if ($earring['feature_armor_magic']!=NULL){
$mob['feature_armor_magic']=$mob['feature_armor_magic']+$earring['feature_armor_magic']*1.25;
}
if ($earring['feature_attack_arrow']!=NULL){
$mob['feature_attack_arrow']=$mob['feature_attack_arrow']+$earring['feature_attack_arrow']*1.50;
}
if ($earring['feature_attack_weapon']!=NULL){
$mob['feature_attack_weapon']=$mob['feature_attack_weapon']+$earring['feature_attack_weapon']*1.50;
}
if ($earring['feature_attack_magic']!=NULL){
$mob['feature_attack_magic']=$mob['feature_attack_magic']+$earring['feature_attack_magic']*1.50;
}
if ($earring['feature_hp_regen']!=NULL){
$mob['hp_regen']=$mob['hp_regen']+$earring['feature_hp_regen'];
}
if ($earring['feature_mp_regen']!=NULL){
$mob['mp_regen']=$mob['mp_regen']+$earring['feature_mp_regen'];
}
}
if(!empty($mob['armor_shoulder'])){ //Ожерелье
$shoulder=mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id`='".$mob['armor_shoulder']."'"));
if ($shoulder['feature_pover']!=NULL){
$mob['power']=$mob['power']+$shoulder['feature_power'];
}
if ($shoulder['feature_vitality']!=NULL){
$mob['vitality']=$mob['vitality']+$shoulder['feature_vitality'];
}
if ($shoulder['feature_dexterity']!=NULL){
$mob['dexterity']=$mob['dexterity']+$shoulder['feature_dexterity'];
}
if ($shoulder['feature_wit']!=NULL){
$mob['wit']=$mob['wit']+$shoulder['feature_wit'];
}
if ($shoulder['feature_spirit']!=NULL){
$mob['spirit']=$mob['spirit']+$shoulder['feature_spirit'];
}
if ($shoulder['feature_armor_arrow']!=NULL){
$mob['feature_armor_arrow']=$mob['feature_armor_arrow']+$shoulder['feature_armor_arrow']*1.25;
}
if ($shoulder['feature_armor_weapon']!=NULL){
$mob['feature_armor_weapon']=$mob['feature_armor_weapon']+$shoulder['feature_armor_weapon']*1.25;
}
if ($shoulder['feature_armor_magic']!=NULL){
$mob['feature_armor_magic']=$mob['feature_armor_magic']+$shoulder['feature_armor_magic']*1.25;
}
if ($shoulder['feature_attack_arrow']!=NULL){
$mob['feature_attack_arrow']=$mob['feature_attack_arrow']+$shoulder['feature_attack_arrow']*1.50;
}
if ($shoulder['feature_attack_weapon']!=NULL){
$mob['feature_attack_weapon']=$mob['feature_attack_weapon']+$shoulder['feature_attack_weapon']*1.50;
}
if ($shoulder['feature_attack_magic']!=NULL){
$mob['feature_attack_magic']=$mob['feature_attack_magic']+$shoulder['feature_attack_magic']*1.50;
}
if ($shoulder['feature_hp_regen']!=NULL){
$mob['hp_regen']=$mob['hp_regen']+$shoulder['feature_hp_regen'];
}
if ($shoulder['feature_mp_regen']!=NULL){
$mob['mp_regen']=$mob['mp_regen']+$shoulder['feature_mp_regen'];
}
}
if(!empty($mob['weapon_right'])){ //Левая рука(оружие)
$weaponright=mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id`='".$mob['weapon_right']."'"));
if ($weaponright['feature_pover']!=NULL){
$mob['power']=$mob['power']+$weaponright['feature_power'];
}
if ($weaponright['feature_vitality']!=NULL){
$mob['vitality']=$mob['vitality']+$weaponright['feature_vitality'];
}
if ($weaponright['feature_dexterity']!=NULL){
$mob['dexterity']=$mob['dexterity']+$weaponright['feature_dexterity'];
}
if ($weaponright['feature_wit']!=NULL){
$mob['wit']=$mob['wit']+$weaponright['feature_wit'];
}
if ($weaponright['feature_spirit']!=NULL){
$mob['spirit']=$mob['spirit']+$weaponright['feature_spirit'];
}
if ($weaponright['feature_armor_arrow']!=NULL){
$mob['feature_armor_arrow']=$mob['feature_armor_arrow']+$weaponright['feature_armor_arrow']*1.25;
}
if ($weaponright['feature_armor_weapon']!=NULL){
$mob['feature_armor_weapon']=$mob['feature_armor_weapon']+$weaponright['feature_armor_weapon']*1.25;
}
if ($weaponright['feature_armor_magic']!=NULL){
$mob['feature_armor_magic']=$mob['feature_armor_magic']+$weaponright['feature_armor_magic']*1.25;
}
if ($weaponright['feature_attack_arrow']!=NULL){
$mob['feature_attack_arrow']=$mob['feature_attack_arrow']+$weaponright['feature_attack_arrow']*1.50;
}
if ($weaponright['feature_attack_weapon']!=NULL){
$mob['feature_attack_weapon']=$mob['feature_attack_weapon']+$weaponright['feature_attack_weapon']*1.50;
}
if ($weaponright['feature_attack_magic']!=NULL){
$mob['feature_attack_magic']=$mob['feature_attack_magic']+$weaponright['feature_attack_magic']*1.50;
}
if ($weaponright['feature_hp_regen']!=NULL){
$mob['hp_regen']=$mob['hp_regen']+$weaponright['feature_hp_regen'];
}
if ($weaponright['feature_mp_regen']!=NULL){
$mob['mp_regen']=$mob['mp_regen']+$weaponright['feature_mp_regen'];
}
if ($weaponright['attack_min_damag']!=NULL && $weaponright['attack_max_damag']!=NULL){
$mob['min_damag']=$mob['min_damag']+$weaponright['attack_min_damag'];
$mob['max_damag']=$mob['max_damag']+$weaponright['attack_max_damag'];
}
}
if(!empty($mob['weaponshield_left'])){ //Левая рука(оружие или щит)
$weaponshieldleft=mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id`='".$mob['weaponshield_left']."'"));
if ($weaponshieldleft['feature_pover']!=NULL){
$mob['power']=$mob['power']+$weaponshieldleft['feature_power'];
}
if ($weaponshieldleft['feature_vitality']!=NULL){
$mob['vitality']=$mob['vitality']+$weaponshieldleft['feature_vitality'];
}
if ($weaponshieldleft['feature_dexterity']!=NULL){
$mob['dexterity']=$mob['dexterity']+$weaponshieldleft['feature_dexterity'];
}
if ($weaponshieldleft['feature_wit']!=NULL){
$mob['wit']=$mob['wit']+$weaponshieldleft['feature_wit'];
}
if ($weaponshieldleft['feature_spirit']!=NULL){
$mob['spirit']=$mob['spirit']+$weaponshieldleft['feature_spirit'];
}
if ($weaponshieldleft['feature_armor_arrow']!=NULL){
$mob['feature_armor_arrow']=$mob['feature_armor_arrow']+$weaponshieldleft['feature_armor_arrow']*1.25;
}
if ($weaponshieldleft['feature_armor_weapon']!=NULL){
$mob['feature_armor_weapon']=$mob['feature_armor_weapon']+$weaponshieldleft['feature_armor_weapon']*1.25;
}
if ($weaponshieldleft['feature_armor_magic']!=NULL){
$mob['feature_armor_magic']=$mob['feature_armor_magic']+$weaponshieldleft['feature_armor_magic']*1.25;
}
if ($weaponshieldleft['feature_attack_arrow']!=NULL){
$mob['feature_attack_arrow']=$mob['feature_attack_arrow']+$weaponshieldleft['feature_attack_arrow']*1.50;
}
if ($weaponshieldleft['feature_attack_weapon']!=NULL){
$mob['feature_attack_weapon']=$mob['feature_attack_weapon']+$weaponshieldleft['feature_attack_weapon']*1.50;
}
if ($weaponshieldleft['feature_attack_magic']!=NULL){
$mob['feature_attack_magic']=$mob['feature_attack_magic']+$weaponshieldleft['feature_attack_magic']*1.50;
}
if ($weaponshieldleft['feature_hp_regen']!=NULL){
$mob['hp_regen']=$mob['hp_regen']+$weaponshieldleft['feature_hp_regen'];
}
if ($weaponshieldleft['feature_mp_regen']!=NULL){
$mob['mp_regen']=$mob['mp_regen']+$weaponshieldleft['feature_mp_regen'];
}
if ($weaponshieldleft['attack_min_damag']!=NULL && $weaponshieldleft['attack_max_damag']!=NULL){
$mob['min_damag']=$mob['min_damag']+$weaponshieldleft['attack_min_damag'];
$mob['max_damag']=$mob['max_damag']+$weaponshieldleft['attack_max_damag'];
}
}
}
///Bonus by shmot
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `effect` WHERE
`debaph`='1'
AND `target_type`='mob'
AND `target`='".$mob['id']."'"),0) && $account['battle_target_type']=='mob'){
$qdb=mysql_query("SELECT * FROM `effect` WHERE
`debaph`='1'
AND `target_type`='mob'
AND `target`='".$mob['id']."'");
while($resultdb=mysql_fetch_assoc($qdb)){
if (time()-$resultdb['time']>=$resultdb['effect_time']){
mysql_query("DELETE FROM `effect` WHERE `id`='".$resultdb['id']."'");
header("Location: ?");
exit;
}
//Сложение
$mob['adding']-=$resultdb['baph_adding'];
//Воля
$mob['will']-=$resultdb['baph_will'];
//Реакция
$mob['reaction']-=$resultdb['baph_reaction'];
//Очки здоровья
$mob['max_hp']-=$resultdb['baph_max_hp'];
//Очки маны
$mob['max_mp']-=$resultdb['baph_max_mp'];
//Защита от ударов
$mob['feature_armor_weapon']-=$resultdb['baph_feature_armor_weapon'];
//Защита от стрел
$mob['feature_armor_arrow']-=$resultdb['baph_feature_armor_arrow'];
//Защита от магии
$mob['feature_armor_magic']-=$resultdb['baph_feature_armor_magic'];
//Урон от ударов
$mob['feature_attack_weapon']-=$resultdb['baph_feature_attack_weapon'];
//Урон от стрел
$mob['feature_attack_arrow']-=$resultdb['baph_feature_attack_arrow'];
//Урон от магии
$mob['feature_attack_magic']-=$resultdb['baph_feature_attack_magic'];
//Восстановление жизни
$mob['hp_regen']-=$resultdb['baph_hp_regen'];
//Восстановление маны
$mob['mp_regen']-=$resultdb['baph_mp_regen'];
//Power
$mob['power']-=$resultdb['baph_power'];
//Wit
$mob['wit']-=$resultdb['baph_wit'];
//Dexterity
$mob['dexterity']-=$resultdb['baph_dexterity'];
//Vitality
$mob['vitality']-=$resultdb['baph_vitality'];
//Spirit
$mob['spirit']-=$resultdb['baph_spirit'];
foreach($mob as $key=>$value){
if (is_numeric($value)){
if ($value<0){
$mob[$key]=0;
}
}
}
}
}
/*************************************************************************************
************************Характеристики*************************************************
****************************************************************************************/
//Сложение
$addingmin=0.02*$mob['power'];
$mob['adding'] += ceil($mob['power']-$addingmin);
//Воля
$willmin=0.02*$mob['wit'];
$mob['will'] += ceil($mob['wit']-$willmin);
//Реакция
$reactionmin=0.02*$mob['dexterity'];
$mob['reaction'] += ceil($mob['dexterity']-$reactionmin);
if ($account['battle_target_type']=='user'){
//Очки здоровья
$mob['max_hp']+=100+(($mob['vitality'] - 5)*11);
//Очки маны
$mob['max_mp']+=100+(($mob['wit'] - 5)*7);
}
//Защита от ударов
$armorweaponmin=floor($mob['power']/2)*0.01;
$mob['feature_armor_weapon']+=($mob['power']*0.55)-$armorweaponmin;
//Защита от стрел
$armorarrowmin=floor($mob['dexterity']/2)*0.01;
$mob['feature_armor_arrow']+=($mob['dexterity']*0.55)-$armorarrowmin;
//Защита от магии
$armormagicmin=floor($mob['wit']/2)*0.01;
$mob['feature_armor_magic']+=($mob['wit']*0.55)-$armormagicmin;
//Урон от ударов
$mob['feature_attack_weapon']+=floor($mob['power']/2)*1;
//Урон от стрел
$mob['feature_attack_arrow']+=floor($mob['dexterity']/2)*1;
//Урон от магии
$mob['feature_attack_magic']+=floor($mob['wit']/2)*1;
//атака моба
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `effect` WHERE
`stun`='1'
OR `paralich`='1'
OR `fear`='1'
OR `sleep`='1'
AND `target_type`='mob'
AND `target`='".$mob['id']."'"),0) && $account['battle_target_type']=='mob'){
$querystun=mysql_query("SELECT * FROM `effect` WHERE
`stun`='1'
OR `paralich`='1'
OR `fear`='1'
OR `sleep`='1'
AND (`target_type`='mob' AND `target`='".$mob['id']."')");
while($resultstun=mysql_fetch_assoc($querystun)){
if ($resultstun['stun']){
if (time()-$resultstun['time']>=$resultstun['effect_time']){
mysql_query("DELETE FROM `effect`
WHERE `id`='".$resultstun['id']."'");
}else{
mysql_query("UPDATE `mobs` SET
`last_damag`='".time()."'
WHERE
`id`='".$mob['id']."'");
}
}elseif($resultstun['paralich']){
if (time()-$resultstun['time']>=$resultstun['effect_time']){
mysql_query("DELETE FROM `effect` WHERE
`id`='".$resultstun['id']."'");
}else{
mysql_query("UPDATE `mobs` SET
`last_damag`='".time()."'
WHERE
`id`='".$mob['id']."'");
}
}elseif($resultstun['sleep']){
if (time()-$resultstun['time']>=$resultstun['effect_time']){
mysql_query("DELETE FROM `effect` WHERE
`id`='".$resultstun['id']."'");
}else{
mysql_query("UPDATE `mobs` SET
`last_damag`='".time()."'
WHERE
`id`='".$mob['id']."'");
}
}elseif($resultstun['fear']){
if (time()-$resultstun['time']>=$resultstun['effect_time']){
mysql_query("DELETE FROM `effect`
WHERE
`id`='".$resultstun['id']."'");
}else{
mysql_query("UPDATE `mobs` SET
`last_damag`='".time()."'
WHERE
`id`='".$mob['id']."'");
}
}
$mob['last_damag']=mysql_result(mysql_query("SELECT `last_damag` FROM `mobs`
WHERE
`id`='".$mob['id']."'"),0);
}
}
$cntatck=0;
$battlemobs=mysql_query("SELECT * FROM `mobs` WHERE `battle`='".$account['battle']."'");
while($resmob=mysql_fetch_assoc($battlemobs)){
if (!mysql_result(mysql_query("SELECT COUNT(*) FROM `account` WHERE `battle`='".$resmob['battle']."' AND `id`='".$resmob['battle_attack']."'"),0)){
$qrtargets=mysql_fetch_assoc(mysql_query("SELECT * FROM `account` WHERE `battle`='".$resmob['battle']."' ORDER BY `lvl` DESC LIMIT 1"));
mysql_query("UPDATE `mobs` SET
`last_damag`='".time()."',
`battle_attack`='".$qrtargets['id']."'
WHERE `id`='".$resmob['id']."'");
}else{
$attackcol=intval((time()-$resmob['last_damag'])/$resmob['damag_every_sec']);
//echo $attackcol;
for ($i=1;$i<=$attackcol;$i++){
$targete=mysql_fetch_assoc(mysql_query("SELECT * FROM `account` WHERE `id`='".$resmob['battle_attack']."'"));
if ($targete['id']==$account['id']){
$cntatck++;
}
$damagmob=rand($resmob['min_damag'],$resmob['max_damag']);
$damagmob=(floor($damagmob/100)*$resmob['feature_attack_weapon'])+$damagmob;
//$damagmob=$damagmob-(floor($damagmob/100)*$targete['feature_armor_weapon']);
$damagmob=round($damagmob);
if ($damagmob<=0){
$damagmob=1;
}
$damagmob+=rand(1,3);
$kritpower=$resmob['power']-20;
if ($kritpower<=0){
$kritpower=1;
}
$kritdexterity=$resmob['dexterity']-15;
if ($kritdexterity<=0){
$kritdexterity=2;
}
$kritwit=$resmob['wit']-10;
if ($kritwit<=0){
$kritwit=2;
}
$krit=$kritdexterity+$kritpower+$kritwit;
if ($krit>65){
$krit=65;
}
$start=100-$krit;
$start=rand(1,$start);
$end=$start+$krit;
$chanse=rand(1,100);
if ($chanse>=$start && $chanse<=$end){
$damagmob=round($damagmob*rand(1.5,1.9));
}
$hpdm=$targete['hp']-$damagmob;
if ($hpdm<=0){
$hpdm=1;
mysql_query("DELETE FROM `effect` WHERE
`target_type`='mob'
AND `target`='".$resmob['id']."' AND `account`='".$targete['id']."'");
mysql_query("UPDATE `account` SET
`battle`='',
`battle_attack`='' WHERE `id`='".$targete['id']."'");
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `account` WHERE `battle`='".$resmob['battle']."'"),0)){
$qrtargets=mysql_fetch_assoc(mysql_query("SELECT * FROM `account` WHERE `battle`='".$resmob['battle']."' ORDER BY `lvl` DESC LIMIT 1"));
mysql_query("UPDATE `mobs` SET
`last_damag`='".time()."',
`battle_attack`='".$qrtargets['id']."',
WHERE `battle_attack`='".$resmob['battle_attack']."'");
mysql_query("UPDATE `account` SET `battle_target_type`='mob',`battle_attack`='".$resmob['id']."' WHERE `battle_target_type`='user' AND `battle_attack`='".$targete['id']."'");
}else{
mysql_query("DELETE FROM `battle` WHERE
`id`='".$targete['battle']."'");
mysql_query("UPDATE `mobs` SET
`last_damag`='',
`battle`='',
`battle_attack`=''
WHERE `battle`='".$resmob['battle']."'");
}
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targete['id']."','<div class="help">Бой окончен, вы проиграли</div>')");
break;
header('Location: /location.php?');
exit;
}
mysql_query("UPDATE `account` SET
`hp`='".$hpdm."'
WHERE
`id`='".$targete['id']."'");
mysql_query("INSERT INTO `battle_log`(
`account`,
`mess`)VALUES(
'".$targete['id']."',
'<div class="help"><img src="/data/img/units/mobs/".$resmob['icon'].".jpg" width="15px" height="15px">".$resmob['name']." наносит вам ".$damagmob." урона!</div>')");
//$ld=$resmob['last_damag']+$resmob['damag_every_sec'];
$ld=time();
if ($ld>time()){
$ld=time();
}
mysql_query("UPDATE `mobs` SET
`last_damag`='".$ld."'
WHERE
`id`='".$resmob['id']."'");
$account['hp']=mysql_result(mysql_query("SELECT `hp` FROM `account` WHERE
`id`='".$account['id']."'"),0);
$targete['hp']=mysql_result(mysql_query("SELECT `hp` FROM `account` WHERE `id`='".$targete['id']."'"),0);
}
}
}
//echo time();
//Доты
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `effect` WHERE
`target_type`='mob'
AND `dota`='1'"),0)){
//echo mysql_result(mysql_query("SELECT COUNT(*) FROM `effect` WHERE `target_type`='mob' AND `account`='".$account['id']."'"),0);
$qd=mysql_query("SELECT * FROM `effect` WHERE
`target_type`='mob'
AND `dota`='1'");
while($resultd=mysql_fetch_assoc($qd)){
$mobe=mysql_fetch_array(mysql_query("SELECT * FROM `mobs` WHERE
`id`='".$resultd['target']."'"));
$mobe['expee'] = round($mobe['exp']/2);
$mobe['drop_goldee'] = round($mobe['drop_gold']/2);
$mobe['exp'] = rand($mobe['expee'],$mobe['exp']);
$mobe['drop_gold'] = rand($mobe['drop_goldee'],$mobe['drop_gold']);
$mobe['exp']=round($mobe['exp']/$account['lvl'])*$mobe['lvl'];
if ($resultd['last_cast']-$resultd['time']>=$resultd['effect_time']){
mysql_query("DELETE FROM `effect` WHERE `id`='".$resultd['id']."'");
header("Location:?");
exit;
}
$col_hp_damaged=time()-$resultd['last_cast'];
$col_hp_damaged=floor($col_hp_damaged/$resultd['effect_every_sec'])+rand(1,3);
if ($col_hp_damaged){
for($i=1; $i<=$col_hp_damaged; $i++){
$hpd=$mobe['hp']-$resultd['effect_damage'];
if ($hpd<=0){
$targett=mysql_fetch_assoc(mysql_query("SELECT * FROM `account` WHERE `id`='".$mobe['battle_attack']."'"));
$hpd=0;
mysql_query("DELETE FROM `effect` WHERE
`target_type`='mob'
AND `target`='".$mobe['id']."'");
mysql_query("UPDATE `mobs` SET
`hp`='".$mobe['max_hp']."',
`mp`='".$mobe['max_mp']."',
`last_death`='".time()."',
`battle`=''
WHERE
`id`='".$mobe['id']."'");
//mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Вы победили</div>')");
$levl=mysql_fetch_assoc(mysql_query("SELECT * FROM `lvl` WHERE `id`='".$targett['lvl']."'"));
mysql_query("UPDATE `account` SET `exp`='".($targett['exp']+$mobe['exp'])."' WHERE `id`='".$targett['id']."'");
$targett['exp']=mysql_result(mysql_query("SELECT `exp` FROM `account` WHERE `id`='".$targett['id']."'"),0);
//echo 'Получено опыта: '.$mobe['exp'].'<br />';
if ($targett['exp']>$levl['exp']){
mysql_query("UPDATE `account` SET `lvl`='".($targett['lvl']+1)."',`exp`='0',`skill_point`=`skill_point`+'1',`character_point`=`character_point`+'2' WHERE `id`='".$targett['id']."'");
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Уровень повышен</div>')");
}
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Получено опыта: ".$mobe['exp']."</div>')");
$targett['exp']=mysql_result(mysql_query("SELECT `exp` FROM `account` WHERE `id`='".$targett['id']."'"),0);
if ($targett['clan']){
mysql_query("UPDATE `clan` SET `exp`=`exp`+".($mob['exp']/2)." WHERE `id`='".$targett['clan']."'");
}
if ($mobe['drop_gold']){
mysql_query("UPDATE `account` SET
`gold`='".($targett['gold']+$mobe['drop_gold'])."' WHERE `id`='".$targett['id']."'");
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Получено золота: ".$mobe['drop_gold']."</div>')");
}
if ($mobe['drop_items']){
$drop=explode(',',$mobe['drop_items']);
foreach($drop as $value){
$item=explode(':',$value);
$start=100-$item[1];
$start=rand(1,$start);
$end=$start+$item[1];
$chanse=rand(1,100);
if ($chanse>=$start && $chanse<=$end){
$iteme=mysql_fetch_assoc(mysql_query("SELECT * FROM `items` WHERE
`id`='".$item[0]."'"));
if ($iteme['type']=='eat_bootle' OR $iteme['type']=='eat_eat' OR $iteme['type']=='resourse'){
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `inventory` WHERE
`ident_id`='".$iteme['id']."'
AND `account`='".$mobe['battle_attack']."'"),0)){
if (isset($item[2])){
mysql_query("UPDATE `inventory` SET
`amount`=`amount` + '".$item[2]."'
WHERE
`ident_id`='".$iteme['id']."'
AND `account`='".$mobe['battle_attack']."'");
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Получен предмет: ".$iteme['name']."х".$item[2]."</div>')");
}else{
mysql_query("UPDATE `inventory` SET
`amount`=`amount` + '1'
WHERE
`ident_id`='".$iteme['id']."'
AND `account`='".$mobe['battle_attack']."'");
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Получен предмет: ".$iteme['name']."</div>')");
}
}else{
mysql_query("INSERT INTO `inventory`(
`name`,
`type`,
`feature_pover`,
`feature_vitality`,
`feature_dexterity`,
`feature_wit`,
`feature_spirit`,
`feature_armor_arrow`,
`feature_armor_weapon`,
`feature_armor_magic`,
`feature_attack_arrow`,
`feature_attack_weapon`,
`feature_attack_magic`,
`feature_hp_regen`,
`feature_mp_regen`,
`cast_hp_regen`,
`cast_mp_regen`,
`min_lvl`,
`amount`,
`coast`,
`about`,
`icon`,
`attack_min_damag`,
`attack_max_damag`,
`account`,
`twohands`,
`subtype`,
`ident_id`) VALUES (
'".$iteme['name']."',
'".$iteme['type']."',
'".$iteme['feature_pover']."',
'".$iteme['feature_vitality']."',
'".$iteme['feature_dexterity']."',
'".$iteme['feature_wit']."',
'".$iteme['feature_spirit']."',
'".$iteme['feature_armor_arrow']."',
'".$iteme['feature_armor_weapon']."',
'".$iteme['feature_armor_magic']."',
'".$iteme['feature_attack_arrow']."',
'".$iteme['feature_attack_weapon']."',
'".$iteme['feature_attack_magic']."',
'".$iteme['feature_hp_regen']."',
'".$iteme['feature_mp_regen']."',
'".$iteme['cast_hp_regen']."',
'".$iteme['cast_mp_regen']."',
'".$iteme['min_lvl']."',
'".$item[2]."',
'".$iteme['coast']."',
'".$iteme['about']."',
'".$iteme['icon']."',
'".$iteme['attack_min_damag']."',
'".$iteme['attack_max_damag']."',
'".$targett['id']."',
'".$iteme['twohands']."',
'".$iteme['subtype']."',
'".$iteme['id']."')") or die(mysql_error());
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Получен предмет: ".$iteme['name']."</div>')");
}
}else{
mysql_query("INSERT INTO `inventory`(
`name`,
`type`,
`feature_pover`,
`feature_vitality`,
`feature_dexterity`,
`feature_wit`,
`feature_spirit`,
`feature_armor_arrow`,
`feature_armor_weapon`,
`feature_armor_magic`,
`feature_attack_arrow`,
`feature_attack_weapon`,
`feature_attack_magic`,
`feature_hp_regen`,
`feature_mp_regen`,
`cast_hp_regen`,
`cast_mp_regen`,
`min_lvl`,
`coast`,
`about`,
`icon`,
`attack_min_damag`,
`attack_max_damag`,
`account`,
`twohands`,
`subtype`,
`ident_id`) VALUES (
'".$iteme['name']."',
'".$iteme['type']."',
'".$iteme['feature_pover']."',
'".$iteme['feature_vitality']."',
'".$iteme['feature_dexterity']."',
'".$iteme['feature_wit']."',
'".$iteme['feature_spirit']."',
'".$iteme['feature_armor_arrow']."',
'".$iteme['feature_armor_weapon']."',
'".$iteme['feature_armor_magic']."',
'".$iteme['feature_attack_arrow']."',
'".$iteme['feature_attack_weapon']."',
'".$iteme['feature_attack_magic']."',
'".$iteme['feature_hp_regen']."',
'".$iteme['feature_mp_regen']."',
'".$iteme['cast_hp_regen']."',
'".$iteme['cast_mp_regen']."',
'".$iteme['min_lvl']."',
'".$iteme['coast']."',
'".$iteme['about']."',
'".$iteme['icon']."',
'".$iteme['attack_min_damag']."',
'".$iteme['attack_max_damag']."',
'".$targett['id']."',
'".$iteme['twohands']."',
'".$iteme['subtype']."',
'".$iteme['id']."')") or die(mysql_error());
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Получен предмет: ".$iteme['name']."</div>')");
}
}
unset($chanse);
unset($start);
unset($end);
unset($iteme);
unset($item);
}
}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `quests` WHERE
`account`='".$targett['id']."'
AND `completed`=''
AND `kill_mob`='".$mobe['ident_id']."'"),0)){
$quests=mysql_query("SELECT * FROM `quests` WHERE
`account`='".$targett['id']."'
AND `completed`='0'
AND `kill_mob`='".$mobe['ident_id']."'");
while($resul=mysql_fetch_array($quests)){
mysql_query("UPDATE `quests` SET
`kill_mob_col_kill`='".($resul['kill_mob_col_kill']+1)."'
WHERE
`account`='".$targett['id']."'
AND `id`='".$resul['id']."'");
//echo $mobe['name'].' - убито '.($resul['kill_mob_col_kill']+1).'/'.$resul['kill_mob_col'].'<br />';
if ($resul['kill_mob_col_kill']+1==$resul['kill_mob_col'] && $resul['res_need']==$resul['res_need_col']){
//echo 'Цель достигнута<br />';
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$account['id']."','<div class="help">Задание выполнено</div>')");
mysql_query("UPDATE `quests` SET
`completed`='1'
WHERE
`id`='".$resul['id']."'");
}
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('<div class="help">".$targett['id']."','".$mobe['name']." - убито ".($resul['kill_mob_col_kill']+1)."/".$resul['kill_mob_col']."</div>')");
}
}
if (!mysql_result(mysql_query("SELECT COUNT(*) FROM `mobs` WHERE `battle`='".$account['battle']."'"),0)){
mysql_query("DELETE FROM `battle` WHERE
`id`='".$account['battle']."'");
mysql_query("UPDATE `account` SET
`battle`='',
`battle_attack`='' WHERE `battle`='".$account['battle']."'");
$qb=mysql_query("SELECT * FROM `account` WHERE `battle`='".$account['battle']."'");
while($resqb=mysql_fetch_assoc($qb)){
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$resqb['id']."','<div class="help">Бой окончен</div>')");
}
header("Location: ?");
exit;
}else{
$nextmob=mysql_result(mysql_query("SELECT `id` FROM `mobs` WHERE `battle`='".$account['battle']."' LIMIT 1"),0);
mysql_query("UPDATE `account` SET `battle_attack`='".$nextmob."' WHERE `id`='".$account['id']."'");
header("Location: ?");
exit;
}
}
mysql_query("UPDATE `mobs` SET
`hp`='".$hpd."'
WHERE `id`='".$mobe['id']."'");
mysql_query("INSERT INTO `battle_log`(
`acount`,
`mess`)VALUES(
'".$targett['id']."',
'<div class="help"><img src="/data/img/skill/".mysql_result(mysql_query("SELECT `icon` FROM `skill` WHERE `id`='".$resultd['skill']."'"),0).".jpg" width="15px" height="15px">Вы наносите ".$resultd['effect_damage']." урона</div>')");
mysql_query("UPDATE `effect` SET
`last_cast`='".($resultd['last_cast']+$resultd['effect_every_sec'])."'
WHERE `id`='".$resultd['id']."'");
$resultd['last_cast']=mysql_result(mysql_query("SELECT `last_cast` FROM `effect` WHERE
`id`='".$resultd['id']."'"),0);
if ($resultd['last_cast']-$resultd['time']>=$resultd['effect_time']){
mysql_query("DELETE FROM `effect` WHERE
`id`='".$resultd['id']."'");
header("Location: ?");
exit;
}
$mobe['hp']=mysql_result(mysql_query("SELECT `hp` FROM `mobs`
WHERE `id`='".$mobe['id']."'"),0);
}
}
}
}
if (isset($_GET['skill']) && is_numeric($_GET['skill'])){
$_GET['skill']=intval($_GET['skill']);
if (!mysql_result(mysql_query("SELECT * FROM `skill` WHERE
`id`='".$_GET['skill']."'
AND `account`='".$account['id']."'"),0)){
header("Location: ?");
exit;
}
$skill=mysql_fetch_assoc(mysql_query("SELECT * FROM `skill` WHERE
`id`='".mysql_real_escape_string($_GET['skill'])."'
AND `account`='".$account['id']."'"));
if (time()-$skill['last_cast']<$skill['res_time']){
header("Location: ?");
exit;
}
if (time()-$account['battle_last_attack']<1){
header("Location: ?");
exit;
}
if ($account['mp']<$skill['mp_need_from_cast']){
header("Location: ?");
exit;
}
/*if (mysql_result(mysql_query("SElECT COUNT(*) FROM `effect` WHERE
`skill`='".$skill['id']."' AND `target_type`=='".$account['battle_target_type']."' AND `target`='".$account['battle_attack']."'"),0)){
mysql_query("UPDATE `effect` SET
`last_cast`='".time()."',
`time`='".time()."'
WHERE
`skill`='".$skill['id']."'");
mysql_query("UPDATE `skill` SET
`last_cast`='".time()."'
WHERE
`id`='".$skill['id']."'");
header("Location: ?");
exit;
}*/
/*******************************************************************
**********************DAMAG******************************************
**********************************************************************/
if ($skill['type']=='phisical'){
if ($skill['damage'] && $account['battle_target_type']=='mob'){
$damag=$skill['damage'] + rand(-3,3);
$damag=(ceil($damag/100)*$account['feature_attack_weapon'])+$damag;
$damag=$damag-(ceil($damag/100)*$mob['feature_armor_weapon']);
$damag=round($damag);
if ($damag<=0){
$damag=1;
}
$damag+=rand(1,3);
$kritpower=$account['power']-20;
if ($kritpower<=0){
$kritpower=1;
}
$kritdexterity=$account['dexterity']-15;
if ($kritdexterity<=0){
$kritdexterity=2;
}
$kritwit=$account['wit']-10;
if ($kritwit<=0){
$kritwit=2;
}
$krit=$kritdexterity+$kritpower+$kritwit;
if ($krit>65){
$krit=65;
}
$start=100-$krit;
$start=rand(1,$start);
$end=$start+$krit;
$chanse=rand(1,100);
if ($chanse>=$start && $chanse<=$end){
$damag=round($damag*rand(1.5,1.9));
}
$hp=$mob['hp']-$damag;
$damaglast=$damag;
if ($hp<0){
if($skill['damage'] && $account['battle_target_type']=='mob'){
mysql_query("UPDATE `mobs` SET
`hp`='".$hp."'
WHERE `id`='".$mob['id']."'");
mysql_query("INSERT INTO `battle_log`(
`account`,
`mess`)VALUES(
'".$account['id']."',
'<div class="help"><img src="/data/img/skill/".$skill['icon'].".jpg" width="15px" height="15px">Вы наносите ".$damag." урона</div>')");
}
mysql_query("UPDATE `account` SET
`mp`='".($account['mp']-$skill['mp_need_from_cast'])."'
WHERE
`id`='".$account['id']."'");
mysql_query("UPDATE `skill` SET
`last_cast`='".time()."'
WHERE
`account`='".$account['id']."'
AND `id`='".$skill['id']."'");
mysql_query("UPDATE `account` SET
`battle_last_attack`='".time()."'
WHERE
`id`='".$account['id']."'");
$hp=0;
$targett=mysql_fetch_assoc(mysql_query("SELECT * FROM `account` WHERE `id`='".$mob['battle_attack']."'"));
mysql_query("DELETE FROM `effect` WHERE
`target_type`='mob'
AND `target`='".$mob['id']."'");
mysql_query("UPDATE `mobs` SET
`hp`='".$mob['max_hp']."',
`mp`='".$mob['max_mp']."',
`last_death`='".time()."',
`battle`=''
WHERE
`id`='".$mob['id']."'");
//mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$mob['battle_attack']."','<div class="help">Вы победили</div>')");
$levl=mysql_fetch_assoc(mysql_query("SELECT * FROM `lvl` WHERE `id`='".$targett['lvl']."'"));
mysql_query("UPDATE `account` SET `exp`='".($targett['exp']+$mob['exp'])."' WHERE `id`='".$targett['id']."'");
$targett['exp']=mysql_result(mysql_query("SELECT `exp` FROM `account` WHERE `id`='".$targett['id']."'"),0);
//echo 'Получено опыта: '.$mob['exp'].'<br />';
if ($targett['clan']){
mysql_query("UPDATE `clan` SET `exp`=`exp`+".($mob['exp']/2)." WHERE `id`='".$targett['clan']."'");
}
if ($targett['exp']>$levl['exp']){
//$expe=$targett['exp']-$levl['exp'];
mysql_query("UPDATE `account` SET `lvl`='".($targett['lvl']+1)."',`exp`='0',`skill_point`=`skill_point`+'1',`character_point`=`character_point`+'2' WHERE `id`='".$targett['id']."'");
//echo 'Уровень повышен!<br />';
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Уровень повышен!</div>')");
}
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Получено опыта: ".$mob['exp']."</div>')");
$targett['exp']=mysql_result(mysql_query("SELECT `exp` FROM `account` WHERE `id`='".$targett['id']."'"),0);
if ($mob['drop_gold']){
mysql_query("UPDATE `account` SET
`gold`='".($targett['gold']+$mob['drop_gold'])."' WHERE `id`='".$targett['id']."'");
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Получено золота: ".$mob['drop_gold']."</div>')");
}
if ($mob['drop_items']){
$drop=explode(',',$mob['drop_items']);
foreach($drop as $value){
$item=explode(':',$value);
$start=100-$item[1];
$start=rand(1,$start);
$end=$start+$item[1];
$chanse=rand(1,100);
if ($chanse>=$start && $chanse<=$end){
$iteme=mysql_fetch_assoc(mysql_query("SELECT * FROM `items` WHERE
`id`='".$item[0]."'"));
if ($iteme['type']=='eat_bootle' OR $iteme['type']=='eat_eat' OR $iteme['type']=='resourse'){
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `inventory` WHERE
`ident_id`='".$iteme['id']."'
AND `account`='".$targett['id']."'"),0)){
if (isset($item[2])){
mysql_query("UPDATE `inventory` SET
`amount`=`amount` + '".$item[2]."'
WHERE
`ident_id`='".$iteme['id']."'
AND `account`='".$targett['id']."'");
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Получен предмет: ".$iteme['name']."х".$item[2]."</div>')");
}else{
mysql_query("UPDATE `inventory` SET
`amount`=`amount` + '1'
WHERE
`ident_id`='".$iteme['id']."'
AND `account`='".$targett['id']."'");
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Получен предмет: ".$iteme['name']."</div>')");
}
}else{
mysql_query("INSERT INTO `inventory`(
`name`,
`type`,
`feature_pover`,
`feature_vitality`,
`feature_dexterity`,
`feature_wit`,
`feature_spirit`,
`feature_armor_arrow`,
`feature_armor_weapon`,
`feature_armor_magic`,
`feature_attack_arrow`,
`feature_attack_weapon`,
`feature_attack_magic`,
`feature_hp_regen`,
`feature_mp_regen`,
`cast_hp_regen`,
`cast_mp_regen`,
`min_lvl`,
`amount`,
`coast`,
`about`,
`icon`,
`attack_min_damag`,
`attack_max_damag`,
`account`,
`twohands`,
`subtype`,
`ident_id`) VALUES (
'".$iteme['name']."',
'".$iteme['type']."',
'".$iteme['feature_pover']."',
'".$iteme['feature_vitality']."',
'".$iteme['feature_dexterity']."',
'".$iteme['feature_wit']."',
'".$iteme['feature_spirit']."',
'".$iteme['feature_armor_arrow']."',
'".$iteme['feature_armor_weapon']."',
'".$iteme['feature_armor_magic']."',
'".$iteme['feature_attack_arrow']."',
'".$iteme['feature_attack_weapon']."',
'".$iteme['feature_attack_magic']."',
'".$iteme['feature_hp_regen']."',
'".$iteme['feature_mp_regen']."',
'".$iteme['cast_hp_regen']."',
'".$iteme['cast_mp_regen']."',
'".$iteme['min_lvl']."',
'".$item[2]."',
'".$iteme['coast']."',
'".$iteme['about']."',
'".$iteme['icon']."',
'".$iteme['attack_min_damag']."',
'".$iteme['attack_max_damag']."',
'".$targett['id']."',
'".$iteme['twohands']."',
'".$iteme['subtype']."',
'".$iteme['id']."')") or die(mysql_error());
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Получен предмет: ".$iteme['name']."</div>')");
}
}else{
mysql_query("INSERT INTO `inventory`(
`name`,
`type`,
`feature_pover`,
`feature_vitality`,
`feature_dexterity`,
`feature_wit`,
`feature_spirit`,
`feature_armor_arrow`,
`feature_armor_weapon`,
`feature_armor_magic`,
`feature_attack_arrow`,
`feature_attack_weapon`,
`feature_attack_magic`,
`feature_hp_regen`,
`feature_mp_regen`,
`cast_hp_regen`,
`cast_mp_regen`,
`min_lvl`,
`coast`,
`about`,
`icon`,
`attack_min_damag`,
`attack_max_damag`,
`account`,
`twohands`,
`subtype`,
`ident_id`) VALUES (
'".$iteme['name']."',
'".$iteme['type']."',
'".$iteme['feature_pover']."',
'".$iteme['feature_vitality']."',
'".$iteme['feature_dexterity']."',
'".$iteme['feature_wit']."',
'".$iteme['feature_spirit']."',
'".$iteme['feature_armor_arrow']."',
'".$iteme['feature_armor_weapon']."',
'".$iteme['feature_armor_magic']."',
'".$iteme['feature_attack_arrow']."',
'".$iteme['feature_attack_weapon']."',
'".$iteme['feature_attack_magic']."',
'".$iteme['feature_hp_regen']."',
'".$iteme['feature_mp_regen']."',
'".$iteme['cast_hp_regen']."',
'".$iteme['cast_mp_regen']."',
'".$iteme['min_lvl']."',
'".$iteme['coast']."',
'".$iteme['about']."',
'".$iteme['icon']."',
'".$iteme['attack_min_damag']."',
'".$iteme['attack_max_damag']."',
'".$targett['id']."',
'".$iteme['twohands']."',
'".$iteme['subtype']."',
'".$iteme['id']."')") or die(mysql_error());
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Получен предмет: ".$iteme['name']."</div>')");
}
}
unset($chanse);
unset($start);
unset($end);
unset($iteme);
unset($item);
}
}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `quests` WHERE
`account`='".$targett['id']."'
AND `completed`=''
AND `kill_mob`='".$mob['ident_id']."'"),0)){
$quests=mysql_query("SELECT * FROM `quests` WHERE
`account`='".$targett['id']."'
AND `completed`='0'
AND `kill_mob`='".$mob['ident_id']."'");
while($resul=mysql_fetch_array($quests)){
mysql_query("UPDATE `quests` SET
`kill_mob_col_kill`='".($resul['kill_mob_col_kill']+1)."'
WHERE
`account`='".$targett['id']."'
AND `id`='".$resul['id']."'");
//echo $mob['name'].' - убито '.($resul['kill_mob_col_kill']+1).'/'.$resul['kill_mob_col'].'<br />';
if ($resul['kill_mob_col_kill']+1==$resul['kill_mob_col'] && $resul['res_need']==$resul['res_need_col']){
//echo 'Цель достигнута<br />';
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Задание выполнено</div>')");
mysql_query("UPDATE `quests` SET
`completed`='1'
WHERE
`id`='".$resul['id']."'");
}
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">".$mob['name']." - убито ".($resul['kill_mob_col_kill']+1)."/".$resul['kill_mob_col']."</div>')");
}
}
if (!mysql_result(mysql_query("SELECT COUNT(*) FROM `mobs` WHERE `battle`='".$account['battle']."'"),0)){
mysql_query("DELETE FROM `battle` WHERE
`id`='".$account['battle']."'");
mysql_query("UPDATE `account` SET
`battle`='',
`battle_attack`='' WHERE `battle`='".$account['battle']."'");
$qb=mysql_query("SELECT * FROM `account` WHERE `battle`='".$account['battle']."'");
while($resqb=mysql_fetch_assoc($qb)){
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$resqb['id']."','<div class="help">Бой окончен</div>')");
}
header("Location: ?");
exit;
}else{
$nextmob=mysql_result(mysql_query("SELECT `id` FROM `mobs` WHERE `battle`='".$account['battle']."' LIMIT 1"),0);
mysql_query("UPDATE `account` SET `battle_attack`='".$nextmob."' WHERE `id`='".$account['id']."'");
header("Location: ?");
exit;
}
}
mysql_query("UPDATE `mobs` SET `hp`='".$hpd."' WHERE `id`='".$mob['id']."'");
}
if ($skill['stun'] OR $skill['paralich'] OR $skill['sleep'] OR $skill['fear'] AND $account['battle_target_type']){
if ($account['battle_target_type']='mob'){
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `effect`
WHERE `skill`='".$skill['id']."'
AND `account`='".$account['id']."'
AND `target_type`='mob'
AND `target`='".$mob['id']."'"),0)){
mysql_query("UPDATE `effect` SET `time`='".time()."',`last_cast`='".time()."' WHERE `account`='".$account['id']."' AND `skill`='".$skill['id']."' AND `target_type`='mob' AND `target`='".$mob['id']."'");
}else{
mysql_query("INSERT INTO `effect`(
`effect_time`,
`skill`,
`account`,
`target_type`,
`target`,
`fear`,
`sleep`,
`paralich`,
`stun`,
`time`)VALUES(
'".$skill['effect_time']."',
'".$skill['id']."',
'".$account['id']."',
'mob',
'".$mob['id']."',
'".$skill['fear']."',
'".$skill['sleep']."',
'".$skill['paralich']."',
'".$skill['stun']."',
'".time()."')");
mysql_query("UPDATE `skill` SET
`last_cast`='".time()."'
WHERE
`id`='".$skill['id']."'");
}
}else{
}
}
if ($skill['debaph']){
if ($account['battle_target_type']=='mob'){
//Сложение
$adding=0+$skill['baph_adding'];
//Воля
$will=0+$skill['baph_will'];
//Реакция
$reaction=0+$skill['baph_reaction'];
//Очки здоровья
$max_hp=0+$skill['baph_max_hp'];
//Очки маны
$max_mp=0+$skill['baph_max_mp'];
//Защита от ударов
$feature_armor_weapon=0+$skill['baph_feature_armor_weapon'];
//Защита от стрел
$feature_armor_arrow=0+$skill['baph_feature_armor_arrow'];
//Защита от магии
$feature_armor_magic=0+$skill['baph_feature_armor_magic'];
//Урон от ударов
$feature_attack_weapon=0+$skill['baph_feature_attack_weapon'];
//Урон от стрел
$feature_attack_arrow=0+$skill['baph_feature_attack_arrow'];
//Урон от магии
$feature_attack_magic=0+$skill['baph_feature_attack_magic'];
//Восстановление жизни
$hp_regen=0+$skill['baph_hp_regen'];
//Восстановление маны
$mp_regen=0+$skill['baph_mp_regen'];
//Power
$power=0+$skill['baph_power'];
//Wit
$wit=0+$skill['baph_wit'];
//Dexterity
$dexterity=0+$skill['baph_dexterity'];
//Vitality
$vitality=0+$skill['baph_vitality'];
//Spirit
$spirit=0+$skill['baph_spirit'];
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `effect`
WHERE `skill`='".$skill['id']."'
AND `account`='".$account['id']."'
AND `target_type`='mob'
AND `target`='".$mob['id']."'"),0)){
mysql_query("UPDATE `effect` SET
`debaph`='1',
`effect_time`='".$skill['effect_time']."',
`target_type`='mob',
`target`='".$mob['id']."',
`time`='".time()."',
`last_cast`='".time()."',
`baph_adding`='".$adding."',
`baph_will`='".$will."',
`baph_reaction`='".$reaction."',
`baph_max_hp`='".$max_hp."',
`baph_max_mp`='".$max_mp."',
`baph_feature_armor_weapon`='".$feature_armor_weapon."',
`baph_feature_armor_arrow`='".$feature_armor_arrow."',
`baph_feature_armor_magic`='".$feature_armor_magic."',
`baph_feature_attack_weapon`='".$feature_attack_weapon."',
`baph_feature_attack_arrow`='".$feature_attack_arrow."',
`baph_feature_attack_weapon`='".$feature_attack_magic."',
`baph_hp_regen`='".$hp_regen."',
`baph_mp_regen`='".$mp_regen."',
`baph_power`='".$power."',
`baph_wit`='".$wit."',
`baph_dexterity`='".$dexterity."',
`baph_spirit`='".$spirit."'
WHERE
`skill`='".$skill['id']."'
AND `account`='".$account['id']."'");
}else{
mysql_query("INSERT INTO `effect`(
`debaph`,
`account`,
`time`,
`last_cast`,
`effect_time`,
`skill`,
`target_type`,
`target`,
`baph_adding`,
`baph_will`,
`baph_reaction`,
`baph_max_hp`,
`baph_max_mp`,
`baph_feature_armor_weapon`,
`baph_feature_armor_arrow`,
`baph_feature_armor_magic`,
`baph_feature_attack_weapon`,
`baph_feature_attack_arrow`,
`baph_feature_attack_magic`,
`baph_hp_regen`,
`baph_mp_regen`,
`baph_power`,
`baph_wit`,
`baph_dexterity`,
`baph_spirit`
)VALUES(
'1',
'".$account['id']."',
'".time()."',
'".time()."',
'".$skill['effect_time']."',
'".$skill['id']."',
'mob',
'".$mob['id']."',
'".$adding."',
'".$will."',
'".$reaction."',
'".$max_hp."',
'".$max_mp."',
'".$feature_armor_weapon."',
'".$feature_armor_arrow."',
'".$feature_armor_magic."',
'".$feature_attack_weapon."',
'".$feature_attack_arrow."',
'".$feature_attack_magic."',
'".$hp_regen."',
'".$mp_regen."',
'".$power."',
'".$wit."',
'".$dexterity."',
'".$spirit."'
)");
}
}else{
}
}
if($skill['heal']){
if ($account['battle_target_type']=='mob'){
$damag=$skill['heal'] + 1;
$damag=(ceil($damag/100)*$account['feature_attack_magic'])+$damag;
$damag=round($damag);
if ($damag<=0){
$damag=1;
}
$damag+=rand(1,3);
$kritpower=$account['power']-20;
if ($kritpower<=0){
$kritpower=1;
}
$kritdexterity=$account['dexterity']-15;
if ($kritdexterity<=0){
$kritdexterity=2;
}
$kritwit=$account['wit']-10;
if ($kritwit<=0){
$kritwit=2;
}
$krit=$kritdexterity+$kritpower+$kritwit;
if ($krit>65){
$krit=65;
}
$start=100-$krit;
$start=rand(1,$start);
$end=$start+$krit;
$chanse=rand(1,100);
if ($chanse>=$start && $chanse<=$end){
$damag=round($damag*rand(1.5,1.9));
}
$hpheal=$account['hp']+$damag;
if ($account['max_hp']<$hpheal){
$hpheal=$account['max_hp'];
}
mysql_query("UPDATE `account` SET
`hp`='".$hpheal."'
WHERE
`id`='".$account['id']."'");
mysql_query("INSERT INTO `battle_log`(
`account`,
`mess`)VALUES(
'".$account['id']."',
'<div class="help"><img src="/data/img/skill/".$skill['icon'].".jpg" width="15px" height="15px">Вы исцелились на ".$damag." единиц</div>')");
mysql_query("UPDATE `skill` SET
`last_cast`='".time()."'
WHERE
`id`='".$skill['id']."'");
mysql_query("UPDATE `account` SET
`battle_last_attack`='".time()."'
WHERE
`id`='".$account['id']."'");
}else{
//если цель союзник
$damag=$skill['heal'] + 1;
$damag=(ceil($damag/100)*$account['feature_attack_magic'])+$damag;
$damag=round($damag);
if ($damag<=0){
$damag=1;
}
$damag+=rand(1,3);
$kritpower=$account['power']-20;
if ($kritpower<=0){
$kritpower=1;
}
$kritdexterity=$account['dexterity']-15;
if ($kritdexterity<=0){
$kritdexterity=2;
}
$kritwit=$account['wit']-10;
if ($kritwit<=0){
$kritwit=2;
}
$krit=$kritdexterity+$kritpower+$kritwit;
if ($krit>65){
$krit=65;
}
$start=100-$krit;
$start=rand(1,$start);
$end=$start+$krit;
$chanse=rand(1,100);
if ($chanse>=$start && $chanse<=$end){
$damag=round($damag*rand(1.5,1.9));
}
$hpheal=$mob['hp']+$damag;
if ($mob['max_hp']<$hpheal){
$hpheal=$mob['max_hp'];
}
mysql_query("UPDATE `account` SET
`hp`='".$hpheal."'
WHERE
`id`='".$mob['id']."'");
mysql_query("INSERT INTO `battle_log`(
`account`,
`mess`)VALUES(
'".$mob['id']."',
'<div class="help"><img src="/data/img/skill/".$skill['icon'].".jpg" width="15px" height="15px"><div class="help">".$account['name']." исцелил вас на ".$damag." единиц</div>')");
mysql_query("UPDATE `skill` SET
`last_cast`='".time()."'
WHERE
`id`='".$skill['id']."'");
mysql_query("UPDATE `account` SET
`battle_last_attack`='".time()."'
WHERE
`id`='".$account['id']."'");
}
}
if ($skill['baph']){
if ($account['battle_target_type']=='mob'){
//Сложение
$adding=0+$skill['baph_adding'];
//Воля
$will=0+$skill['baph_will'];
//Реакция
$reaction=0+$skill['baph_reaction'];
//Очки здоровья
$max_hp=0+$skill['baph_max_hp'];
//Очки маны
$max_mp=0+$skill['baph_max_mp'];
//Защита от ударов
$feature_armor_weapon=0+$skill['baph_feature_armor_weapon'];
//Защита от стрел
$feature_armor_arrow=0+$skill['baph_feature_armor_arrow'];
//Защита от магии
$feature_armor_magic=0+$skill['baph_feature_armor_magic'];
//Урон от ударов
$feature_attack_weapon=0+$skill['baph_feature_attack_weapon'];
//Урон от стрел
$feature_attack_arrow=0+$skill['baph_feature_attack_arrow'];
//Урон от магии
$feature_attack_magic=0+$skill['baph_feature_attack_magic'];
//Восстановление жизни
$hp_regen=0+$skill['baph_hp_regen'];
//Восстановление маны
$mp_regen=0+$skill['baph_mp_regen'];
//Power
$power=0+$skill['baph_power'];
//Wit
$wit=0+$skill['baph_wit'];
//Dexterity
$dexterity=0+$skill['baph_dexterity'];
//Vitality
$vitality=0+$skill['baph_vitality'];
//Spirit
$spirit=0+$skill['baph_spirit'];
if (mysql_result("SELECT COUNT(*) FROM `effect` WHERE
`account`='".$account['id']."'
AND `skill`='".$skill['id']."'")){
mysql_query("UPDATE `effect` SET
`time`='".time()."',
`last_cast`='".time()."',
`baph_adding`='".$adding."',
`baph_will`='".$will."',
`baph_reaction`='".$reaction."',
`baph_max_hp`='".$max_hp."',
`baph_max_mp`='".$max_mp."',
`baph_feature_armor_weapon`='".$feature_armor_weapon."',
`baph_feature_armor_arrow`='".$feature_armor_arrow."',
`baph_feature_armor_magic`='".$feature_armor_magic."',
`baph_feature_attack_weapon`='".$feature_attack_weapon."',
`baph_feature_attack_arrow`='".$feature_attack_arrow."',
`baph_feature_attack_weapon`='".$feature_attack_magic."',
`baph_hp_regen`='".$hp_regen."',
`baph_mp_regen`='".$mp_regen."',
`baph_power`='".$power."',
`baph_wit`='".$wit."',
`baph_dexterity`='".$dexterity."',
`baph_spirit`='".$spirit."'
WHERE
`skill`='".$skill['id']."'
AND `account`='".$account['id']."'");
}else{
mysql_query("INSERT INTO `effect`(
`baph`,
`account`,
`time`,
`last_cast`,
`effect_time`,
`skill`,
`baph_adding`,
`baph_will`,
`baph_reaction`,
`baph_max_hp`,
`baph_max_mp`,
`baph_feature_armor_weapon`,
`baph_feature_armor_arrow`,
`baph_feature_armor_magic`,
`baph_feature_attack_weapon`,
`baph_feature_attack_arrow`,
`baph_feature_attack_magic`,
`baph_hp_regen`,
`baph_mp_regen`,
`baph_power`,
`baph_wit`,
`baph_dexterity`,
`baph_spirit`
)VALUES(
'1',
'".$account['id']."',
'".time()."',
'".time()."',
'".$skill['effect_time']."',
'".$skill['id']."',
'".$adding."',
'".$will."',
'".$reaction."',
'".$max_hp."',
'".$max_mp."',
'".$feature_armor_weapon."',
'".$feature_armor_arrow."',
'".$feature_armor_magic."',
'".$feature_attack_weapon."',
'".$feature_attack_arrow."',
'".$feature_attack_magic."',
'".$hp_regen."',
'".$mp_regen."',
'".$power."',
'".$wit."',
'".$dexterity."',
'".$spirit."'
)");
}
}else{
//Сложение
$adding=0+$skill['baph_adding'];
//Воля
$will=0+$skill['baph_will'];
//Реакция
$reaction=0+$skill['baph_reaction'];
//Очки здоровья
$max_hp=0+$skill['baph_max_hp'];
//Очки маны
$max_mp=0+$skill['baph_max_mp'];
//Защита от ударов
$feature_armor_weapon=0+$skill['baph_feature_armor_weapon'];
//Защита от стрел
$feature_armor_arrow=0+$skill['baph_feature_armor_arrow'];
//Защита от магии
$feature_armor_magic=0+$skill['baph_feature_armor_magic'];
//Урон от ударов
$feature_attack_weapon=0+$skill['baph_feature_attack_weapon'];
//Урон от стрел
$feature_attack_arrow=0+$skill['baph_feature_attack_arrow'];
//Урон от магии
$feature_attack_magic=0+$skill['baph_feature_attack_magic'];
//Восстановление жизни
$hp_regen=0+$skill['baph_hp_regen'];
//Восстановление маны
$mp_regen=0+$skill['baph_mp_regen'];
//Power
$power=0+$skill['baph_power'];
//Wit
$wit=0+$skill['baph_wit'];
//Dexterity
$dexterity=0+$skill['baph_dexterity'];
//Vitality
$vitality=0+$skill['baph_vitality'];
//Spirit
$spirit=0+$skill['baph_spirit'];
if (mysql_result("SELECT COUNT(*) FROM `effect` WHERE
`account`='".$account['id']."'
AND `skill`='".$skill['id']."' AND `target_type`='user' AND `target`='".$account['battle_attack']."'")){
mysql_query("UPDATE `effect` SET
`time`='".time()."',
`last_cast`='".time()."',
`baph_adding`='".$adding."',
`baph_will`='".$will."',
`baph_reaction`='".$reaction."',
`baph_max_hp`='".$max_hp."',
`baph_max_mp`='".$max_mp."',
`baph_feature_armor_weapon`='".$feature_armor_weapon."',
`baph_feature_armor_arrow`='".$feature_armor_arrow."',
`baph_feature_armor_magic`='".$feature_armor_magic."',
`baph_feature_attack_weapon`='".$feature_attack_weapon."',
`baph_feature_attack_arrow`='".$feature_attack_arrow."',
`baph_feature_attack_weapon`='".$feature_attack_magic."',
`baph_hp_regen`='".$hp_regen."',
`baph_mp_regen`='".$mp_regen."',
`baph_power`='".$power."',
`baph_wit`='".$wit."',
`baph_dexterity`='".$dexterity."',
`baph_spirit`='".$spirit."',
`target_type`='user',
`target`='".$account['battle_attack']."'
WHERE
`skill`='".$skill['id']."'
AND `account`='".$account['id']."'");
}else{
mysql_query("INSERT INTO `effect`(
`baph`,
`account`,
`time`,
`last_cast`,
`effect_time`,
`skill`,
`baph_adding`,
`baph_will`,
`baph_reaction`,
`baph_max_hp`,
`baph_max_mp`,
`baph_feature_armor_weapon`,
`baph_feature_armor_arrow`,
`baph_feature_armor_magic`,
`baph_feature_attack_weapon`,
`baph_feature_attack_arrow`,
`baph_feature_attack_magic`,
`baph_hp_regen`,
`baph_mp_regen`,
`baph_power`,
`baph_wit`,
`baph_dexterity`,
`baph_spirit`,
`target_type`,
`target`
)VALUES(
'1',
'".$account['id']."',
'".time()."',
'".time()."',
'".$skill['effect_time']."',
'".$skill['id']."',
'".$adding."',
'".$will."',
'".$reaction."',
'".$max_hp."',
'".$max_mp."',
'".$feature_armor_weapon."',
'".$feature_armor_arrow."',
'".$feature_armor_magic."',
'".$feature_attack_weapon."',
'".$feature_attack_arrow."',
'".$feature_attack_magic."',
'".$hp_regen."',
'".$mp_regen."',
'".$power."',
'".$wit."',
'".$dexterity."',
'".$spirit."',
'user',
'".$account['battle_attack']."'
)");
}
}
}
if ($skill['effect_damage'] && $account['battle_target_type']=='mob'){
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `effect` WHERE
`skill`='".$skill['id']."'
AND `account`='".$account['id']."'
AND `target_type`='mob'
AND `target`='".$mob['id']."'"),0)){
mysql_query("UPDATE `effect` SET
`time`='".time()."',
`last_cast`='".time()."',
`effect_damage`='".$skill['effect_damage']."',
`effect_time`='".$skill['effect_time']."',
`effect_every_sec`='".$skill['effect_every']."',
`target_type`='mob',
`target`='".$mob['id']."',
`dota`='1',
WHERE `skill`='".$skill['id']."'");
}else{
mysql_query("INSERT INTO `effect`(
`effect_damage`,
`time`,
`effect_time`,
`effect_every_sec`,
`account`,
`target_type`,
`target`,
`skill`,
`last_cast`,
`dota`)VALUES(
'".$skill['effect_damage']."',
'".time()."',
'".$skill['effect_time']."',
'".$skill['effect_every_sec']."',
'".$account['id']."',
'mob',
'".$mob['id']."',
'".$skill['id']."',
'".time()."',
'1')");
}
}
if($skill['effect_hp_regen'] || $skill['effect_hp_regen_percent']){
if ($account['battle_target_type']=='mob'){
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `effect` WHERE
`skill`='".$skill['id']."'
AND `account`='".$account['id']."'"),0)){
mysql_query("UPDATE `effect` SET
`time`='".time()."',
`last_cast`='".time()."',
`effect_hp_regen`='".$skill['effect_hp_regen']."',
`effect_hp_regen_percent`='".$skill['effect_hp_regen_percent']."',
`effect_time`='".$skill['effect_time']."',
`effect_every_sec`='".$skill['effect_every_sec']."'
WHERE `skill`='".$skill['id']."'");
}else{
mysql_query("INSERT INTO `effect`(
`time`,
`last_cast`,
`skill`,
`effect_hp_regen`,
`effect_hp_regen_percent`,
`effect_time`,
`effect_every_sec`,
`account`)VALUES(
'".time()."',
'".time()."',
'".$skill['id']."',
'".$skill['effect_hp_regen']."',
'".$skill['effect_hp_regen_percent']."',
'".$skill['effect_time']."',
'".$skill['effect_every_sec']."',
'".$account['id']."')");
}
}else{
$hpregtarget=mysql_fetch_assoc(mysql_query("SELECT * FROM `account` WHERE `id`='".$account['battle_attack']."'"));
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `effect` WHERE
`skill`='".$skill['id']."'
AND `account`='".$account['id']."'"),0)){
mysql_query("UPDATE `effect` SET
`time`='".time()."',
`last_cast`='".time()."',
`effect_hp_regen`='".$skill['effect_hp_regen']."',
`effect_hp_regen_percent`='".$skill['effect_hp_regen_percent']."',
`effect_time`='".$skill['effect_time']."',
`effect_every_sec`='".$skill['effect_every_sec']."'
WHERE `skill`='".$skill['id']."'");
}else{
mysql_query("INSERT INTO `effect`(
`time`,
`last_cast`,
`skill`,
`effect_hp_regen`,
`effect_hp_regen_percent`,
`effect_time`,
`effect_every_sec`,
`account`,
`target_type`,
`target`)VALUES(
'".time()."',
'".time()."',
'".$skill['id']."',
'".$skill['effect_hp_regen']."',
'".$skill['effect_hp_regen_percent']."',
'".$skill['effect_time']."',
'".$skill['effect_every_sec']."',
'".$account['id']."',
'user',
'".$hpregtarget['id']."')");
}
}
}
if($skill['damage'] && $account['battle_target_type']=='mob'){
mysql_query("UPDATE `mobs` SET
`hp`='".$hp."'
WHERE `id`='".$mob['id']."'");
mysql_query("INSERT INTO `battle_log`(
`account`,
`mess`)VALUES(
'".$account['id']."',
'<div class="help"><img src="/data/img/skill/".$skill['icon'].".jpg" width="15px" height="15px">Вы наносите ".$damaglast." урона</div>')");
}
mysql_query("UPDATE `account` SET
`mp`='".($account['mp']-$skill['mp_need_from_cast'])."'
WHERE
`id`='".$account['id']."'");
mysql_query("UPDATE `skill` SET
`last_cast`='".time()."'
WHERE
`account`='".$account['id']."'
AND `id`='".$skill['id']."'");
mysql_query("UPDATE `account` SET
`battle_last_attack`='".time()."'
WHERE
`id`='".$account['id']."'");
header("Location: ?");
exit;
}elseif($skill['type']=='magic'){
if ($skill['damage'] && $account['battle_target_type']=='mob'){
$damag=$skill['damage'] + rand(-3,3);
$damag=(ceil($damag/100)*$account['feature_attack_magic'])+$damag;
$damag=$damag-(ceil($damag/100)*$mob['feature_armor_magic']);
$damag=round($damag);
if ($damag<=0){
$damag=1;
}
$damag+=rand(1,3);
$kritpower=$account['power']-20;
if ($kritpower<=0){
$kritpower=1;
}
$kritdexterity=$account['dexterity']-15;
if ($kritdexterity<=0){
$kritdexterity=2;
}
$kritwit=$account['wit']-10;
if ($kritwit<=0){
$kritwit=2;
}
$krit=$kritdexterity+$kritpower+$kritwit;
if ($krit>65){
$krit=65;
}
$start=100-$krit;
$start=rand(1,$start);
$end=$start+$krit;
$chanse=rand(1,100);
if ($chanse>=$start && $chanse<=$end){
$damag=round($damag*rand(1.5,1.9));
}
$hp=$mob['hp']-$damag;
$damaglast=$damag;
if ($hp<0){
$hp=0;
if($skill['damage'] && $account['battle_target_type']=='mob'){
mysql_query("UPDATE `mobs` SET
`hp`='".$hp."'
WHERE `id`='".$mob['id']."'");
mysql_query("INSERT INTO `battle_log`(
`account`,
`mess`)VALUES(
'".$account['id']."',
'<div class="help"><img src="/data/img/skill/".$skill['icon'].".jpg" width="15px" height="15px">Вы наносите ".$damag." урона</div>')");
}
mysql_query("UPDATE `account` SET
`mp`='".($account['mp']-$skill['mp_need_from_cast'])."'
WHERE
`id`='".$account['id']."'");
mysql_query("UPDATE `skill` SET
`last_cast`='".time()."'
WHERE
`account`='".$account['id']."'
AND `id`='".$skill['id']."'");
mysql_query("UPDATE `account` SET
`battle_last_attack`='".time()."'
WHERE
`id`='".$account['id']."'");
$targett=mysql_fetch_assoc(mysql_query("SELECT * FROM `account` WHERE `id`='".$mob['battle_attack']."'"));
mysql_query("DELETE FROM `effect` WHERE
`target_type`='mob'
AND `target`='".$mob['id']."'");
mysql_query("UPDATE `mobs` SET
`hp`='".$mob['max_hp']."',
`mp`='".$mob['max_mp']."',
`last_death`='".time()."',
`battle`=''
WHERE
`id`='".$mob['id']."'");
//mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$mob['battle_attack']."','<div class="help">Вы победили</div>')");
$levl=mysql_fetch_assoc(mysql_query("SELECT * FROM `lvl` WHERE `id`='".$targett['lvl']."'"));
mysql_query("UPDATE `account` SET `exp`='".($targett['exp']+$mob['exp'])."' WHERE `id`='".$targett['id']."'");
$targett['exp']=mysql_result(mysql_query("SELECT `exp` FROM `account` WHERE `id`='".$targett['id']."'"),0);
//echo 'Получено опыта: '.$mob['exp'].'<br />';
if ($targett['clan']){
mysql_query("UPDATE `clan` SET `exp`=`exp`+".($mob['exp']/2)." WHERE `id`='".$targett['clan']."'");
}
if ($targett['exp']>$levl['exp']){
//$expe=$targett['exp']-$levl['exp'];
mysql_query("UPDATE `account` SET `lvl`='".($targett['lvl']+1)."',`exp`='0',`skill_point`=`skill_point`+'1',`character_point`=`character_point`+'2' WHERE `id`='".$targett['id']."'");
//echo 'Уровень повышен!<br />';
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Уровень повышен!</div>')");
}
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Получено опыта: ".$mob['exp']."</div>')");
$targett['exp']=mysql_result(mysql_query("SELECT `exp` FROM `account` WHERE `id`='".$targett['id']."'"),0);
if ($mob['drop_gold']){
mysql_query("UPDATE `account` SET
`gold`='".($targett['gold']+$mob['drop_gold'])."' WHERE `id`='".$targett['id']."'");
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Получено золота: ".$mob['drop_gold']."</div>')");
}
if ($mob['drop_items']){
$drop=explode(',',$mob['drop_items']);
foreach($drop as $value){
$item=explode(':',$value);
$start=100-$item[1];
$start=rand(1,$start);
$end=$start+$item[1];
$chanse=rand(1,100);
if ($chanse>=$start && $chanse<=$end){
$iteme=mysql_fetch_assoc(mysql_query("SELECT * FROM `items` WHERE
`id`='".$item[0]."'"));
if ($iteme['type']=='eat_bootle' OR $iteme['type']=='eat_eat' OR $iteme['type']=='resourse'){
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `inventory` WHERE
`ident_id`='".$iteme['id']."'
AND `account`='".$targett['id']."'"),0)){
if (isset($item[2])){
mysql_query("UPDATE `inventory` SET
`amount`=`amount` + '".$item[2]."'
WHERE
`ident_id`='".$iteme['id']."'
AND `account`='".$targett['id']."'");
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Получен предмет: ".$iteme['name']."х".$item[2]."</div>')");
}else{
mysql_query("UPDATE `inventory` SET
`amount`=`amount` + '1'
WHERE
`ident_id`='".$iteme['id']."'
AND `account`='".$targett['id']."'");
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Получен предмет: ".$iteme['name']."</div>')");
}
}else{
mysql_query("INSERT INTO `inventory`(
`name`,
`type`,
`feature_pover`,
`feature_vitality`,
`feature_dexterity`,
`feature_wit`,
`feature_spirit`,
`feature_armor_arrow`,
`feature_armor_weapon`,
`feature_armor_magic`,
`feature_attack_arrow`,
`feature_attack_weapon`,
`feature_attack_magic`,
`feature_hp_regen`,
`feature_mp_regen`,
`cast_hp_regen`,
`cast_mp_regen`,
`min_lvl`,
`amount`,
`coast`,
`about`,
`icon`,
`attack_min_damag`,
`attack_max_damag`,
`account`,
`twohands`,
`subtype`,
`ident_id`) VALUES (
'".$iteme['name']."',
'".$iteme['type']."',
'".$iteme['feature_pover']."',
'".$iteme['feature_vitality']."',
'".$iteme['feature_dexterity']."',
'".$iteme['feature_wit']."',
'".$iteme['feature_spirit']."',
'".$iteme['feature_armor_arrow']."',
'".$iteme['feature_armor_weapon']."',
'".$iteme['feature_armor_magic']."',
'".$iteme['feature_attack_arrow']."',
'".$iteme['feature_attack_weapon']."',
'".$iteme['feature_attack_magic']."',
'".$iteme['feature_hp_regen']."',
'".$iteme['feature_mp_regen']."',
'".$iteme['cast_hp_regen']."',
'".$iteme['cast_mp_regen']."',
'".$iteme['min_lvl']."',
'".$item[2]."',
'".$iteme['coast']."',
'".$iteme['about']."',
'".$iteme['icon']."',
'".$iteme['attack_min_damag']."',
'".$iteme['attack_max_damag']."',
'".$targett['id']."',
'".$iteme['twohands']."',
'".$iteme['subtype']."',
'".$iteme['id']."')") or die(mysql_error());
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Получен предмет: ".$iteme['name']."</div>')");
}
}else{
mysql_query("INSERT INTO `inventory`(
`name`,
`type`,
`feature_pover`,
`feature_vitality`,
`feature_dexterity`,
`feature_wit`,
`feature_spirit`,
`feature_armor_arrow`,
`feature_armor_weapon`,
`feature_armor_magic`,
`feature_attack_arrow`,
`feature_attack_weapon`,
`feature_attack_magic`,
`feature_hp_regen`,
`feature_mp_regen`,
`cast_hp_regen`,
`cast_mp_regen`,
`min_lvl`,
`coast`,
`about`,
`icon`,
`attack_min_damag`,
`attack_max_damag`,
`account`,
`twohands`,
`subtype`,
`ident_id`) VALUES (
'".$iteme['name']."',
'".$iteme['type']."',
'".$iteme['feature_pover']."',
'".$iteme['feature_vitality']."',
'".$iteme['feature_dexterity']."',
'".$iteme['feature_wit']."',
'".$iteme['feature_spirit']."',
'".$iteme['feature_armor_arrow']."',
'".$iteme['feature_armor_weapon']."',
'".$iteme['feature_armor_magic']."',
'".$iteme['feature_attack_arrow']."',
'".$iteme['feature_attack_weapon']."',
'".$iteme['feature_attack_magic']."',
'".$iteme['feature_hp_regen']."',
'".$iteme['feature_mp_regen']."',
'".$iteme['cast_hp_regen']."',
'".$iteme['cast_mp_regen']."',
'".$iteme['min_lvl']."',
'".$iteme['coast']."',
'".$iteme['about']."',
'".$iteme['icon']."',
'".$iteme['attack_min_damag']."',
'".$iteme['attack_max_damag']."',
'".$targett['id']."',
'".$iteme['twohands']."',
'".$iteme['subtype']."',
'".$iteme['id']."')") or die(mysql_error());
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Получен предмет: ".$iteme['name']."</div>')");
}
}
unset($chanse);
unset($start);
unset($end);
unset($iteme);
unset($item);
}
}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `quests` WHERE
`account`='".$targett['id']."'
AND `completed`=''
AND `kill_mob`='".$mob['ident_id']."'"),0)){
$quests=mysql_query("SELECT * FROM `quests` WHERE
`account`='".$targett['id']."'
AND `completed`='0'
AND `kill_mob`='".$mob['ident_id']."'");
while($resul=mysql_fetch_array($quests)){
mysql_query("UPDATE `quests` SET
`kill_mob_col_kill`='".($resul['kill_mob_col_kill']+1)."'
WHERE
`account`='".$targett['id']."'
AND `id`='".$resul['id']."'");
echo $mob['name'].' - убито '.($resul['kill_mob_col_kill']+1).'/'.$resul['kill_mob_col'].'<br />';
if ($resul['kill_mob_col_kill']+1==$resul['kill_mob_col'] && $resul['res_need']==$resul['res_need_col']){
//echo 'Цель достигнута<br />';
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Задание выполнено</div>')");
mysql_query("UPDATE `quests` SET
`completed`='1'
WHERE
`id`='".$resul['id']."'");
}
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">".$mob['name']." - убито ".($resul['kill_mob_col_kill']+1)."/".$resul['kill_mob_col']."</div>')");
}
}
if (!mysql_result(mysql_query("SELECT COUNT(*) FROM `mobs` WHERE `battle`='".$account['battle']."'"),0)){
mysql_query("DELETE FROM `battle` WHERE
`id`='".$account['battle']."'");
mysql_query("UPDATE `account` SET
`battle`='',
`battle_attack`='' WHERE `battle`='".$account['battle']."'");
$qb=mysql_query("SELECT * FROM `account` WHERE `battle`='".$account['battle']."'");
while($resqb=mysql_fetch_assoc($qb)){
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$resqb['id']."','<div class="help">Бой окончен</div>')");
}
header("Location: ?");
exit;
}else{
$nextmob=mysql_result(mysql_query("SELECT `id` FROM `mobs` WHERE `battle`='".$account['battle']."' LIMIT 1"),0);
mysql_query("UPDATE `account` SET `battle_attack`='".$nextmob."' WHERE `id`='".$account['id']."'");
header("Location: ?");
exit;
}
}
mysql_query("UPDATE `mobs` SET `hp`='".$hpd."' WHERE `id`='".$mob['id']."'");
}
if ($skill['stun'] OR $skill['paralich'] OR $skill['sleep'] OR $skill['fear'] AND $account['battle_target_type']){
if ($account['battle_target_type']='mob'){
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `effect`
WHERE `skill`='".$skill['id']."'
AND `account`='".$account['id']."'
AND `target_type`='mob'
AND `target`='".$mob['id']."'"),0)){
mysql_query("UPDATE `effect` SET `time`='".time()."',`last_cast`='".time()."' WHERE `account`='".$account['id']."' AND `skill`='".$skill['id']."' AND `target_type`='mob' AND `target`='".$mob['id']."'");
}else{
mysql_query("INSERT INTO `effect`(
`effect_time`,
`skill`,
`account`,
`target_type`,
`target`,
`fear`,
`sleep`,
`paralich`,
`stun`,
`time`)VALUES(
'".$skill['effect_time']."',
'".$skill['id']."',
'".$account['id']."',
'mob',
'".$mob['id']."',
'".$skill['fear']."',
'".$skill['sleep']."',
'".$skill['paralich']."',
'".$skill['stun']."',
'".time()."')");
mysql_query("UPDATE `skill` SET
`last_cast`='".time()."'
WHERE
`id`='".$skill['id']."'");
}
}else{
}
}
if ($skill['debaph']){
if ($account['battle_target_type']=='mob'){
//Сложение
$adding=0+$skill['baph_adding'];
//Воля
$will=0+$skill['baph_will'];
//Реакция
$reaction=0+$skill['baph_reaction'];
//Очки здоровья
$max_hp=0+$skill['baph_max_hp'];
//Очки маны
$max_mp=0+$skill['baph_max_mp'];
//Защита от ударов
$feature_armor_weapon=0+$skill['baph_feature_armor_weapon'];
//Защита от стрел
$feature_armor_arrow=0+$skill['baph_feature_armor_arrow'];
//Защита от магии
$feature_armor_magic=0+$skill['baph_feature_armor_magic'];
//Урон от ударов
$feature_attack_weapon=0+$skill['baph_feature_attack_weapon'];
//Урон от стрел
$feature_attack_arrow=0+$skill['baph_feature_attack_arrow'];
//Урон от магии
$feature_attack_magic=0+$skill['baph_feature_attack_magic'];
//Восстановление жизни
$hp_regen=0+$skill['baph_hp_regen'];
//Восстановление маны
$mp_regen=0+$skill['baph_mp_regen'];
//Power
$power=0+$skill['baph_power'];
//Wit
$wit=0+$skill['baph_wit'];
//Dexterity
$dexterity=0+$skill['baph_dexterity'];
//Vitality
$vitality=0+$skill['baph_vitality'];
//Spirit
$spirit=0+$skill['baph_spirit'];
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `effect`
WHERE `skill`='".$skill['id']."'
AND `account`='".$account['id']."'
AND `target_type`='mob'
AND `target`='".$mob['id']."'"),0)){
mysql_query("UPDATE `effect` SET
`debaph`='1',
`effect_time`='".$skill['effect_time']."',
`target_type`='mob',
`target`='".$mob['id']."',
`time`='".time()."',
`last_cast`='".time()."',
`baph_adding`='".$adding."',
`baph_will`='".$will."',
`baph_reaction`='".$reaction."',
`baph_max_hp`='".$max_hp."',
`baph_max_mp`='".$max_mp."',
`baph_feature_armor_weapon`='".$feature_armor_weapon."',
`baph_feature_armor_arrow`='".$feature_armor_arrow."',
`baph_feature_armor_magic`='".$feature_armor_magic."',
`baph_feature_attack_weapon`='".$feature_attack_weapon."',
`baph_feature_attack_arrow`='".$feature_attack_arrow."',
`baph_feature_attack_weapon`='".$feature_attack_magic."',
`baph_hp_regen`='".$hp_regen."',
`baph_mp_regen`='".$mp_regen."',
`baph_power`='".$power."',
`baph_wit`='".$wit."',
`baph_dexterity`='".$dexterity."',
`baph_spirit`='".$spirit."'
WHERE
`skill`='".$skill['id']."'
AND `account`='".$account['id']."'");
}else{
mysql_query("INSERT INTO `effect`(
`debaph`,
`account`,
`time`,
`last_cast`,
`effect_time`,
`skill`,
`target_type`,
`target`,
`baph_adding`,
`baph_will`,
`baph_reaction`,
`baph_max_hp`,
`baph_max_mp`,
`baph_feature_armor_weapon`,
`baph_feature_armor_arrow`,
`baph_feature_armor_magic`,
`baph_feature_attack_weapon`,
`baph_feature_attack_arrow`,
`baph_feature_attack_magic`,
`baph_hp_regen`,
`baph_mp_regen`,
`baph_power`,
`baph_wit`,
`baph_dexterity`,
`baph_spirit`
)VALUES(
'1',
'".$account['id']."',
'".time()."',
'".time()."',
'".$skill['effect_time']."',
'".$skill['id']."',
'mob',
'".$mob['id']."',
'".$adding."',
'".$will."',
'".$reaction."',
'".$max_hp."',
'".$max_mp."',
'".$feature_armor_weapon."',
'".$feature_armor_arrow."',
'".$feature_armor_magic."',
'".$feature_attack_weapon."',
'".$feature_attack_arrow."',
'".$feature_attack_magic."',
'".$hp_regen."',
'".$mp_regen."',
'".$power."',
'".$wit."',
'".$dexterity."',
'".$spirit."'
)");
}
}else{
}
}
if($skill['heal']){
if ($account['battle_target_type']=='mob'){
$damag=$skill['heal'] + 1;
$damag=(ceil($damag/100)*$account['feature_attack_magic'])+$damag;
$damag=round($damag);
if ($damag<=0){
$damag=1;
}
$damag+=rand(1,3);
$kritpower=$account['power']-20;
if ($kritpower<=0){
$kritpower=1;
}
$kritdexterity=$account['dexterity']-15;
if ($kritdexterity<=0){
$kritdexterity=2;
}
$kritwit=$account['wit']-10;
if ($kritwit<=0){
$kritwit=2;
}
$krit=$kritdexterity+$kritpower+$kritwit;
if ($krit>65){
$krit=65;
}
$start=100-$krit;
$start=rand(1,$start);
$end=$start+$krit;
$chanse=rand(1,100);
if ($chanse>=$start && $chanse<=$end){
$damag=round($damag*rand(1.5,1.9));
}
$hpheal=$account['hp']+$damag;
if ($account['max_hp']<$hpheal){
$hpheal=$account['max_hp'];
}
mysql_query("UPDATE `account` SET
`hp`='".$hpheal."'
WHERE
`id`='".$account['id']."'");
mysql_query("INSERT INTO `battle_log`(
`account`,
`mess`)VALUES(
'".$account['id']."',
'<div class="help"><img src="/data/img/skill/".$skill['icon'].".jpg" width="15px" height="15px">Вы исцелились на ".$damag." единиц</div>')");
mysql_query("UPDATE `skill` SET
`last_cast`='".time()."'
WHERE
`id`='".$skill['id']."'");
mysql_query("UPDATE `account` SET
`battle_last_attack`='".time()."'
WHERE
`id`='".$account['id']."'");
}else{
//если цель союзник
$damag=$skill['heal'] + 1;
$damag=(ceil($damag/100)*$account['feature_attack_magic'])+$damag;
$damag=round($damag);
if ($damag<=0){
$damag=1;
}
$damag+=rand(1,3);
$kritpower=$account['power']-20;
if ($kritpower<=0){
$kritpower=1;
}
$kritdexterity=$account['dexterity']-15;
if ($kritdexterity<=0){
$kritdexterity=2;
}
$kritwit=$account['wit']-10;
if ($kritwit<=0){
$kritwit=2;
}
$krit=$kritdexterity+$kritpower+$kritwit;
if ($krit>65){
$krit=65;
}
$start=100-$krit;
$start=rand(1,$start);
$end=$start+$krit;
$chanse=rand(1,100);
if ($chanse>=$start && $chanse<=$end){
$damag=round($damag*rand(1.5,1.9));
}
$hpheal=$mob['hp']+$damag;
if ($mob['max_hp']<$hpheal){
$hpheal=$mob['max_hp'];
}
mysql_query("UPDATE `account` SET
`hp`='".$hpheal."'
WHERE
`id`='".$mob['id']."'");
mysql_query("INSERT INTO `battle_log`(
`account`,
`mess`)VALUES(
'".$mob['id']."',
'<div class="help"><img src="/data/img/skill/".$skill['icon'].".jpg" width="15px" height="15px">".$account['name']." исцелил вас на ".$damag." единиц</div>')");
mysql_query("UPDATE `skill` SET
`last_cast`='".time()."'
WHERE
`id`='".$skill['id']."'");
mysql_query("UPDATE `account` SET
`battle_last_attack`='".time()."'
WHERE
`id`='".$account['id']."'");
}
}
if ($skill['baph']){
if ($account['battle_target_type']=='mob'){
//Сложение
$adding=0+$skill['baph_adding'];
//Воля
$will=0+$skill['baph_will'];
//Реакция
$reaction=0+$skill['baph_reaction'];
//Очки здоровья
$max_hp=0+$skill['baph_max_hp'];
//Очки маны
$max_mp=0+$skill['baph_max_mp'];
//Защита от ударов
$feature_armor_weapon=0+$skill['baph_feature_armor_weapon'];
//Защита от стрел
$feature_armor_arrow=0+$skill['baph_feature_armor_arrow'];
//Защита от магии
$feature_armor_magic=0+$skill['baph_feature_armor_magic'];
//Урон от ударов
$feature_attack_weapon=0+$skill['baph_feature_attack_weapon'];
//Урон от стрел
$feature_attack_arrow=0+$skill['baph_feature_attack_arrow'];
//Урон от магии
$feature_attack_magic=0+$skill['baph_feature_attack_magic'];
//Восстановление жизни
$hp_regen=0+$skill['baph_hp_regen'];
//Восстановление маны
$mp_regen=0+$skill['baph_mp_regen'];
//Power
$power=0+$skill['baph_power'];
//Wit
$wit=0+$skill['baph_wit'];
//Dexterity
$dexterity=0+$skill['baph_dexterity'];
//Vitality
$vitality=0+$skill['baph_vitality'];
//Spirit
$spirit=0+$skill['baph_spirit'];
if (mysql_result("SELECT COUNT(*) FROM `effect` WHERE
`account`='".$account['id']."'
AND `skill`='".$skill['id']."'")){
mysql_query("UPDATE `effect` SET
`time`='".time()."',
`last_cast`='".time()."',
`baph_adding`='".$adding."',
`baph_will`='".$will."',
`baph_reaction`='".$reaction."',
`baph_max_hp`='".$max_hp."',
`baph_max_mp`='".$max_mp."',
`baph_feature_armor_weapon`='".$feature_armor_weapon."',
`baph_feature_armor_arrow`='".$feature_armor_arrow."',
`baph_feature_armor_magic`='".$feature_armor_magic."',
`baph_feature_attack_weapon`='".$feature_attack_weapon."',
`baph_feature_attack_arrow`='".$feature_attack_arrow."',
`baph_feature_attack_weapon`='".$feature_attack_magic."',
`baph_hp_regen`='".$hp_regen."',
`baph_mp_regen`='".$mp_regen."',
`baph_power`='".$power."',
`baph_wit`='".$wit."',
`baph_dexterity`='".$dexterity."',
`baph_spirit`='".$spirit."'
WHERE
`skill`='".$skill['id']."'
AND `account`='".$account['id']."'");
}else{
mysql_query("INSERT INTO `effect`(
`baph`,
`account`,
`time`,
`last_cast`,
`effect_time`,
`skill`,
`baph_adding`,
`baph_will`,
`baph_reaction`,
`baph_max_hp`,
`baph_max_mp`,
`baph_feature_armor_weapon`,
`baph_feature_armor_arrow`,
`baph_feature_armor_magic`,
`baph_feature_attack_weapon`,
`baph_feature_attack_arrow`,
`baph_feature_attack_magic`,
`baph_hp_regen`,
`baph_mp_regen`,
`baph_power`,
`baph_wit`,
`baph_dexterity`,
`baph_spirit`
)VALUES(
'1',
'".$account['id']."',
'".time()."',
'".time()."',
'".$skill['effect_time']."',
'".$skill['id']."',
'".$adding."',
'".$will."',
'".$reaction."',
'".$max_hp."',
'".$max_mp."',
'".$feature_armor_weapon."',
'".$feature_armor_arrow."',
'".$feature_armor_magic."',
'".$feature_attack_weapon."',
'".$feature_attack_arrow."',
'".$feature_attack_magic."',
'".$hp_regen."',
'".$mp_regen."',
'".$power."',
'".$wit."',
'".$dexterity."',
'".$spirit."'
)");
}
}else{
//Сложение
$adding=0+$skill['baph_adding'];
//Воля
$will=0+$skill['baph_will'];
//Реакция
$reaction=0+$skill['baph_reaction'];
//Очки здоровья
$max_hp=0+$skill['baph_max_hp'];
//Очки маны
$max_mp=0+$skill['baph_max_mp'];
//Защита от ударов
$feature_armor_weapon=0+$skill['baph_feature_armor_weapon'];
//Защита от стрел
$feature_armor_arrow=0+$skill['baph_feature_armor_arrow'];
//Защита от магии
$feature_armor_magic=0+$skill['baph_feature_armor_magic'];
//Урон от ударов
$feature_attack_weapon=0+$skill['baph_feature_attack_weapon'];
//Урон от стрел
$feature_attack_arrow=0+$skill['baph_feature_attack_arrow'];
//Урон от магии
$feature_attack_magic=0+$skill['baph_feature_attack_magic'];
//Восстановление жизни
$hp_regen=0+$skill['baph_hp_regen'];
//Восстановление маны
$mp_regen=0+$skill['baph_mp_regen'];
//Power
$power=0+$skill['baph_power'];
//Wit
$wit=0+$skill['baph_wit'];
//Dexterity
$dexterity=0+$skill['baph_dexterity'];
//Vitality
$vitality=0+$skill['baph_vitality'];
//Spirit
$spirit=0+$skill['baph_spirit'];
if (mysql_result("SELECT COUNT(*) FROM `effect` WHERE
`account`='".$account['id']."'
AND `skill`='".$skill['id']."' AND `target_type`='user' AND `target`='".$account['battle_attack']."'")){
mysql_query("UPDATE `effect` SET
`time`='".time()."',
`last_cast`='".time()."',
`baph_adding`='".$adding."',
`baph_will`='".$will."',
`baph_reaction`='".$reaction."',
`baph_max_hp`='".$max_hp."',
`baph_max_mp`='".$max_mp."',
`baph_feature_armor_weapon`='".$feature_armor_weapon."',
`baph_feature_armor_arrow`='".$feature_armor_arrow."',
`baph_feature_armor_magic`='".$feature_armor_magic."',
`baph_feature_attack_weapon`='".$feature_attack_weapon."',
`baph_feature_attack_arrow`='".$feature_attack_arrow."',
`baph_feature_attack_weapon`='".$feature_attack_magic."',
`baph_hp_regen`='".$hp_regen."',
`baph_mp_regen`='".$mp_regen."',
`baph_power`='".$power."',
`baph_wit`='".$wit."',
`baph_dexterity`='".$dexterity."',
`baph_spirit`='".$spirit."',
`target_type`='user',
`target`='".$account['battle_attack']."'
WHERE
`skill`='".$skill['id']."'
AND `account`='".$account['id']."'");
}else{
mysql_query("INSERT INTO `effect`(
`baph`,
`account`,
`time`,
`last_cast`,
`effect_time`,
`skill`,
`baph_adding`,
`baph_will`,
`baph_reaction`,
`baph_max_hp`,
`baph_max_mp`,
`baph_feature_armor_weapon`,
`baph_feature_armor_arrow`,
`baph_feature_armor_magic`,
`baph_feature_attack_weapon`,
`baph_feature_attack_arrow`,
`baph_feature_attack_magic`,
`baph_hp_regen`,
`baph_mp_regen`,
`baph_power`,
`baph_wit`,
`baph_dexterity`,
`baph_spirit`,
`target_type`,
`target`
)VALUES(
'1',
'".$account['id']."',
'".time()."',
'".time()."',
'".$skill['effect_time']."',
'".$skill['id']."',
'".$adding."',
'".$will."',
'".$reaction."',
'".$max_hp."',
'".$max_mp."',
'".$feature_armor_weapon."',
'".$feature_armor_arrow."',
'".$feature_armor_magic."',
'".$feature_attack_weapon."',
'".$feature_attack_arrow."',
'".$feature_attack_magic."',
'".$hp_regen."',
'".$mp_regen."',
'".$power."',
'".$wit."',
'".$dexterity."',
'".$spirit."',
'user',
'".$account['battle_attack']."'
)");
}
}
}
if ($skill['effect_damage'] && $account['battle_target_type']=='mob'){
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `effect` WHERE
`skill`='".$skill['id']."'
AND `account`='".$account['id']."'
AND `target_type`='mob'
AND `target`='".$mob['id']."'"),0)){
mysql_query("UPDATE `effect` SET
`time`='".time()."',
`last_cast`='".time()."',
`effect_damage`='".$skill['effect_damage']."',
`effect_time`='".$skill['effect_time']."',
`effect_every_sec`='".$skill['effect_every']."',
`target_type`='mob',
`target`='".$mob['id']."',
`dota`='1',
WHERE `skill`='".$skill['id']."'");
}else{
mysql_query("INSERT INTO `effect`(
`effect_damage`,
`time`,
`effect_time`,
`effect_every_sec`,
`account`,
`target_type`,
`target`,
`skill`,
`last_cast`,
`dota`)VALUES(
'".$skill['effect_damage']."',
'".time()."',
'".$skill['effect_time']."',
'".$skill['effect_every_sec']."',
'".$account['id']."',
'mob',
'".$mob['id']."',
'".$skill['id']."',
'".time()."',
'1')");
}
}
if($skill['effect_hp_regen'] || $skill['effect_hp_regen_percent']){
if ($account['battle_target_type']=='mob'){
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `effect` WHERE
`skill`='".$skill['id']."'
AND `account`='".$account['id']."'"),0)){
mysql_query("UPDATE `effect` SET
`time`='".time()."',
`last_cast`='".time()."',
`effect_hp_regen`='".$skill['effect_hp_regen']."',
`effect_hp_regen_percent`='".$skill['effect_hp_regen_percent']."',
`effect_time`='".$skill['effect_time']."',
`effect_every_sec`='".$skill['effect_every_sec']."'
WHERE `skill`='".$skill['id']."'");
}else{
mysql_query("INSERT INTO `effect`(
`time`,
`last_cast`,
`skill`,
`effect_hp_regen`,
`effect_hp_regen_percent`,
`effect_time`,
`effect_every_sec`,
`account`)VALUES(
'".time()."',
'".time()."',
'".$skill['id']."',
'".$skill['effect_hp_regen']."',
'".$skill['effect_hp_regen_percent']."',
'".$skill['effect_time']."',
'".$skill['effect_every_sec']."',
'".$account['id']."')");
}
}else{
$hpregtarget=mysql_fetch_assoc(mysql_query("SELECT * FROM `account` WHERE `id`='".$account['battle_attack']."'"));
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `effect` WHERE
`skill`='".$skill['id']."'
AND `account`='".$account['id']."'"),0)){
mysql_query("UPDATE `effect` SET
`time`='".time()."',
`last_cast`='".time()."',
`effect_hp_regen`='".$skill['effect_hp_regen']."',
`effect_hp_regen_percent`='".$skill['effect_hp_regen_percent']."',
`effect_time`='".$skill['effect_time']."',
`effect_every_sec`='".$skill['effect_every_sec']."'
WHERE `skill`='".$skill['id']."'");
}else{
mysql_query("INSERT INTO `effect`(
`time`,
`last_cast`,
`skill`,
`effect_hp_regen`,
`effect_hp_regen_percent`,
`effect_time`,
`effect_every_sec`,
`account`,
`target_type`,
`target`)VALUES(
'".time()."',
'".time()."',
'".$skill['id']."',
'".$skill['effect_hp_regen']."',
'".$skill['effect_hp_regen_percent']."',
'".$skill['effect_time']."',
'".$skill['effect_every_sec']."',
'".$account['id']."',
'user',
'".$hpregtarget['id']."')");
}
}
}
if($skill['damage'] && $account['battle_target_type']=='mob'){
mysql_query("UPDATE `mobs` SET
`hp`='".$hp."'
WHERE `id`='".$mob['id']."'");
mysql_query("INSERT INTO `battle_log`(
`account`,
`mess`)VALUES(
'".$account['id']."',
'<div class="help"><img src="/data/img/skill/".$skill['icon'].".jpg" width="15px" height="15px">Вы наносите ".$damaglast." урона</div>')");
}
mysql_query("UPDATE `account` SET
`mp`='".($account['mp']-$skill['mp_need_from_cast'])."'
WHERE
`id`='".$account['id']."'");
mysql_query("UPDATE `skill` SET
`last_cast`='".time()."'
WHERE
`account`='".$account['id']."'
AND `id`='".$skill['id']."'");
mysql_query("UPDATE `account` SET
`battle_last_attack`='".time()."'
WHERE
`id`='".$account['id']."'");
header("Location: ?");
exit;
}elseif($skill['type']=='arrow'){
if ($skill['damage'] && $account['battle_target_type']=='mob'){
$damag=$skill['damage'] + rand(-3,3);
$damag=(ceil($damag/100)*$account['feature_attack_arrow'])+$damag;
$damag=$damag-(ceil($damag/100)*$mob['feature_armor_arrow']);
$damag=round($damag);
if ($damag<=0){
$damag=1;
}
$damag+=rand(1,3);
$kritpower=$account['power']-20;
if ($kritpower<=0){
$kritpower=1;
}
$kritdexterity=$account['dexterity']-15;
if ($kritdexterity<=0){
$kritdexterity=2;
}
$kritwit=$account['wit']-10;
if ($kritwit<=0){
$kritwit=2;
}
$krit=$kritdexterity+$kritpower+$kritwit;
if ($krit>65){
$krit=65;
}
$start=100-$krit;
$start=rand(1,$start);
$end=$start+$krit;
$chanse=rand(1,100);
if ($chanse>=$start && $chanse<=$end){
$damag=round($damag*rand(1.5,1.9));
}
$hp=$mob['hp']-$damag;
$damaglast=$damag;
if ($hp<0){
$hp=0;
if($skill['damage'] && $account['battle_target_type']=='mob'){
mysql_query("UPDATE `mobs` SET
`hp`='".$hp."'
WHERE `id`='".$mob['id']."'");
mysql_query("INSERT INTO `battle_log`(
`account`,
`mess`)VALUES(
'".$account['id']."',
'<div class="help"><img src="/data/img/skill/".$skill['icon'].".jpg" width="15px" height="15px">Вы наносите ".$damag." урона</div>')");
}
mysql_query("UPDATE `account` SET
`mp`='".($account['mp']-$skill['mp_need_from_cast'])."'
WHERE
`id`='".$account['id']."'");
mysql_query("UPDATE `skill` SET
`last_cast`='".time()."'
WHERE
`account`='".$account['id']."'
AND `id`='".$skill['id']."'");
mysql_query("UPDATE `account` SET
`battle_last_attack`='".time()."'
WHERE
`id`='".$account['id']."'");
$targett=mysql_fetch_assoc(mysql_query("SELECT * FROM `account` WHERE `id`='".$mob['battle_attack']."'"));
mysql_query("DELETE FROM `effect` WHERE
`target_type`='mob'
AND `target`='".$mob['id']."'");
mysql_query("UPDATE `mobs` SET
`hp`='".$mob['max_hp']."',
`mp`='".$mob['max_mp']."',
`last_death`='".time()."',
`battle`=''
WHERE
`id`='".$mob['id']."'");
//mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$mob['battle_attack']."','<div class="help">Вы победили</div>')");
$levl=mysql_fetch_assoc(mysql_query("SELECT * FROM `lvl` WHERE `id`='".$targett['lvl']."'"));
mysql_query("UPDATE `account` SET `exp`='".($targett['exp']+$mob['exp'])."' WHERE `id`='".$targett['id']."'");
//echo 'Получено опыта: '.$mob['exp'].'<br />';
if ($targett['clan']){
mysql_query("UPDATE `clan` SET `exp`=`exp`+".($mob['exp']/2)." WHERE `id`='".$targett['clan']."'");
}
$targett['exp']=mysql_result(mysql_query("SELECT `exp` FROM `account` WHERE `id`='".$targett['id']."'"),0);
if ($targett['exp']>$levl['exp']){
//$expe=$targett['exp']-$levl['exp'];
mysql_query("UPDATE `account` SET `lvl`='".($targett['lvl']+1)."',`exp`='0',`skill_point`=`skill_point`+'1',`character_point`=`character_point`+'2' WHERE `id`='".$targett['id']."'");
//echo 'Уровень повышен!<br />';
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Уровень повышен!</div>')");
}
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Получено опыта: ".$mob['exp']."</div>')");
$targett['exp']=mysql_result(mysql_query("SELECT `exp` FROM `account` WHERE `id`='".$targett['id']."'"),0);
if ($mob['drop_gold']){
mysql_query("UPDATE `account` SET
`gold`='".($targett['gold']+$mob['drop_gold'])."' WHERE `id`='".$targett['id']."'");
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Получено золота: ".$mob['drop_gold']."</div>')");
}
if ($mob['drop_items']){
$drop=explode(',',$mob['drop_items']);
foreach($drop as $value){
$item=explode(':',$value);
$start=100-$item[1];
$start=rand(1,$start);
$end=$start+$item[1];
$chanse=rand(1,100);
if ($chanse>=$start && $chanse<=$end){
$iteme=mysql_fetch_assoc(mysql_query("SELECT * FROM `items` WHERE
`id`='".$item[0]."'"));
if ($iteme['type']=='eat_bootle' OR $iteme['type']=='eat_eat' OR $iteme['type']=='resourse'){
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `inventory` WHERE
`ident_id`='".$iteme['id']."'
AND `account`='".$targett['id']."'"),0)){
if (isset($item[2])){
mysql_query("UPDATE `inventory` SET
`amount`=`amount` + '".$item[2]."'
WHERE
`ident_id`='".$iteme['id']."'
AND `account`='".$targett['id']."'");
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Получен предмет: ".$iteme['name']."х".$item[2]."</div>')");
}else{
mysql_query("UPDATE `inventory` SET
`amount`=`amount` + '1'
WHERE
`ident_id`='".$iteme['id']."'
AND `account`='".$targett['id']."'");
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Получен предмет: ".$iteme['name']."</div>')");
}
}else{
mysql_query("INSERT INTO `inventory`(
`name`,
`type`,
`feature_pover`,
`feature_vitality`,
`feature_dexterity`,
`feature_wit`,
`feature_spirit`,
`feature_armor_arrow`,
`feature_armor_weapon`,
`feature_armor_magic`,
`feature_attack_arrow`,
`feature_attack_weapon`,
`feature_attack_magic`,
`feature_hp_regen`,
`feature_mp_regen`,
`cast_hp_regen`,
`cast_mp_regen`,
`min_lvl`,
`amount`,
`coast`,
`about`,
`icon`,
`attack_min_damag`,
`attack_max_damag`,
`account`,
`twohands`,
`subtype`,
`ident_id`) VALUES (
'".$iteme['name']."',
'".$iteme['type']."',
'".$iteme['feature_pover']."',
'".$iteme['feature_vitality']."',
'".$iteme['feature_dexterity']."',
'".$iteme['feature_wit']."',
'".$iteme['feature_spirit']."',
'".$iteme['feature_armor_arrow']."',
'".$iteme['feature_armor_weapon']."',
'".$iteme['feature_armor_magic']."',
'".$iteme['feature_attack_arrow']."',
'".$iteme['feature_attack_weapon']."',
'".$iteme['feature_attack_magic']."',
'".$iteme['feature_hp_regen']."',
'".$iteme['feature_mp_regen']."',
'".$iteme['cast_hp_regen']."',
'".$iteme['cast_mp_regen']."',
'".$iteme['min_lvl']."',
'".$item[2]."',
'".$iteme['coast']."',
'".$iteme['about']."',
'".$iteme['icon']."',
'".$iteme['attack_min_damag']."',
'".$iteme['attack_max_damag']."',
'".$targett['id']."',
'".$iteme['twohands']."',
'".$iteme['subtype']."',
'".$iteme['id']."')") or die(mysql_error());
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Получен предмет: ".$iteme['name']."'</div>)");
}
}else{
mysql_query("INSERT INTO `inventory`(
`name`,
`type`,
`feature_pover`,
`feature_vitality`,
`feature_dexterity`,
`feature_wit`,
`feature_spirit`,
`feature_armor_arrow`,
`feature_armor_weapon`,
`feature_armor_magic`,
`feature_attack_arrow`,
`feature_attack_weapon`,
`feature_attack_magic`,
`feature_hp_regen`,
`feature_mp_regen`,
`cast_hp_regen`,
`cast_mp_regen`,
`min_lvl`,
`coast`,
`about`,
`icon`,
`attack_min_damag`,
`attack_max_damag`,
`account`,
`twohands`,
`subtype`,
`ident_id`) VALUES (
'".$iteme['name']."',
'".$iteme['type']."',
'".$iteme['feature_pover']."',
'".$iteme['feature_vitality']."',
'".$iteme['feature_dexterity']."',
'".$iteme['feature_wit']."',
'".$iteme['feature_spirit']."',
'".$iteme['feature_armor_arrow']."',
'".$iteme['feature_armor_weapon']."',
'".$iteme['feature_armor_magic']."',
'".$iteme['feature_attack_arrow']."',
'".$iteme['feature_attack_weapon']."',
'".$iteme['feature_attack_magic']."',
'".$iteme['feature_hp_regen']."',
'".$iteme['feature_mp_regen']."',
'".$iteme['cast_hp_regen']."',
'".$iteme['cast_mp_regen']."',
'".$iteme['min_lvl']."',
'".$iteme['coast']."',
'".$iteme['about']."',
'".$iteme['icon']."',
'".$iteme['attack_min_damag']."',
'".$iteme['attack_max_damag']."',
'".$targett['id']."',
'".$iteme['twohands']."',
'".$iteme['subtype']."',
'".$iteme['id']."')") or die(mysql_error());
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Получен предмет: ".$iteme['name']."'</div>)");
}
}
unset($chanse);
unset($start);
unset($end);
unset($iteme);
unset($item);
}
}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `quests` WHERE
`account`='".$targett['id']."'
AND `completed`=''
AND `kill_mob`='".$mob['ident_id']."'"),0)){
$quests=mysql_query("SELECT * FROM `quests` WHERE
`account`='".$targett['id']."'
AND `completed`='0'
AND `kill_mob`='".$mob['ident_id']."'");
while($resul=mysql_fetch_array($quests)){
mysql_query("UPDATE `quests` SET
`kill_mob_col_kill`='".($resul['kill_mob_col_kill']+1)."'
WHERE
`account`='".$targett['id']."'
AND `id`='".$resul['id']."'");
echo $mob['name'].' - убито '.($resul['kill_mob_col_kill']+1).'/'.$resul['kill_mob_col'].'<br />';
if ($resul['kill_mob_col_kill']+1==$resul['kill_mob_col'] && $resul['res_need']==$resul['res_need_col']){
//echo 'Цель достигнута<br />';
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Задание выполнено</div>')");
mysql_query("UPDATE `quests` SET
`completed`='1'
WHERE
`id`='".$resul['id']."'");
}
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','".$mob['name']." - убито ".($resul['kill_mob_col_kill']+1)."/".$resul['kill_mob_col']."')");
}
}
if (!mysql_result(mysql_query("SELECT COUNT(*) FROM `mobs` WHERE `battle`='".$account['battle']."'"),0)){
mysql_query("DELETE FROM `battle` WHERE
`id`='".$account['battle']."'");
mysql_query("UPDATE `account` SET
`battle`='',
`battle_attack`='' WHERE `battle`='".$account['battle']."'");
$qb=mysql_query("SELECT * FROM `account` WHERE `battle`='".$account['battle']."'");
while($resqb=mysql_fetch_assoc($qb)){
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$resqb['id']."','<div class="help">Бой окончен</div>')");
}
//mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$mob['battle_attack']."','<div class="help">Вы победили</div>')");
header("Location: ?");
exit;
}else{
$nextmob=mysql_result(mysql_query("SELECT `id` FROM `mobs` WHERE `battle`='".$account['battle']."' LIMIT 1"),0);
mysql_query("UPDATE `account` SET `battle_attack`='".$nextmob."' WHERE `id`='".$account['id']."'");
header("Location: ?");
exit;
}
}
mysql_query("UPDATE `mobs` SET `hp`='".$hpd."' WHERE `id`='".$mob['id']."'");
}
if ($skill['stun'] OR $skill['paralich'] OR $skill['sleep'] OR $skill['fear'] AND $account['battle_target_type']){
if ($account['battle_target_type']='mob'){
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `effect`
WHERE `skill`='".$skill['id']."'
AND `account`='".$account['id']."'
AND `target_type`='mob'
AND `target`='".$mob['id']."'"),0)){
mysql_query("UPDATE `effect` SET `time`='".time()."',`last_cast`='".time()."' WHERE `account`='".$account['id']."' AND `skill`='".$skill['id']."' AND `target_type`='mob' AND `target`='".$mob['id']."'");
}else{
mysql_query("INSERT INTO `effect`(
`effect_time`,
`skill`,
`account`,
`target_type`,
`target`,
`fear`,
`sleep`,
`paralich`,
`stun`,
`time`)VALUES(
'".$skill['effect_time']."',
'".$skill['id']."',
'".$account['id']."',
'mob',
'".$mob['id']."',
'".$skill['fear']."',
'".$skill['sleep']."',
'".$skill['paralich']."',
'".$skill['stun']."',
'".time()."')");
mysql_query("UPDATE `skill` SET
`last_cast`='".time()."'
WHERE
`id`='".$skill['id']."'");
}
}else{
}
}
if ($skill['debaph']){
if ($account['battle_target_type']=='mob'){
//Сложение
$adding=0+$skill['baph_adding'];
//Воля
$will=0+$skill['baph_will'];
//Реакция
$reaction=0+$skill['baph_reaction'];
//Очки здоровья
$max_hp=0+$skill['baph_max_hp'];
//Очки маны
$max_mp=0+$skill['baph_max_mp'];
//Защита от ударов
$feature_armor_weapon=0+$skill['baph_feature_armor_weapon'];
//Защита от стрел
$feature_armor_arrow=0+$skill['baph_feature_armor_arrow'];
//Защита от магии
$feature_armor_magic=0+$skill['baph_feature_armor_magic'];
//Урон от ударов
$feature_attack_weapon=0+$skill['baph_feature_attack_weapon'];
//Урон от стрел
$feature_attack_arrow=0+$skill['baph_feature_attack_arrow'];
//Урон от магии
$feature_attack_magic=0+$skill['baph_feature_attack_magic'];
//Восстановление жизни
$hp_regen=0+$skill['baph_hp_regen'];
//Восстановление маны
$mp_regen=0+$skill['baph_mp_regen'];
//Power
$power=0+$skill['baph_power'];
//Wit
$wit=0+$skill['baph_wit'];
//Dexterity
$dexterity=0+$skill['baph_dexterity'];
//Vitality
$vitality=0+$skill['baph_vitality'];
//Spirit
$spirit=0+$skill['baph_spirit'];
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `effect`
WHERE `skill`='".$skill['id']."'
AND `account`='".$account['id']."'
AND `target_type`='mob'
AND `target`='".$mob['id']."'"),0)){
mysql_query("UPDATE `effect` SET
`debaph`='1',
`effect_time`='".$skill['effect_time']."',
`target_type`='mob',
`target`='".$mob['id']."',
`time`='".time()."',
`last_cast`='".time()."',
`baph_adding`='".$adding."',
`baph_will`='".$will."',
`baph_reaction`='".$reaction."',
`baph_max_hp`='".$max_hp."',
`baph_max_mp`='".$max_mp."',
`baph_feature_armor_weapon`='".$feature_armor_weapon."',
`baph_feature_armor_arrow`='".$feature_armor_arrow."',
`baph_feature_armor_magic`='".$feature_armor_magic."',
`baph_feature_attack_weapon`='".$feature_attack_weapon."',
`baph_feature_attack_arrow`='".$feature_attack_arrow."',
`baph_feature_attack_weapon`='".$feature_attack_magic."',
`baph_hp_regen`='".$hp_regen."',
`baph_mp_regen`='".$mp_regen."',
`baph_power`='".$power."',
`baph_wit`='".$wit."',
`baph_dexterity`='".$dexterity."',
`baph_spirit`='".$spirit."'
WHERE
`skill`='".$skill['id']."'
AND `account`='".$account['id']."'");
}else{
mysql_query("INSERT INTO `effect`(
`debaph`,
`account`,
`time`,
`last_cast`,
`effect_time`,
`skill`,
`target_type`,
`target`,
`baph_adding`,
`baph_will`,
`baph_reaction`,
`baph_max_hp`,
`baph_max_mp`,
`baph_feature_armor_weapon`,
`baph_feature_armor_arrow`,
`baph_feature_armor_magic`,
`baph_feature_attack_weapon`,
`baph_feature_attack_arrow`,
`baph_feature_attack_magic`,
`baph_hp_regen`,
`baph_mp_regen`,
`baph_power`,
`baph_wit`,
`baph_dexterity`,
`baph_spirit`
)VALUES(
'1',
'".$account['id']."',
'".time()."',
'".time()."',
'".$skill['effect_time']."',
'".$skill['id']."',
'mob',
'".$mob['id']."',
'".$adding."',
'".$will."',
'".$reaction."',
'".$max_hp."',
'".$max_mp."',
'".$feature_armor_weapon."',
'".$feature_armor_arrow."',
'".$feature_armor_magic."',
'".$feature_attack_weapon."',
'".$feature_attack_arrow."',
'".$feature_attack_magic."',
'".$hp_regen."',
'".$mp_regen."',
'".$power."',
'".$wit."',
'".$dexterity."',
'".$spirit."'
)");
}
}else{
}
}
if($skill['heal']){
if ($account['battle_target_type']=='mob'){
$damag=$skill['heal'] + 1;
$damag=(ceil($damag/100)*$account['feature_attack_magic'])+$damag;
$damag=round($damag);
if ($damag<=0){
$damag=1;
}
$damag+=rand(1,3);
$kritpower=$account['power']-20;
if ($kritpower<=0){
$kritpower=1;
}
$kritdexterity=$account['dexterity']-15;
if ($kritdexterity<=0){
$kritdexterity=2;
}
$kritwit=$account['wit']-10;
if ($kritwit<=0){
$kritwit=2;
}
$krit=$kritdexterity+$kritpower+$kritwit;
if ($krit>65){
$krit=65;
}
$start=100-$krit;
$start=rand(1,$start);
$end=$start+$krit;
$chanse=rand(1,100);
if ($chanse>=$start && $chanse<=$end){
$damag=round($damag*rand(1.5,1.9));
}
$hpheal=$account['hp']+$damag;
if ($account['max_hp']<$hpheal){
$hpheal=$account['max_hp'];
}
mysql_query("UPDATE `account` SET
`hp`='".$hpheal."'
WHERE
`id`='".$account['id']."'");
mysql_query("INSERT INTO `battle_log`(
`account`,
`mess`)VALUES(
'".$account['id']."',
'<div class="help"><img src="/data/img/skill/".$skill['icon'].".jpg" width="15px" height="15px">Вы исцелились на ".$damag." единиц</div>')");
mysql_query("UPDATE `skill` SET
`last_cast`='".time()."'
WHERE
`id`='".$skill['id']."'");
mysql_query("UPDATE `account` SET
`battle_last_attack`='".time()."'
WHERE
`id`='".$account['id']."'");
}else{
//если цель союзник
$damag=$skill['heal'] + 1;
$damag=(ceil($damag/100)*$account['feature_attack_magic'])+$damag;
$damag=round($damag);
if ($damag<=0){
$damag=1;
}
$damag+=rand(1,3);
$kritpower=$account['power']-20;
if ($kritpower<=0){
$kritpower=1;
}
$kritdexterity=$account['dexterity']-15;
if ($kritdexterity<=0){
$kritdexterity=2;
}
$kritwit=$account['wit']-10;
if ($kritwit<=0){
$kritwit=2;
}
$krit=$kritdexterity+$kritpower+$kritwit;
if ($krit>65){
$krit=65;
}
$start=100-$krit;
$start=rand(1,$start);
$end=$start+$krit;
$chanse=rand(1,100);
if ($chanse>=$start && $chanse<=$end){
$damag=round($damag*rand(1.5,1.9));
}
$hpheal=$mob['hp']+$damag;
if ($mob['max_hp']<$hpheal){
$hpheal=$mob['max_hp'];
}
mysql_query("UPDATE `account` SET
`hp`='".$hpheal."'
WHERE
`id`='".$mob['id']."'");
mysql_query("INSERT INTO `battle_log`(
`account`,
`mess`)VALUES(
'".$mob['id']."',
'<div class="help"><img src="/data/img/skill/".$skill['icon'].".jpg" width="15px" height="15px"><b>".$account['name']."</b> исцелил вас на ".$damag." единиц</div>')");
mysql_query("UPDATE `skill` SET
`last_cast`='".time()."'
WHERE
`id`='".$skill['id']."'");
mysql_query("UPDATE `account` SET
`battle_last_attack`='".time()."'
WHERE
`id`='".$account['id']."'");
}
}
if ($skill['baph']){
if ($account['battle_target_type']=='mob'){
//Сложение
$adding=0+$skill['baph_adding'];
//Воля
$will=0+$skill['baph_will'];
//Реакция
$reaction=0+$skill['baph_reaction'];
//Очки здоровья
$max_hp=0+$skill['baph_max_hp'];
//Очки маны
$max_mp=0+$skill['baph_max_mp'];
//Защита от ударов
$feature_armor_weapon=0+$skill['baph_feature_armor_weapon'];
//Защита от стрел
$feature_armor_arrow=0+$skill['baph_feature_armor_arrow'];
//Защита от магии
$feature_armor_magic=0+$skill['baph_feature_armor_magic'];
//Урон от ударов
$feature_attack_weapon=0+$skill['baph_feature_attack_weapon'];
//Урон от стрел
$feature_attack_arrow=0+$skill['baph_feature_attack_arrow'];
//Урон от магии
$feature_attack_magic=0+$skill['baph_feature_attack_magic'];
//Восстановление жизни
$hp_regen=0+$skill['baph_hp_regen'];
//Восстановление маны
$mp_regen=0+$skill['baph_mp_regen'];
//Power
$power=0+$skill['baph_power'];
//Wit
$wit=0+$skill['baph_wit'];
//Dexterity
$dexterity=0+$skill['baph_dexterity'];
//Vitality
$vitality=0+$skill['baph_vitality'];
//Spirit
$spirit=0+$skill['baph_spirit'];
if (mysql_result("SELECT COUNT(*) FROM `effect` WHERE
`account`='".$account['id']."'
AND `skill`='".$skill['id']."'")){
mysql_query("UPDATE `effect` SET
`time`='".time()."',
`last_cast`='".time()."',
`baph_adding`='".$adding."',
`baph_will`='".$will."',
`baph_reaction`='".$reaction."',
`baph_max_hp`='".$max_hp."',
`baph_max_mp`='".$max_mp."',
`baph_feature_armor_weapon`='".$feature_armor_weapon."',
`baph_feature_armor_arrow`='".$feature_armor_arrow."',
`baph_feature_armor_magic`='".$feature_armor_magic."',
`baph_feature_attack_weapon`='".$feature_attack_weapon."',
`baph_feature_attack_arrow`='".$feature_attack_arrow."',
`baph_feature_attack_weapon`='".$feature_attack_magic."',
`baph_hp_regen`='".$hp_regen."',
`baph_mp_regen`='".$mp_regen."',
`baph_power`='".$power."',
`baph_wit`='".$wit."',
`baph_dexterity`='".$dexterity."',
`baph_spirit`='".$spirit."'
WHERE
`skill`='".$skill['id']."'
AND `account`='".$account['id']."'");
}else{
mysql_query("INSERT INTO `effect`(
`baph`,
`account`,
`time`,
`last_cast`,
`effect_time`,
`skill`,
`baph_adding`,
`baph_will`,
`baph_reaction`,
`baph_max_hp`,
`baph_max_mp`,
`baph_feature_armor_weapon`,
`baph_feature_armor_arrow`,
`baph_feature_armor_magic`,
`baph_feature_attack_weapon`,
`baph_feature_attack_arrow`,
`baph_feature_attack_magic`,
`baph_hp_regen`,
`baph_mp_regen`,
`baph_power`,
`baph_wit`,
`baph_dexterity`,
`baph_spirit`
)VALUES(
'1',
'".$account['id']."',
'".time()."',
'".time()."',
'".$skill['effect_time']."',
'".$skill['id']."',
'".$adding."',
'".$will."',
'".$reaction."',
'".$max_hp."',
'".$max_mp."',
'".$feature_armor_weapon."',
'".$feature_armor_arrow."',
'".$feature_armor_magic."',
'".$feature_attack_weapon."',
'".$feature_attack_arrow."',
'".$feature_attack_magic."',
'".$hp_regen."',
'".$mp_regen."',
'".$power."',
'".$wit."',
'".$dexterity."',
'".$spirit."'
)");
}
}else{
//Сложение
$adding=0+$skill['baph_adding'];
//Воля
$will=0+$skill['baph_will'];
//Реакция
$reaction=0+$skill['baph_reaction'];
//Очки здоровья
$max_hp=0+$skill['baph_max_hp'];
//Очки маны
$max_mp=0+$skill['baph_max_mp'];
//Защита от ударов
$feature_armor_weapon=0+$skill['baph_feature_armor_weapon'];
//Защита от стрел
$feature_armor_arrow=0+$skill['baph_feature_armor_arrow'];
//Защита от магии
$feature_armor_magic=0+$skill['baph_feature_armor_magic'];
//Урон от ударов
$feature_attack_weapon=0+$skill['baph_feature_attack_weapon'];
//Урон от стрел
$feature_attack_arrow=0+$skill['baph_feature_attack_arrow'];
//Урон от магии
$feature_attack_magic=0+$skill['baph_feature_attack_magic'];
//Восстановление жизни
$hp_regen=0+$skill['baph_hp_regen'];
//Восстановление маны
$mp_regen=0+$skill['baph_mp_regen'];
//Power
$power=0+$skill['baph_power'];
//Wit
$wit=0+$skill['baph_wit'];
//Dexterity
$dexterity=0+$skill['baph_dexterity'];
//Vitality
$vitality=0+$skill['baph_vitality'];
//Spirit
$spirit=0+$skill['baph_spirit'];
if (mysql_result("SELECT COUNT(*) FROM `effect` WHERE
`account`='".$account['id']."'
AND `skill`='".$skill['id']."' AND `target_type`='user' AND `target`='".$account['battle_attack']."'")){
mysql_query("UPDATE `effect` SET
`time`='".time()."',
`last_cast`='".time()."',
`baph_adding`='".$adding."',
`baph_will`='".$will."',
`baph_reaction`='".$reaction."',
`baph_max_hp`='".$max_hp."',
`baph_max_mp`='".$max_mp."',
`baph_feature_armor_weapon`='".$feature_armor_weapon."',
`baph_feature_armor_arrow`='".$feature_armor_arrow."',
`baph_feature_armor_magic`='".$feature_armor_magic."',
`baph_feature_attack_weapon`='".$feature_attack_weapon."',
`baph_feature_attack_arrow`='".$feature_attack_arrow."',
`baph_feature_attack_weapon`='".$feature_attack_magic."',
`baph_hp_regen`='".$hp_regen."',
`baph_mp_regen`='".$mp_regen."',
`baph_power`='".$power."',
`baph_wit`='".$wit."',
`baph_dexterity`='".$dexterity."',
`baph_spirit`='".$spirit."',
`target_type`='user',
`target`='".$account['battle_attack']."'
WHERE
`skill`='".$skill['id']."'
AND `account`='".$account['id']."'");
}else{
mysql_query("INSERT INTO `effect`(
`baph`,
`account`,
`time`,
`last_cast`,
`effect_time`,
`skill`,
`baph_adding`,
`baph_will`,
`baph_reaction`,
`baph_max_hp`,
`baph_max_mp`,
`baph_feature_armor_weapon`,
`baph_feature_armor_arrow`,
`baph_feature_armor_magic`,
`baph_feature_attack_weapon`,
`baph_feature_attack_arrow`,
`baph_feature_attack_magic`,
`baph_hp_regen`,
`baph_mp_regen`,
`baph_power`,
`baph_wit`,
`baph_dexterity`,
`baph_spirit`,
`target_type`,
`target`
)VALUES(
'1',
'".$account['id']."',
'".time()."',
'".time()."',
'".$skill['effect_time']."',
'".$skill['id']."',
'".$adding."',
'".$will."',
'".$reaction."',
'".$max_hp."',
'".$max_mp."',
'".$feature_armor_weapon."',
'".$feature_armor_arrow."',
'".$feature_armor_magic."',
'".$feature_attack_weapon."',
'".$feature_attack_arrow."',
'".$feature_attack_magic."',
'".$hp_regen."',
'".$mp_regen."',
'".$power."',
'".$wit."',
'".$dexterity."',
'".$spirit."',
'user',
'".$account['battle_attack']."'
)");
}
}
}
if ($skill['effect_damage'] && $account['battle_target_type']=='mob'){
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `effect` WHERE
`skill`='".$skill['id']."'
AND `account`='".$account['id']."'
AND `target_type`='mob'
AND `target`='".$mob['id']."'"),0)){
mysql_query("UPDATE `effect` SET
`time`='".time()."',
`last_cast`='".time()."',
`effect_damage`='".$skill['effect_damage']."',
`effect_time`='".$skill['effect_time']."',
`effect_every_sec`='".$skill['effect_every']."',
`target_type`='mob',
`target`='".$mob['id']."',
`dota`='1',
WHERE `skill`='".$skill['id']."'");
}else{
mysql_query("INSERT INTO `effect`(
`effect_damage`,
`time`,
`effect_time`,
`effect_every_sec`,
`account`,
`target_type`,
`target`,
`skill`,
`last_cast`,
`dota`)VALUES(
'".$skill['effect_damage']."',
'".time()."',
'".$skill['effect_time']."',
'".$skill['effect_every_sec']."',
'".$account['id']."',
'mob',
'".$mob['id']."',
'".$skill['id']."',
'".time()."',
'1')");
}
}
if($skill['effect_hp_regen'] || $skill['effect_hp_regen_percent']){
if ($account['battle_target_type']=='mob'){
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `effect` WHERE
`skill`='".$skill['id']."'
AND `account`='".$account['id']."'"),0)){
mysql_query("UPDATE `effect` SET
`time`='".time()."',
`last_cast`='".time()."',
`effect_hp_regen`='".$skill['effect_hp_regen']."',
`effect_hp_regen_percent`='".$skill['effect_hp_regen_percent']."',
`effect_time`='".$skill['effect_time']."',
`effect_every_sec`='".$skill['effect_every_sec']."'
WHERE `skill`='".$skill['id']."'");
}else{
mysql_query("INSERT INTO `effect`(
`time`,
`last_cast`,
`skill`,
`effect_hp_regen`,
`effect_hp_regen_percent`,
`effect_time`,
`effect_every_sec`,
`account`)VALUES(
'".time()."',
'".time()."',
'".$skill['id']."',
'".$skill['effect_hp_regen']."',
'".$skill['effect_hp_regen_percent']."',
'".$skill['effect_time']."',
'".$skill['effect_every_sec']."',
'".$account['id']."')");
}
}else{
$hpregtarget=mysql_fetch_assoc(mysql_query("SELECT * FROM `account` WHERE `id`='".$account['battle_attack']."'"));
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `effect` WHERE
`skill`='".$skill['id']."'
AND `account`='".$account['id']."'"),0)){
mysql_query("UPDATE `effect` SET
`time`='".time()."',
`last_cast`='".time()."',
`effect_hp_regen`='".$skill['effect_hp_regen']."',
`effect_hp_regen_percent`='".$skill['effect_hp_regen_percent']."',
`effect_time`='".$skill['effect_time']."',
`effect_every_sec`='".$skill['effect_every_sec']."'
WHERE `skill`='".$skill['id']."'");
}else{
mysql_query("INSERT INTO `effect`(
`time`,
`last_cast`,
`skill`,
`effect_hp_regen`,
`effect_hp_regen_percent`,
`effect_time`,
`effect_every_sec`,
`account`,
`target_type`,
`target`)VALUES(
'".time()."',
'".time()."',
'".$skill['id']."',
'".$skill['effect_hp_regen']."',
'".$skill['effect_hp_regen_percent']."',
'".$skill['effect_time']."',
'".$skill['effect_every_sec']."',
'".$account['id']."',
'user',
'".$hpregtarget['id']."')");
}
}
}
if($skill['damage'] && $account['battle_target_type']=='mob'){
mysql_query("UPDATE `mobs` SET
`hp`='".$hp."'
WHERE `id`='".$mob['id']."'");
mysql_query("INSERT INTO `battle_log`(
`account`,
`mess`)VALUES(
'".$account['id']."',
'<div class="help"><img src="/data/img/skill/".$skill['icon'].".jpg" width="15px" height="15px">Вы наносите ".$damaglast." урона</div>')");
}
mysql_query("UPDATE `account` SET
`mp`='".($account['mp']-$skill['mp_need_from_cast'])."'
WHERE
`id`='".$account['id']."'");
mysql_query("UPDATE `skill` SET
`last_cast`='".time()."'
WHERE
`account`='".$account['id']."'
AND `id`='".$skill['id']."'");
mysql_query("UPDATE `account` SET
`battle_last_attack`='".time()."'
WHERE
`id`='".$account['id']."'");
header("Location: ?");
exit;
}
}
if (isset($_GET['attack'])){
if (time()-$account['battle_last_attack']<2){
header("Location: ?");
exit;
}
if ($account['battle_target_type']=='user'){
header('Location: ?');
exit;
}
/*************Обнуляем характеристики************/
//Сложение
$mob['adding'] = 0;
//Воля
$mob['will'] = 0;
//Реакция
$mob['reaction'] = 0;
//Защита от ударов
$mob['feature_armor_weapon']=0;
//Защита от стрел
$mob['feature_armor_arrow']=0;
//Защита от магии
$mob['feature_armor_magic']=0;
//Урон от ударов
$mob['feature_attack_weapon']=0;
//Урон от стрел
$mob['feature_attack_arrow']=0;
//Урон от магии
$mob['feature_attack_magic']=0;
//Минимальный урон(оружие)
$mob['min_damag']=0;
//Максимальный урон(оружие)
$mob['max_damag']=0;
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `effect` WHERE
`debaph`='1'
AND `target_type`='mob'
AND `target`='".$mob['id']."'"),0)){
$qdb=mysql_query("SELECT * FROM `effect` WHERE
`debaph`='1'
AND `target_type`='mob'
AND `target`='".$mob['id']."'");
while($resultdb=mysql_fetch_assoc($qdb)){
if (time()-$resultdb['time']>=$resultdb['effect_time']){
mysql_query("DELETE FROM `effect` WHERE
`id`='".$resultdb['id']."'");
header("Location: ?");
exit;
}
//Сложение
$mob['adding']-=$resultdb['baph_adding'];
//Воля
$mob['will']-=$resultdb['baph_will'];
//Реакция
$mob['reaction']-=$resultdb['baph_reaction'];
//Очки здоровья
$mob['max_hp']-=$resultdb['baph_max_hp'];
//Очки маны
$mob['max_mp']-=$resultdb['baph_max_mp'];
//Защита от ударов
$mob['feature_armor_weapon']-=$resultdb['baph_feature_armor_weapon'];
//Защита от стрел
$mob['feature_armor_arrow']-=$resultdb['baph_feature_armor_arrow'];
//Защита от магии
$mob['feature_armor_magic']-=$resultdb['baph_feature_armor_magic'];
//Урон от ударов
$mob['feature_attack_weapon']-=$resultdb['baph_feature_attack_weapon'];
//Урон от стрел
$mob['feature_attack_arrow']-=$resultdb['baph_feature_attack_arrow'];
//Урон от магии
$mob['feature_attack_magic']-=$resultdb['baph_feature_attack_magic'];
//Восстановление жизни
$mob['hp_regen']-=$resultdb['baph_hp_regen'];
//Восстановление маны
$mob['mp_regen']-=$resultdb['baph_mp_regen'];
//Power
$mob['power']-=$resultdb['baph_power'];
//Wit
$mob['wit']-=$resultdb['baph_wit'];
//Dexterity
$mob['dexterity']-=$resultdb['baph_dexterity'];
//Vitality
$mob['vitality']-=$resultdb['baph_vitality'];
//Spirit
$mob['spirit']-=$resultdb['baph_spirit'];
foreach($mob as $key=>$value){
if (is_numeric($value)){
if ($value<0){
$mob[$key]=0;
}
}
}
}
}
/*************************************************************************************
************************Характеристики*************************************************
****************************************************************************************/
//Сложение
$addingmin=0.02*$mob['power'];
$mob['adding'] += ceil($mob['power']-$addingmin);
//Воля
$willmin=0.02*$mob['wit'];
$mob['will'] += ceil($mob['wit']-$willmin);
//Реакция
$reactionmin=0.02*$mob['dexterity'];
$mob['reaction'] += ceil($mob['dexterity']-$reactionmin);
//Защита от ударов
$armorweaponmin=floor($mob['power']/2)*0.01;
$mob['feature_armor_weapon']+=($mob['power']*0.55)-$armorweaponmin;
//Защита от стрел
$armorarrowmin=floor($mob['dexterity']/2)*0.01;
$mob['feature_armor_arrow']+=($mob['dexterity']*0.55)-$armorarrowmin;
//Защита от магии
$armormagicmin=floor($mob['wit']/2)*0.01;
$mob['feature_armor_magic']+=($mob['wit']*0.55)-$armormagicmin;
//Урон от ударов
$mob['feature_attack_weapon']+=floor($mob['power']/2)*1;
//Урон от стрел
$mob['feature_attack_arrow']+=floor($mob['dexterity']/2)*1;
//Урон от магии
$mob['feature_attack_magic']+=floor($mob['wit']/2)*1;
/*******************************************************************
**********************DAMAG******************************************
**********************************************************************/
$damag=rand($account['min_damag'],$account['max_damag']);
$damag=(ceil($damag/100)*$account['feature_attack_weapon'])+$damag;
$damag=$damag-(ceil($damag/100)*$mob['feature_armor_weapon']);
$damag=round($damag);
if ($damag<=0){
$damag=1;
}
$damag+=rand(1,3);
$kritpower=$account['power']-20;
if ($kritpower<=0){
$kritpower=1;
}
$kritdexterity=$account['dexterity']-15;
if ($kritdexterity<=0){
$kritdexterity=2;
}
$kritwit=$account['wit']-10;
if ($kritwit<=0){
$kritwit=2;
}
$krit=$kritdexterity+$kritpower+$kritwit;
if ($krit>65){
$krit=65;
}
$start=100-$krit;
$start=rand(1,$start);
$end=$start+$krit;
$chanse=rand(1,100);
if ($chanse>=$start && $chanse<=$end){
$damag=round($damag*rand(1.5,1.9));
}
$hp=$mob['hp']-$damag;
if ($hp<0){
$hp=0;
if($damag && $account['battle_target_type']=='mob'){
mysql_query("UPDATE `mobs` SET
`hp`='".$hp."'
WHERE `id`='".$mob['id']."'");
mysql_query("INSERT INTO `battle_log`(
`account`,
`mess`)VALUES(
'".$account['id']."',
'<div class="help"><img src="/data/img/skill/attack.jpg" width="15px" height="15px">Вы наносите ".$damag." урона</div>')");
}
//mysql_query("UPDATE `account` SET
//`mp`='".($account['mp']-$skill['mp_need_from_cast'])."'
//WHERE
//`id`='".$account['id']."'");
mysql_query("UPDATE `skill` SET
`last_cast`='".time()."'
WHERE
`account`='".$account['id']."'
AND `id`='".$skill['id']."'");
mysql_query("UPDATE `account` SET
`battle_last_attack`='".time()."'
WHERE
`id`='".$account['id']."'");
$targett=mysql_fetch_assoc(mysql_query("SELECT * FROM `account` WHERE `id`='".$mob['battle_attack']."'"));
mysql_query("DELETE FROM `effect` WHERE
`target_type`='mob'
AND `target`='".$mob['id']."'");
mysql_query("UPDATE `mobs` SET
`hp`='".$mob['max_hp']."',
`mp`='".$mob['max_mp']."',
`last_death`='".time()."',
`battle`=''
WHERE
`id`='".$mob['id']."'");
//mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$mob['battle_attack']."','<div class="help">Вы победили</div>')");
$levl=mysql_fetch_assoc(mysql_query("SELECT * FROM `lvl` WHERE `id`='".$targett['lvl']."'"));
mysql_query("UPDATE `account` SET `exp`='".($targett['exp']+$mob['exp'])."' WHERE `id`='".$targett['id']."'");
$targett['exp']=mysql_result(mysql_query("SELECT `exp` FROM `account` WHERE `id`='".$targett['id']."'"),0);
//echo 'Получено опыта: '.$mob['exp'].'<br />';
if ($mob['drop_gold']){
mysql_query("UPDATE `account` SET
`gold`='".($targett['gold']+$mob['drop_gold'])."' WHERE `id`='".$targett['id']."'");
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Получено золота: ".$mob['drop_gold']."</div>')");
}
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Получено опыта: ".$mob['exp']."</div>')");
if ($targett['clan']){
mysql_query("UPDATE `clan` SET `exp`=`exp`+".($mob['exp']/2)." WHERE `id`='".$targett['clan']."'");
}
$targett['exp']=mysql_result(mysql_query("SELECT `exp` FROM `account` WHERE `id`='".$targett['id']."'"),0);
if ($targett['exp']>$levl['exp']){
//$expe=$targett['exp']-$levl['exp'];
mysql_query("UPDATE `account` SET `lvl`='".($targett['lvl']+1)."',`exp`='0',`skill_point`=`skill_point`+'1',`character_point`=`character_point`+'2' WHERE `id`='".$targett['id']."'");
//echo 'Уровень повышен!<br />';
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Уровень повышен!</div>')");
}
if ($mob['drop_items']){
$drop=explode(',',$mob['drop_items']);
foreach($drop as $value){
$item=explode(':',$value);
$start=100-$item[1];
$start=rand(1,$start);
$end=$start+$item[1];
$chanse=rand(1,100);
if ($chanse>=$start && $chanse<=$end){
$iteme=mysql_fetch_assoc(mysql_query("SELECT * FROM `items` WHERE
`id`='".$item[0]."'"));
if ($iteme['type']=='eat_bootle' OR $iteme['type']=='eat_eat' OR $iteme['type']=='resourse'){
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `inventory` WHERE
`ident_id`='".$iteme['id']."'
AND `account`='".$targett['id']."'"),0)){
if (isset($item[2])){
mysql_query("UPDATE `inventory` SET
`amount`=`amount` + '".$item[2]."'
WHERE
`ident_id`='".$iteme['id']."'
AND `account`='".$targett['id']."'");
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Получен предмет: ".$iteme['name']."х".$item[2]."</div>')");
}else{
mysql_query("UPDATE `inventory` SET
`amount`=`amount` + '1'
WHERE
`ident_id`='".$iteme['id']."'
AND `account`='".$targett['id']."'");
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Получен предмет: ".$iteme['name']."</div>')");
}
}else{
mysql_query("INSERT INTO `inventory`(
`name`,
`type`,
`feature_pover`,
`feature_vitality`,
`feature_dexterity`,
`feature_wit`,
`feature_spirit`,
`feature_armor_arrow`,
`feature_armor_weapon`,
`feature_armor_magic`,
`feature_attack_arrow`,
`feature_attack_weapon`,
`feature_attack_magic`,
`feature_hp_regen`,
`feature_mp_regen`,
`cast_hp_regen`,
`cast_mp_regen`,
`min_lvl`,
`amount`,
`coast`,
`about`,
`icon`,
`attack_min_damag`,
`attack_max_damag`,
`account`,
`twohands`,
`subtype`,
`ident_id`) VALUES (
'".$iteme['name']."',
'".$iteme['type']."',
'".$iteme['feature_pover']."',
'".$iteme['feature_vitality']."',
'".$iteme['feature_dexterity']."',
'".$iteme['feature_wit']."',
'".$iteme['feature_spirit']."',
'".$iteme['feature_armor_arrow']."',
'".$iteme['feature_armor_weapon']."',
'".$iteme['feature_armor_magic']."',
'".$iteme['feature_attack_arrow']."',
'".$iteme['feature_attack_weapon']."',
'".$iteme['feature_attack_magic']."',
'".$iteme['feature_hp_regen']."',
'".$iteme['feature_mp_regen']."',
'".$iteme['cast_hp_regen']."',
'".$iteme['cast_mp_regen']."',
'".$iteme['min_lvl']."',
'".$item[2]."',
'".$iteme['coast']."',
'".$iteme['about']."',
'".$iteme['icon']."',
'".$iteme['attack_min_damag']."',
'".$iteme['attack_max_damag']."',
'".$targett['id']."',
'".$iteme['twohands']."',
'".$iteme['subtype']."',
'".$iteme['id']."')") or die(mysql_error());
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Получен предмет: ".$iteme['name']."</div>')");
}
}else{
mysql_query("INSERT INTO `inventory`(
`name`,
`type`,
`feature_pover`,
`feature_vitality`,
`feature_dexterity`,
`feature_wit`,
`feature_spirit`,
`feature_armor_arrow`,
`feature_armor_weapon`,
`feature_armor_magic`,
`feature_attack_arrow`,
`feature_attack_weapon`,
`feature_attack_magic`,
`feature_hp_regen`,
`feature_mp_regen`,
`cast_hp_regen`,
`cast_mp_regen`,
`min_lvl`,
`coast`,
`about`,
`icon`,
`attack_min_damag`,
`attack_max_damag`,
`account`,
`twohands`,
`subtype`,
`ident_id`) VALUES (
'".$iteme['name']."',
'".$iteme['type']."',
'".$iteme['feature_pover']."',
'".$iteme['feature_vitality']."',
'".$iteme['feature_dexterity']."',
'".$iteme['feature_wit']."',
'".$iteme['feature_spirit']."',
'".$iteme['feature_armor_arrow']."',
'".$iteme['feature_armor_weapon']."',
'".$iteme['feature_armor_magic']."',
'".$iteme['feature_attack_arrow']."',
'".$iteme['feature_attack_weapon']."',
'".$iteme['feature_attack_magic']."',
'".$iteme['feature_hp_regen']."',
'".$iteme['feature_mp_regen']."',
'".$iteme['cast_hp_regen']."',
'".$iteme['cast_mp_regen']."',
'".$iteme['min_lvl']."',
'".$iteme['coast']."',
'".$iteme['about']."',
'".$iteme['icon']."',
'".$iteme['attack_min_damag']."',
'".$iteme['attack_max_damag']."',
'".$targett['id']."',
'".$iteme['twohands']."',
'".$iteme['subtype']."',
'".$iteme['id']."')") or die(mysql_error());
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Получен предмет: ".$iteme['name']."</div>')");
}
}
unset($chanse);
unset($start);
unset($end);
unset($iteme);
unset($item);
}
}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `quests` WHERE
`account`='".$targett['id']."'
AND `completed`=''
AND `kill_mob`='".$mob['ident_id']."'"),0)){
$quests=mysql_query("SELECT * FROM `quests` WHERE
`account`='".$targett['id']."'
AND `completed`='0'
AND `kill_mob`='".$mob['ident_id']."'");
while($resul=mysql_fetch_array($quests)){
mysql_query("UPDATE `quests` SET
`kill_mob_col_kill`='".($resul['kill_mob_col_kill']+1)."'
WHERE
`account`='".$targett['id']."'
AND `id`='".$resul['id']."'");
echo $mob['name'].' - убито '.($resul['kill_mob_col_kill']+1).'/'.$resul['kill_mob_col'].'<br />';
if ($resul['kill_mob_col_kill']+1==$resul['kill_mob_col'] && $resul['res_need']==$resul['res_need_col']){
//echo 'Цель достигнута<br />';
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Задание выполнено</div>')");
mysql_query("UPDATE `quests` SET
`completed`='1'
WHERE
`id`='".$resul['id']."'");
}
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">".$mob['name']." - убито ".($resul['kill_mob_col_kill']+1)."/".$resul['kill_mob_col']."</div>')");
}
}
if (!mysql_result(mysql_query("SELECT COUNT(*) FROM `mobs` WHERE `battle`='".$account['battle']."'"),0)){
mysql_query("DELETE FROM `battle` WHERE
`id`='".$account['battle']."'");
mysql_query("UPDATE `account` SET
`battle`='',
`battle_attack`='' WHERE `battle`='".$account['battle']."'");
$qb=mysql_query("SELECT * FROM `account` WHERE `battle`='".$account['battle']."'");
while($resqb=mysql_fetch_assoc($qb)){
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$resqb['id']."','<div class="help">Бой окончен</div>')");
}
header("Location: ?");
exit;
}else{
$nextmob=mysql_result(mysql_query("SELECT `id` FROM `mobs` WHERE `battle`='".$account['battle']."' LIMIT 1"),0);
mysql_query("UPDATE `account` SET `battle_attack`='".$nextmob."' WHERE `id`='".$account['id']."'");
header("Location: ?");
exit;
}
}
mysql_query("UPDATE `mobs` SET
`hp`='".$hp."'
WHERE
`id`='".$mob['id']."'");
mysql_query("INSERT INTO `battle_log`(
`account`,
`mess`)VALUES(
'".$account['id']."',
'<div class="help"><img src="/data/img/skill/attack.jpg" width="15px" height="15px">Вы наносите ".$damag." урона</div>')");
mysql_query("UPDATE `account` SET
`battle_last_attack`='".time()."'
WHERE
`id`='".$account['id']."'");
header("Location: ?");
exit;
}
echo '
</center>
';
/*@$hpe['width']=round(100/($account['max_hp']/$account['hp']));
//@$mpe['width']=round(100/($account['max_mp']/$account['mp']));
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `effect` WHERE (`account`='".$account['id']."' AND `target_type`='0') OR (`target_type`='user' AND `target`='".$account['id']."')"),0)){
$qrea=mysql_query("SELECT * FROM `effect` WHERE (`account`='".$account['id']."' AND `target_type`='0') OR (`target_type`='user' AND `target`='".$account['id']."')");
while($resea=mysql_fetch_assoc($qrea)){
$skillea=mysql_fetch_assoc(mysql_query("SELECT * FROM `skill` WHERE
`id`='".$resea['skill']."'"));
echo '<img src="/data/img/skill/'.$skillea['icon'].'.jpg" height="10px" width="10px" title="'.$skillea['name'].'">';
}
}
echo '
<table width="100%">
<tr>
<td valign="top" width="50%">
<div style="height:20px;background:#FA8072;margin-bottom:2px;border-radius:5px 5px 5px 5px;">
<div style="height:20px;padding-left:5px;float:left;font-size:11px;color:white;border-radius:5px 5px 5px 5px;"><center><!--'.$account['hp'].'/'.$account['max_hp'].'!--></center></div>
<div style="height:20px;border-radius:5px 5px 5px 5px;width:'.$hpe['width'].'%;background:url(style/img/hp.jpg) left repeat-x;"></div></div>
</td><td valign="top" width="50%">
<div style="height:20px;background:#5B5BB5;margin-bottom:2px;border-radius:5px 5px 5px 5px;">
<div style="font-align:right;height:20px;padding-left:0px;float:left;font-size:11px;border-radius:5px 5px 5px 5px;color:white;"><font align="right"><center><!--'.$account['mp'].'/'.$account['max_mp'].'--!></center></font></div>
<div style="height:20px;width:'.$mpe['width'].'%;background:url(style/img/mp.jpg) left repeat-x;border-radius:5px 5px 5px 5px;"></div></div>
</td>
</tr>
</table>';
echo '</div>';*/
echo '<div class="title">Бой</div>';
echo '<div class="border-top"></div>';
if ($account['battle_target_type']=='mob'){
if ($mob['hp']){
$mob_hp['hp']=round(100/($mob['max_hp']/$mob['hp']));
}else{
$mob_hp['hp']=1;
}
if ($mob['mp']){
$mob_mp['mp']=round(100/($mob['max_mp']/$mob['mp']));
}else{
$mob_mp['mp']=1;
}
echo '
<table width="100%" class="tools">
<tr>
<td rowspan="2">
<img src="/data/img/units/mobs/'.$mob['icon'].'.jpg" width="35px" height="35px">
</td>
<td>'.$mob['name'];
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `effect`
WHERE `target_type`='mob'
AND `target`='".$mob['id']."'"),0)){
$queryeffects=mysql_query("SELECT * FROM `effect`
WHERE `target_type`='mob'
AND `target`='".$mob['id']."'");
while($resulteffects=mysql_fetch_assoc($queryeffects)){
$skilll=mysql_fetch_array(mysql_query("SELECT * FROM `skill` WHERE
`id`='".$resulteffects['skill']."'"));
echo '<img src="/data/img/skill/'.$skilll['icon'].'.jpg" height="15px" width="15px" title="'.$skilll['about'].'">';
}
}
echo '</td>
</tr><tr>
<td width="100%">
<div style="height:14px;opacity:0.5;margin-bottom:2px;border-radius:0px 5px 0px 5px;width:206px; border:2px solid black;">
<div style="height:14px;padding-left:5px;float:left;font-size:11px;color:white;0px 5px 0px 5px;width:206px;"><center>'.$mob['hp'].'/'.$mob['max_hp'].'</center></div>
<div style="height:14px;border-radius:0px 5px 0px 5px;width:'.$mob_hp['hp'].'%;background:';
if ($mob_hp['hp'] >= 90){
echo '#32CD32';
}elseif($mob_hp['hp'] <= 89 AND $mob_hp['hp'] >=80){
echo '#9ACD32';
}elseif($mob_hp['hp'] >= 70 AND $mob_hp['hp'] <=79){
echo '#FFD700';
}elseif($mob_hp['hp'] >= 60 AND $mob_hp['hp'] <=69){
echo '#FFA500';
}elseif($mob_hp['hp'] >= 50 AND $mob_hp['hp'] <=59){
echo '#FF8C00';
}elseif($mob_hp['hp'] >= 40 AND $mob_hp['hp'] <=49){
echo '#FF4500';
}elseif($mob_hp['hp'] >= 30 AND $mob_hp['hp'] <=39){
echo '#D2691E';
}elseif($mob_hp['hp'] >= 20 AND $mob_hp['hp'] <=29){
echo '#FF0000';
}elseif($mob_hp['hp'] >= 10 AND $mob_hp['hp'] <=19){
echo '#B22222';
}elseif($mob_hp['hp'] >=1 AND $mob_hp['hp'] <= 9){
echo '#A52A2A';
}
echo ';"></div></div>
</td>
</tr>
</table>';
echo '</div>';
}else{
if ($mob['hp']){
$mob_hp['hp']=round(100/($mob['max_hp']/$mob['hp']));
}else{
$mob_hp['hp']=1;
}
if ($mob['mp']){
$mob_mp['mp']=round(100/($mob['max_mp']/$mob['mp']));
}else{
$mob_mp['mp']=1;
}
echo '<div class="bars">'.$mob['name'].' ';
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `effect`
WHERE (`account`='".$mob['id']."' AND `target_type`='0') OR (`target_type`='user' AND `target`='".$mob['id']."')"),0)){
$queryeffects=mysql_query("SELECT * FROM `effect`
WHERE (`account`='".$mob['id']."' AND `target_type`='0') OR (`target_type`='user' AND `target`='".$mob['id']."')");
while($resulteffects=mysql_fetch_assoc($queryeffects)){
$skilll=mysql_fetch_array(mysql_query("SELECT * FROM `skill` WHERE
`id`='".$resulteffects['skill']."'"));
echo '<img src="/data/img/skill/'.$skilll['icon'].'.jpg" height="10px" width="10px" title="'.$skilll['about'].'">';
}
}
echo '
<table width="100%">
<tr>
<td valign="top" width="50%">
<div style="height:14px;opacity:0.5;margin-bottom:2px;border-radius:5px 0px 5px 0px;border:2px solid black;">
<div style="height:14px;padding-left:5px;float:left;font-size:11px;color:white;border-radius:5px 0px 5px 0px;"><center>'.$mob['hp'].'/'.$mob['max_hp'].'</center></div>
<div style="height:14px;border-radius:5px 0px 5px 0px;width:'.$mob_hp['hp'].'%;background:';
if ($mob_hp['hp'] >= 90){
echo '#32CD32';
}elseif($mob_hp['hp'] <= 89 AND $mob_hp['hp'] >=80){
echo '#9ACD32';
}elseif($mob_hp['hp'] >= 70 AND $mob_hp['hp'] <=79){
echo '#FFD700';
}elseif($mob_hp['hp'] >= 60 AND $mob_hp['hp'] <=69){
echo '#FFA500';
}elseif($mob_hp['hp'] >= 50 AND $mob_hp['hp'] <=59){
echo '#FF8C00';
}elseif($mob_hp['hp'] >= 40 AND $mob_hp['hp'] <=49){
echo '#FF4500';
}elseif($mob_hp['hp'] >= 30 AND $mob_hp['hp'] <=39){
echo '#D2691E';
}elseif($mob_hp['hp'] >= 20 AND $mob_hp['hp'] <=29){
echo '#FF0000';
}elseif($mob_hp['hp'] >= 10 AND $mob_hp['hp'] <=19){
echo '#B22222';
}elseif($mob_hp['hp'] >=1 AND $mob_hp['hp'] <= 9){
echo '#A52A2A';
}
echo ';"></div></div>
</td><td valign="top" width="50%">
<div style="height:14px;opacity:0.5;margin-bottom:2px;border-radius:0px 5px 0px 5px;border:2px solid black;">
<div style="font-align:right;height:14px;padding-left:0px;float:left;font-size:11px;border-radius:5px 5px 5px 5px;color:white;"><font align="right"><center>'.$mob['mp'].'/'.$mob['max_mp'].'</center></font></div>
<div style="height:14px;width:'.$mob_mp['mp'].'%;background:#7B68EE;border-radius:0px 5px 0px 5px;"></div></div>
</td>
</tr>
</table>';
echo '</div>';
}
echo '<div class="tools">Враги: ';
$vrag=mysql_query("SELECT * FROM `mobs` WHERE
`battle`='".$account['battle']."'");
$cnt=1;
while($resvrag=mysql_fetch_array($vrag)){
if ($cnt>1){
echo ', ';
}
if($account['battle_target_type']=='mob' && $account['battle_attack']==$resvrag['id']){
echo '<font color="gray">'.$resvrag['name'].'</font>';
}else{
echo '<a href="?target_type=mob&target='.$resvrag['id'].'">'.$resvrag['name'].'</a>';
}
echo ' ('.(ceil($resvrag['hp']/($resvrag['max_hp']/100))).'%)';
$cnt++;
}
echo '</div>';
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `account` WHERE `battle`='".$account['battle']."' AND `id`!='".$account['id']."'"),0)){
echo '<div class="tools">Союзники: ';
$soyz=mysql_query("SELECT * FROM `account` WHERE
`battle`='".$account['battle']."'");
$cntu=1;
while($ressoyz=mysql_fetch_array($soyz)){
if ($ressoyz['id']!=$account['id']){
if ($cntu>1){
echo ', ';
}
if($account['battle_target_type']=='user' && $account['battle_attack']==$ressoyz['id']){
echo '<font color="gray">'.$ressoyz['name'].'</font>';
}else{
echo '<a href="?target_type=user&target='.$ressoyz['id'].'">'.$ressoyz['name'].'</a>';
}
echo ' ('.$ressoyz['hp'].' HP)';
$cntu++;
}
}
echo '</div>';
}
echo '<div class="help">';
if ($account['battle_target_type']=='mob'){
echo '<a href="?attack" title="Ударить"><img src="/data/img/skill/attack.jpg" width="24px" height="24px"></a>';
}
$q=mysql_query("SELECT * FROM `skill` WHERE
`account`='".$account['id']."'");
while($result=mysql_fetch_array($q)){
if (time()-$result['last_cast']<$result['res_time']){
echo '<img src="/data/img/skill/'.$result['icon'].'.jpg" style="opacity:0.5;" title="'.$result['name'].' ('.floor($result['res_time']-(time()-$result['last_cast'])).')"></a>';
}else{
echo '<a href="?skill='.$result['id'].'" title="'.$result['name'].'"><img src="/data/img/skill/'.$result['icon'].'.jpg"></a>';
}
}
echo '</div>';
mysql_query("OPTIMIZATE TABLE `battle_log`");
$ql=mysql_query("SELECT * FROM `battle_log` WHERE `account`='".$account['id']."' ORDER BY `id` DESC LIMIT 5");
while($resultl=mysql_fetch_assoc($ql)){
echo $resultl['mess'];
}
if ($cntatck){
header('Location:?');
exit;
}
down();
}elseif($account['duel_battle']){
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////ДУЭЛИ!//////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////ДУЭЛИ!//////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////ДУЭЛИ!//////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////ДУЭЛИ!//////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////ДУЭЛИ!//////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////ДУЭЛИ!//////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////ДУЭЛИ!//////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////ДУЭЛИ!//////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////ДУЭЛИ!//////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////ДУЭЛИ!//////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
$mob=mysql_fetch_assoc(mysql_query("SELECT * FROM `account` WHERE
`id`='".$account['battle_attack']."'"));
//$mob['expee'] = round($mobe['exp']/2);
//$mob['drop_goldee'] = round(100/2);
//$mob['exp'] = rand(50,100);
//$mob['drop_gold'] = rand($mob['drop_goldee'],100);
$mob['exp']=round(100/$account['lvl'])*$mob['lvl'];
if ($mob['clan']){
$cln=mysql_fetch_assoc(mysql_query("SELECT * FROM `clan` WHERE `id`='".$mob['clan']."'"));
$mob['power']=$mob['power']+$cln['power'];
$mob['wit']=$mob['wit']+$cln['wit'];
$mob['spirit']=$mob['spirit']+$cln['spirit'];
$mob['dexterity']=$mob['dexterity']+$cln['dexterity'];
$mob['vitality']=$mob['vitality']+$cln['vitality'];
}
/*************Обнуляем характеристики************/
//Сложение
$mob['adding'] = 0;
//Воля
$mob['will'] = 0;
//Реакция
$mob['reaction'] = 0;
if ($account['battle_target_type']=='user'){
$mob['max_hp']=0;
$mob['max_mp']=0;
//Восстановление жизни
$mob['hp_regen']=0;
//Восстановление маны
$mob['mp_regen']=0;
//Минимальный урон(оружие)
$mob['min_damag']=0;
//Максимальный урон(оружие)
$mob['max_damag']=0;
}
//Защита от ударов
$mob['feature_armor_weapon']=0;
//Защита от стрел
$mob['feature_armor_arrow']=0;
//Защита от магии
$mob['feature_armor_magic']=0;
//Урон от ударов
$mob['feature_attack_weapon']=0;
//Урон от стрел
$mob['feature_attack_arrow']=0;
//Урон от магии
$mob['feature_attack_magic']=0;
////Bonus by shmot
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `effect` WHERE `baph`='1' AND `account`='".$mob['id']."' OR (`target_type`='user' AND `target`='".$mob['id']."')"),0)){
$qb=mysql_query("SELECT * FROM `effect` WHERE `baph`='1' AND `account`='".$mob['id']."' OR (`target_type`='user' AND `target`='".$mob['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;
}
//Сложение
$mob['adding']+=$resultb['baph_adding'];
//Воля
$mob['will']+=$resultb['baph_will'];
//Реакция
$mob['reaction']+=$resultb['baph_reaction'];
//Очки здоровья
$mob['max_hp']+=$resultb['baph_max_hp'];
//Очки маны
$mob['max_mp']+=$resultb['baph_max_mp'];
//Защита от ударов
$mob['feature_armor_weapon']+=$resultb['baph_feature_armor_weapon'];
//Защита от стрел
$mob['feature_armor_arrow']+=$resultb['baph_feature_armor_arrow'];
//Защита от магии
$mob['feature_armor_magic']+=$resultb['baph_feature_armor_magic'];
//Урон от ударов
$mob['feature_attack_weapon']+=$resultb['baph_feature_attack_weapon'];
//Урон от стрел
$mob['feature_attack_arrow']+=$resultb['baph_feature_attack_arrow'];
//Урон от магии
$mob['feature_attack_magic']+=$resultb['baph_feature_attack_magic'];
//Восстановление жизни
$mob['hp_regen']+=$resultb['baph_hp_regen'];
//Восстановление маны
$mob['mp_regen']+=$resultb['baph_mp_regen'];
//Power
$mob['power']+=$resultb['baph_power'];
//Wit
$mob['wit']+=$resultb['baph_wit'];
//Dexterity
$mob['dexterity']+=$resultb['baph_dexterity'];
//Vitality
$mob['vitality']+=$resultb['baph_vitality'];
//Spirit
$mob['spirit']+=$resultb['baph_spirit'];
}
}
/**********************************************************************************************************************
*******************************************Бонусы характеристик от вещей************************************************
*************************************************************************************************************************/
if(!empty($mob['armor_head'])){ //Шлем
$head=mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id`='".$mob['armor_head']."'"));
if ($head['feature_pover']!=NULL){
$mob['power']=$mob['power']+$head['feature_power'];
}
if ($head['feature_vitality']!=NULL){
$mob['vitality']=$mob['vitality']+$head['feature_vitality'];
}
if ($head['feature_dexterity']!=NULL){
$mob['dexterity']=$mob['dexterity']+$head['feature_dexterity'];
}
if ($head['feature_wit']!=NULL){
$mob['wit']=$mob['wit']+$head['feature_wit'];
}
if ($head['feature_spirit']!=NULL){
$mob['spirit']=$mob['spirit']+$head['feature_spirit'];
}
if ($head['feature_armor_arrow']!=NULL){
$mob['feature_armor_arrow']=$mob['feature_armor_arrow']+$head['feature_armor_arrow']*1.25;
}
if ($head['feature_armor_weapon']!=NULL){
$mob['feature_armor_weapon']=$mob['feature_armor_weapon']+$head['feature_armor_weapon']*1.25;
}
if ($head['feature_armor_magic']!=NULL){
$mob['feature_armor_magic']=$mob['feature_armor_magic']+$head['feature_armor_magic']*1.25;
}
if ($head['feature_attack_arrow']!=NULL){
$mob['feature_attack_arrow']=$mob['feature_attack_arrow']+$head['feature_attack_arrow']*1.50;
}
if ($head['feature_attack_weapon']!=NULL){
$mob['feature_attack_weapon']=$mob['feature_attack_weapon']+$head['feature_attack_weapon']*1.50;
}
if ($head['feature_attack_magic']!=NULL){
$mob['feature_attack_magic']=$mob['feature_attack_magic']+$head['feature_attack_magic']*1.50;
}
if ($head['feature_hp_regen']!=NULL){
$mob['hp_regen']=$mob['hp_regen']+$head['feature_hp_regen'];
}
if ($head['feature_mp_regen']!=NULL){
$mob['mp_regen']=$mob['mp_regen']+$head['feature_mp_regen'];
}
}
if(!empty($mob['armor_body'])){ //Нагрудник
$body=mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id`='".$mob['armor_body']."'"));
if ($body['feature_pover']!=NULL){
$mob['power']=$mob['power']+$body['feature_power'];
}
if ($body['feature_vitality']!=NULL){
$mob['vitality']=$mob['vitality']+$body['feature_vitality'];
}
if ($body['feature_dexterity']!=NULL){
$mob['dexterity']=$mob['dexterity']+$body['feature_dexterity'];
}
if ($body['feature_wit']!=NULL){
$mob['wit']=$mob['wit']+$body['feature_wit'];
}
if ($body['feature_spirit']!=NULL){
$mob['spirit']=$mob['spirit']+$body['feature_spirit'];
}
if ($body['feature_armor_arrow']!=NULL){
$mob['feature_armor_arrow']=$mob['feature_armor_arrow']+$body['feature_armor_arrow']*1.25;
}
if ($body['feature_armor_weapon']!=NULL){
$mob['feature_armor_weapon']=$mob['feature_armor_weapon']+$body['feature_armor_weapon']*1.25;
}
if ($body['feature_armor_magic']!=NULL){
$mob['feature_armor_magic']=$mob['feature_armor_magic']+$body['feature_armor_magic']*1.25;
}
if ($body['feature_attack_arrow']!=NULL){
$mob['feature_attack_arrow']=$mob['feature_attack_arrow']+$body['feature_attack_arrow']*1.50;
}
if ($body['feature_attack_weapon']!=NULL){
$mob['feature_attack_weapon']=$mob['feature_attack_weapon']+$body['feature_attack_weapon']*1.50;
}
if ($body['feature_attack_magic']!=NULL){
$mob['feature_attack_magic']=$mob['feature_attack_magic']+$body['feature_attack_magic']*1.50;
}
if ($body['feature_hp_regen']!=NULL){
$mob['hp_regen']=$mob['hp_regen']+$body['feature_hp_regen'];
}
if ($body['feature_mp_regen']!=NULL){
$mob['mp_regen']=$mob['mp_regen']+$body['feature_mp_regen'];
}
}
if(!empty($mob['armor_pants'])){ //Набедреник
$pants=mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id`='".$mob['armor_pants']."'"));
if ($pants['feature_pover']!=NULL){
$mob['power']=$mob['power']+$pants['feature_power'];
}
if ($pants['feature_vitality']!=NULL){
$mob['vitality']=$mob['vitality']+$pants['feature_vitality'];
}
if ($pants['feature_dexterity']!=NULL){
$mob['dexterity']=$mob['dexterity']+$pants['feature_dexterity'];
}
if ($pants['feature_wit']!=NULL){
$mob['wit']=$mob['wit']+$pants['feature_wit'];
}
if ($pants['feature_spirit']!=NULL){
$mob['spirit']=$mob['spirit']+$pants['feature_spirit'];
}
if ($pants['feature_armor_arrow']!=NULL){
$mob['feature_armor_arrow']=$mob['feature_armor_arrow']+$pants['feature_armor_arrow']*1.25;
}
if ($pants['feature_armor_weapon']!=NULL){
$mob['feature_armor_weapon']=$mob['feature_armor_weapon']+$pants['feature_armor_weapon']*1.25;
}
if ($pants['feature_armor_magic']!=NULL){
$mob['feature_armor_magic']=$mob['feature_armor_magic']+$pants['feature_armor_magic']*1.25;
}
if ($pants['feature_attack_arrow']!=NULL){
$mob['feature_attack_arrow']=$mob['feature_attack_arrow']+$pants['feature_attack_arrow']*1.50;
}
if ($pants['feature_attack_weapon']!=NULL){
$mob['feature_attack_weapon']=$mob['feature_attack_weapon']+$pants['feature_attack_weapon']*1.50;
}
if ($pants['feature_attack_magic']!=NULL){
$mob['feature_attack_magic']=$mob['feature_attack_magic']+$pants['feature_attack_magic']*1.50;
}
if ($pants['feature_hp_regen']!=NULL){
$mob['hp_regen']=$mob['hp_regen']+$pants['feature_hp_regen'];
}
if ($pants['feature_mp_regen']!=NULL){
$mob['mp_regen']=$mob['mp_regen']+$pants['feature_mp_regen'];
}
}
if(!empty($mob['armor_gloves'])){ //Набедреник
$gloves=mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id`='".$mob['armor_gloves']."'"));
if ($gloves['feature_pover']!=NULL){
$mob['power']=$mob['power']+$gloves['feature_power'];
}
if ($gloves['feature_vitality']!=NULL){
$mob['vitality']=$mob['vitality']+$gloves['feature_vitality'];
}
if ($gloves['feature_dexterity']!=NULL){
$mob['dexterity']=$mob['dexterity']+$gloves['feature_dexterity'];
}
if ($gloves['feature_wit']!=NULL){
$mob['wit']=$mob['wit']+$gloves['feature_wit'];
}
if ($gloves['feature_spirit']!=NULL){
$mob['spirit']=$mob['spirit']+$gloves['feature_spirit'];
}
if ($gloves['feature_armor_arrow']!=NULL){
$mob['feature_armor_arrow']=$mob['feature_armor_arrow']+$gloves['feature_armor_arrow']*1.25;
}
if ($gloves['feature_armor_weapon']!=NULL){
$mob['feature_armor_weapon']=$mob['feature_armor_weapon']+$gloves['feature_armor_weapon']*1.25;
}
if ($gloves['feature_armor_magic']!=NULL){
$mob['feature_armor_magic']=$mob['feature_armor_magic']+$gloves['feature_armor_magic']*1.25;
}
if ($gloves['feature_attack_arrow']!=NULL){
$mob['feature_attack_arrow']=$mob['feature_attack_arrow']+$gloves['feature_attack_arrow']*1.50;
}
if ($gloves['feature_attack_weapon']!=NULL){
$mob['feature_attack_weapon']=$mob['feature_attack_weapon']+$gloves['feature_attack_weapon']*1.50;
}
if ($gloves['feature_attack_magic']!=NULL){
$mob['feature_attack_magic']=$mob['feature_attack_magic']+$gloves['feature_attack_magic']*1.50;
}
if ($gloves['feature_hp_regen']!=NULL){
$mob['hp_regen']=$mob['hp_regen']+$gloves['feature_hp_regen'];
}
if ($gloves['feature_mp_regen']!=NULL){
$mob['mp_regen']=$mob['mp_regen']+$gloves['feature_mp_regen'];
}
}
if(!empty($mob['armor_belt'])){ //Пояс
$belt=mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id`='".$mob['armor_belt']."'"));
if ($belt['feature_pover']!=NULL){
$mob['power']=$mob['power']+$belt['feature_power'];
}
if ($belt['feature_vitality']!=NULL){
$mob['vitality']=$mob['vitality']+$belt['feature_vitality'];
}
if ($belt['feature_dexterity']!=NULL){
$mob['dexterity']=$mob['dexterity']+$belt['feature_dexterity'];
}
if ($belt['feature_wit']!=NULL){
$mob['wit']=$mob['wit']+$belt['feature_wit'];
}
if ($belt['feature_spirit']!=NULL){
$mob['spirit']=$mob['spirit']+$belt['feature_spirit'];
}
if ($belt['feature_armor_arrow']!=NULL){
$mob['feature_armor_arrow']=$mob['feature_armor_arrow']+$belt['feature_armor_arrow']*1.25;
}
if ($belt['feature_armor_weapon']!=NULL){
$mob['feature_armor_weapon']=$mob['feature_armor_weapon']+$belt['feature_armor_weapon']*1.25;
}
if ($belt['feature_armor_magic']!=NULL){
$mob['feature_armor_magic']=$mob['feature_armor_magic']+$belt['feature_armor_magic']*1.25;
}
if ($belt['feature_attack_arrow']!=NULL){
$mob['feature_attack_arrow']=$mob['feature_attack_arrow']+$belt['feature_attack_arrow']*1.50;
}
if ($belt['feature_attack_weapon']!=NULL){
$mob['feature_attack_weapon']=$mob['feature_attack_weapon']+$belt['feature_attack_weapon']*1.50;
}
if ($belt['feature_attack_magic']!=NULL){
$mob['feature_attack_magic']=$mob['feature_attack_magic']+$belt['feature_attack_magic']*1.50;
}
if ($belt['feature_hp_regen']!=NULL){
$mob['hp_regen']=$mob['hp_regen']+$belt['feature_hp_regen'];
}
if ($belt['feature_mp_regen']!=NULL){
$mob['mp_regen']=$mob['mp_regen']+$belt['feature_mp_regen'];
}
}
if(!empty($mob['armor_ring'])){ //Кольцо
$ring=mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id`='".$mob['armor_ring']."'"));
if ($ring['feature_pover']!=NULL){
$mob['power']=$mob['power']+$ring['feature_power'];
}
if ($ring['feature_vitality']!=NULL){
$mob['vitality']=$mob['vitality']+$ring['feature_vitality'];
}
if ($ring['feature_dexterity']!=NULL){
$mob['dexterity']=$mob['dexterity']+$ring['feature_dexterity'];
}
if ($ring['feature_wit']!=NULL){
$mob['wit']=$mob['wit']+$ring['feature_wit'];
}
if ($ring['feature_spirit']!=NULL){
$mob['spirit']=$mob['spirit']+$ring['feature_spirit'];
}
if ($ring['feature_armor_arrow']!=NULL){
$mob['feature_armor_arrow']=$mob['feature_armor_arrow']+$ring['feature_armor_arrow']*1.25;
}
if ($ring['feature_armor_weapon']!=NULL){
$mob['feature_armor_weapon']=$mob['feature_armor_weapon']+$ring['feature_armor_weapon']*1.25;
}
if ($ring['feature_armor_magic']!=NULL){
$mob['feature_armor_magic']=$mob['feature_armor_magic']+$ring['feature_armor_magic']*1.25;
}
if ($ring['feature_attack_arrow']!=NULL){
$mob['feature_attack_arrow']=$mob['feature_attack_arrow']+$ring['feature_attack_arrow']*1.50;
}
if ($ring['feature_attack_weapon']!=NULL){
$mob['feature_attack_weapon']=$mob['feature_attack_weapon']+$ring['feature_attack_weapon']*1.50;
}
if ($ring['feature_attack_magic']!=NULL){
$mob['feature_attack_magic']=$mob['feature_attack_magic']+$ring['feature_attack_magic']*1.50;
}
if ($ring['feature_hp_regen']!=NULL){
$mob['hp_regen']=$mob['hp_regen']+$ring['feature_hp_regen'];
}
if ($ring['feature_mp_regen']!=NULL){
$mob['mp_regen']=$mob['mp_regen']+$ring['feature_mp_regen'];
}
}
if(!empty($mob['armor_neckleace'])){ //Ожерелье
$neckleace=mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id`='".$mob['armor_neckleace']."'"));
if ($neckleace['feature_pover']!=NULL){
$mob['power']=$mob['power']+$neckleace['feature_power'];
}
if ($neckleace['feature_vitality']!=NULL){
$mob['vitality']=$mob['vitality']+$neckleace['feature_vitality'];
}
if ($neckleace['feature_dexterity']!=NULL){
$mob['dexterity']=$mob['dexterity']+$neckleace['feature_dexterity'];
}
if ($neckleace['feature_wit']!=NULL){
$mob['wit']=$mob['wit']+$neckleace['feature_wit'];
}
if ($neckleace['feature_spirit']!=NULL){
$mob['spirit']=$mob['spirit']+$neckleace['feature_spirit'];
}
if ($neckleace['feature_armor_arrow']!=NULL){
$mob['feature_armor_arrow']=$mob['feature_armor_arrow']+$neckleace['feature_armor_arrow']*1.25;
}
if ($neckleace['feature_armor_weapon']!=NULL){
$mob['feature_armor_weapon']=$mob['feature_armor_weapon']+$neckleace['feature_armor_weapon']*1.25;
}
if ($neckleace['feature_armor_magic']!=NULL){
$mob['feature_armor_magic']=$mob['feature_armor_magic']+$neckleace['feature_armor_magic']*1.25;
}
if ($neckleace['feature_attack_arrow']!=NULL){
$mob['feature_attack_arrow']=$mob['feature_attack_arrow']+$neckleace['feature_attack_arrow']*1.50;
}
if ($neckleace['feature_attack_weapon']!=NULL){
$mob['feature_attack_weapon']=$mob['feature_attack_weapon']+$neckleace['feature_attack_weapon']*1.50;
}
if ($neckleace['feature_attack_magic']!=NULL){
$mob['feature_attack_magic']=$mob['feature_attack_magic']+$neckleace['feature_attack_magic']*1.50;
}
if ($neckleace['feature_hp_regen']!=NULL){
$mob['hp_regen']=$mob['hp_regen']+$neckleace['feature_hp_regen'];
}
if ($neckleace['feature_mp_regen']!=NULL){
$mob['mp_regen']=$mob['mp_regen']+$neckleace['feature_mp_regen'];
}
}
if(!empty($mob['armor_earring'])){ //Серьги
$earring=mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id`='".$mob['armor_earring']."'"));
if ($earring['feature_pover']!=NULL){
$mob['power']=$mob['power']+$earring['feature_power'];
}
if ($earring['feature_vitality']!=NULL){
$mob['vitality']=$mob['vitality']+$earring['feature_vitality'];
}
if ($earring['feature_dexterity']!=NULL){
$mob['dexterity']=$mob['dexterity']+$earring['feature_dexterity'];
}
if ($earring['feature_wit']!=NULL){
$mob['wit']=$mob['wit']+$earring['feature_wit'];
}
if ($earring['feature_spirit']!=NULL){
$mob['spirit']=$mob['spirit']+$earring['feature_spirit'];
}
if ($earring['feature_armor_arrow']!=NULL){
$mob['feature_armor_arrow']=$mob['feature_armor_arrow']+$earring['feature_armor_arrow']*1.25;
}
if ($earring['feature_armor_weapon']!=NULL){
$mob['feature_armor_weapon']=$mob['feature_armor_weapon']+$earring['feature_armor_weapon']*1.25;
}
if ($earring['feature_armor_magic']!=NULL){
$mob['feature_armor_magic']=$mob['feature_armor_magic']+$earring['feature_armor_magic']*1.25;
}
if ($earring['feature_attack_arrow']!=NULL){
$mob['feature_attack_arrow']=$mob['feature_attack_arrow']+$earring['feature_attack_arrow']*1.50;
}
if ($earring['feature_attack_weapon']!=NULL){
$mob['feature_attack_weapon']=$mob['feature_attack_weapon']+$earring['feature_attack_weapon']*1.50;
}
if ($earring['feature_attack_magic']!=NULL){
$mob['feature_attack_magic']=$mob['feature_attack_magic']+$earring['feature_attack_magic']*1.50;
}
if ($earring['feature_hp_regen']!=NULL){
$mob['hp_regen']=$mob['hp_regen']+$earring['feature_hp_regen'];
}
if ($earring['feature_mp_regen']!=NULL){
$mob['mp_regen']=$mob['mp_regen']+$earring['feature_mp_regen'];
}
}
if(!empty($mob['armor_shoulder'])){ //Ожерелье
$shoulder=mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id`='".$mob['armor_shoulder']."'"));
if ($shoulder['feature_pover']!=NULL){
$mob['power']=$mob['power']+$shoulder['feature_power'];
}
if ($shoulder['feature_vitality']!=NULL){
$mob['vitality']=$mob['vitality']+$shoulder['feature_vitality'];
}
if ($shoulder['feature_dexterity']!=NULL){
$mob['dexterity']=$mob['dexterity']+$shoulder['feature_dexterity'];
}
if ($shoulder['feature_wit']!=NULL){
$mob['wit']=$mob['wit']+$shoulder['feature_wit'];
}
if ($shoulder['feature_spirit']!=NULL){
$mob['spirit']=$mob['spirit']+$shoulder['feature_spirit'];
}
if ($shoulder['feature_armor_arrow']!=NULL){
$mob['feature_armor_arrow']=$mob['feature_armor_arrow']+$shoulder['feature_armor_arrow']*1.25;
}
if ($shoulder['feature_armor_weapon']!=NULL){
$mob['feature_armor_weapon']=$mob['feature_armor_weapon']+$shoulder['feature_armor_weapon']*1.25;
}
if ($shoulder['feature_armor_magic']!=NULL){
$mob['feature_armor_magic']=$mob['feature_armor_magic']+$shoulder['feature_armor_magic']*1.25;
}
if ($shoulder['feature_attack_arrow']!=NULL){
$mob['feature_attack_arrow']=$mob['feature_attack_arrow']+$shoulder['feature_attack_arrow']*1.50;
}
if ($shoulder['feature_attack_weapon']!=NULL){
$mob['feature_attack_weapon']=$mob['feature_attack_weapon']+$shoulder['feature_attack_weapon']*1.50;
}
if ($shoulder['feature_attack_magic']!=NULL){
$mob['feature_attack_magic']=$mob['feature_attack_magic']+$shoulder['feature_attack_magic']*1.50;
}
if ($shoulder['feature_hp_regen']!=NULL){
$mob['hp_regen']=$mob['hp_regen']+$shoulder['feature_hp_regen'];
}
if ($shoulder['feature_mp_regen']!=NULL){
$mob['mp_regen']=$mob['mp_regen']+$shoulder['feature_mp_regen'];
}
}
if(!empty($mob['weapon_right'])){ //Левая рука(оружие)
$weaponright=mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id`='".$mob['weapon_right']."'"));
if ($weaponright['feature_pover']!=NULL){
$mob['power']=$mob['power']+$weaponright['feature_power'];
}
if ($weaponright['feature_vitality']!=NULL){
$mob['vitality']=$mob['vitality']+$weaponright['feature_vitality'];
}
if ($weaponright['feature_dexterity']!=NULL){
$mob['dexterity']=$mob['dexterity']+$weaponright['feature_dexterity'];
}
if ($weaponright['feature_wit']!=NULL){
$mob['wit']=$mob['wit']+$weaponright['feature_wit'];
}
if ($weaponright['feature_spirit']!=NULL){
$mob['spirit']=$mob['spirit']+$weaponright['feature_spirit'];
}
if ($weaponright['feature_armor_arrow']!=NULL){
$mob['feature_armor_arrow']=$mob['feature_armor_arrow']+$weaponright['feature_armor_arrow']*1.25;
}
if ($weaponright['feature_armor_weapon']!=NULL){
$mob['feature_armor_weapon']=$mob['feature_armor_weapon']+$weaponright['feature_armor_weapon']*1.25;
}
if ($weaponright['feature_armor_magic']!=NULL){
$mob['feature_armor_magic']=$mob['feature_armor_magic']+$weaponright['feature_armor_magic']*1.25;
}
if ($weaponright['feature_attack_arrow']!=NULL){
$mob['feature_attack_arrow']=$mob['feature_attack_arrow']+$weaponright['feature_attack_arrow']*1.50;
}
if ($weaponright['feature_attack_weapon']!=NULL){
$mob['feature_attack_weapon']=$mob['feature_attack_weapon']+$weaponright['feature_attack_weapon']*1.50;
}
if ($weaponright['feature_attack_magic']!=NULL){
$mob['feature_attack_magic']=$mob['feature_attack_magic']+$weaponright['feature_attack_magic']*1.50;
}
if ($weaponright['feature_hp_regen']!=NULL){
$mob['hp_regen']=$mob['hp_regen']+$weaponright['feature_hp_regen'];
}
if ($weaponright['feature_mp_regen']!=NULL){
$mob['mp_regen']=$mob['mp_regen']+$weaponright['feature_mp_regen'];
}
if ($weaponright['attack_min_damag']!=NULL && $weaponright['attack_max_damag']!=NULL){
$mob['min_damag']=$mob['min_damag']+$weaponright['attack_min_damag'];
$mob['max_damag']=$mob['max_damag']+$weaponright['attack_max_damag'];
}
}
if(!empty($mob['weaponshield_left'])){ //Левая рука(оружие или щит)
$weaponshieldleft=mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id`='".$mob['weaponshield_left']."'"));
if ($weaponshieldleft['feature_pover']!=NULL){
$mob['power']=$mob['power']+$weaponshieldleft['feature_power'];
}
if ($weaponshieldleft['feature_vitality']!=NULL){
$mob['vitality']=$mob['vitality']+$weaponshieldleft['feature_vitality'];
}
if ($weaponshieldleft['feature_dexterity']!=NULL){
$mob['dexterity']=$mob['dexterity']+$weaponshieldleft['feature_dexterity'];
}
if ($weaponshieldleft['feature_wit']!=NULL){
$mob['wit']=$mob['wit']+$weaponshieldleft['feature_wit'];
}
if ($weaponshieldleft['feature_spirit']!=NULL){
$mob['spirit']=$mob['spirit']+$weaponshieldleft['feature_spirit'];
}
if ($weaponshieldleft['feature_armor_arrow']!=NULL){
$mob['feature_armor_arrow']=$mob['feature_armor_arrow']+$weaponshieldleft['feature_armor_arrow']*1.25;
}
if ($weaponshieldleft['feature_armor_weapon']!=NULL){
$mob['feature_armor_weapon']=$mob['feature_armor_weapon']+$weaponshieldleft['feature_armor_weapon']*1.25;
}
if ($weaponshieldleft['feature_armor_magic']!=NULL){
$mob['feature_armor_magic']=$mob['feature_armor_magic']+$weaponshieldleft['feature_armor_magic']*1.25;
}
if ($weaponshieldleft['feature_attack_arrow']!=NULL){
$mob['feature_attack_arrow']=$mob['feature_attack_arrow']+$weaponshieldleft['feature_attack_arrow']*1.50;
}
if ($weaponshieldleft['feature_attack_weapon']!=NULL){
$mob['feature_attack_weapon']=$mob['feature_attack_weapon']+$weaponshieldleft['feature_attack_weapon']*1.50;
}
if ($weaponshieldleft['feature_attack_magic']!=NULL){
$mob['feature_attack_magic']=$mob['feature_attack_magic']+$weaponshieldleft['feature_attack_magic']*1.50;
}
if ($weaponshieldleft['feature_hp_regen']!=NULL){
$mob['hp_regen']=$mob['hp_regen']+$weaponshieldleft['feature_hp_regen'];
}
if ($weaponshieldleft['feature_mp_regen']!=NULL){
$mob['mp_regen']=$mob['mp_regen']+$weaponshieldleft['feature_mp_regen'];
}
if ($weaponshieldleft['attack_min_damag']!=NULL && $weaponshieldleft['attack_max_damag']!=NULL){
$mob['min_damag']=$mob['min_damag']+$weaponshieldleft['attack_min_damag'];
$mob['max_damag']=$mob['max_damag']+$weaponshieldleft['attack_max_damag'];
}
}
///Bonus by shmot
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `effect` WHERE
`debaph`='1'
AND `target_type`='user'
AND `target`='".$mob['id']."'"),0) && $account['battle_target_type']=='user'){
$qdb=mysql_query("SELECT * FROM `effect` WHERE
`debaph`='1'
AND `target_type`='user'
AND `target`='".$mob['id']."'");
while($resultdb=mysql_fetch_assoc($qdb)){
if (time()-$resultdb['time']>=$resultdb['effect_time']){
mysql_query("DELETE FROM `effect` WHERE `id`='".$resultdb['id']."'");
header("Location: ?");
exit;
}
//Сложение
$mob['adding']-=$resultdb['baph_adding'];
//Воля
$mob['will']-=$resultdb['baph_will'];
//Реакция
$mob['reaction']-=$resultdb['baph_reaction'];
//Очки здоровья
$mob['max_hp']-=$resultdb['baph_max_hp'];
//Очки маны
$mob['max_mp']-=$resultdb['baph_max_mp'];
//Защита от ударов
$mob['feature_armor_weapon']-=$resultdb['baph_feature_armor_weapon'];
//Защита от стрел
$mob['feature_armor_arrow']-=$resultdb['baph_feature_armor_arrow'];
//Защита от магии
$mob['feature_armor_magic']-=$resultdb['baph_feature_armor_magic'];
//Урон от ударов
$mob['feature_attack_weapon']-=$resultdb['baph_feature_attack_weapon'];
//Урон от стрел
$mob['feature_attack_arrow']-=$resultdb['baph_feature_attack_arrow'];
//Урон от магии
$mob['feature_attack_magic']-=$resultdb['baph_feature_attack_magic'];
//Восстановление жизни
$mob['hp_regen']-=$resultdb['baph_hp_regen'];
//Восстановление маны
$mob['mp_regen']-=$resultdb['baph_mp_regen'];
//Power
$mob['power']-=$resultdb['baph_power'];
//Wit
$mob['wit']-=$resultdb['baph_wit'];
//Dexterity
$mob['dexterity']-=$resultdb['baph_dexterity'];
//Vitality
$mob['vitality']-=$resultdb['baph_vitality'];
//Spirit
$mob['spirit']-=$resultdb['baph_spirit'];
foreach($mob as $key=>$value){
if (is_numeric($value)){
if ($value<0){
$mob[$key]=0;
}
}
}
}
}
/*************************************************************************************
************************Характеристики*************************************************
****************************************************************************************/
//Сложение
$addingmin=0.02*$mob['power'];
$mob['adding'] += ceil($mob['power']-$addingmin);
//Воля
$willmin=0.02*$mob['wit'];
$mob['will'] += ceil($mob['wit']-$willmin);
//Реакция
$reactionmin=0.02*$mob['dexterity'];
$mob['reaction'] += ceil($mob['dexterity']-$reactionmin);
if ($account['battle_target_type']=='user'){
//Очки здоровья
$mob['max_hp']+=100+(($mob['vitality'] - 5)*11);
//Очки маны
$mob['max_mp']+=100+(($mob['wit'] - 5)*7);
}
//Защита от ударов
$armorweaponmin=floor($mob['power']/2)*0.01;
$mob['feature_armor_weapon']+=($mob['power']*0.55)-$armorweaponmin;
//Защита от стрел
$armorarrowmin=floor($mob['dexterity']/2)*0.01;
$mob['feature_armor_arrow']+=($mob['dexterity']*0.55)-$armorarrowmin;
//Защита от магии
$armormagicmin=floor($mob['wit']/2)*0.01;
$mob['feature_armor_magic']+=($mob['wit']*0.55)-$armormagicmin;
//Урон от ударов
$mob['feature_attack_weapon']+=floor($mob['power']/2)*1;
//Урон от стрел
$mob['feature_attack_arrow']+=floor($mob['dexterity']/2)*1;
//Урон от магии
$mob['feature_attack_magic']+=floor($mob['wit']/2)*1;
//атака моба
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `effect` WHERE
`stun`='1'
OR `paralich`='1'
OR `fear`='1'
OR `sleep`='1'
AND `target_type`='user'
AND `target`='".$account['id']."'"),0)){
$querystun=mysql_query("SELECT * FROM `effect` WHERE
`stun`='1'
OR `paralich`='1'
OR `fear`='1'
OR `sleep`='1'
AND (`target_type`='user' AND `target`='".$account['id']."')");
while($resultstun=mysql_fetch_assoc($querystun)){
if ($resultstun['stun']){
if (time()-$resultstun['time']>=$resultstun['effect_time']){
mysql_query("DELETE FROM `effect`
WHERE `id`='".$resultstun['id']."'");
}else{
mysql_query("UPDATE `account` SET
`battle_last_attack`='".time()."'
WHERE
`id`='".$account['id']."'");
}
}elseif($resultstun['paralich']){
if (time()-$resultstun['time']>=$resultstun['effect_time']){
mysql_query("DELETE FROM `effect` WHERE
`id`='".$resultstun['id']."'");
}else{
mysql_query("UPDATE `account` SET
`battle_last_attack`='".time()."'
WHERE
`id`='".$account['id']."'");
}
}elseif($resultstun['sleep']){
if (time()-$resultstun['time']>=$resultstun['effect_time']){
mysql_query("DELETE FROM `effect` WHERE
`id`='".$resultstun['id']."'");
}else{
mysql_query("UPDATE `account` SET
`battle_last_attack`='".time()."'
WHERE
`id`='".$account['id']."'");
}
}elseif($resultstun['fear']){
if (time()-$resultstun['time']>=$resultstun['effect_time']){
mysql_query("DELETE FROM `effect`
WHERE
`id`='".$resultstun['id']."'");
}else{
mysql_query("UPDATE `account` SET
`battle_last_attack`='".time()."'
WHERE
`id`='".$account['id']."'");
}
}
$account['battle_last_attack']=mysql_result(mysql_query("SELECT `battle_last_attack` FROM `account`
WHERE
`id`='".$account['id']."'"),0);
}
}
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `effect` WHERE
`stun`='1'
OR `paralich`='1'
OR `fear`='1'
OR `sleep`='1'
AND `target_type`='user'
AND `target`='".$mob['id']."'"),0)){
$querystun=mysql_query("SELECT * FROM `effect` WHERE
`stun`='1'
OR `paralich`='1'
OR `fear`='1'
OR `sleep`='1'
AND (`target_type`='user' AND `target`='".$mob['id']."')");
while($resultstun=mysql_fetch_assoc($querystun)){
if ($resultstun['stun']){
if (time()-$resultstun['time']>=$resultstun['effect_time']){
mysql_query("DELETE FROM `effect`
WHERE `id`='".$resultstun['id']."'");
}else{
mysql_query("UPDATE `account` SET
`battle_last_attack`='".time()."'
WHERE
`id`='".$mob['id']."'");
}
}elseif($resultstun['paralich']){
if (time()-$resultstun['time']>=$resultstun['effect_time']){
mysql_query("DELETE FROM `effect` WHERE
`id`='".$resultstun['id']."'");
}else{
mysql_query("UPDATE `account` SET
`battle_last_attack`='".time()."'
WHERE
`id`='".$mob['id']."'");
}
}elseif($resultstun['sleep']){
if (time()-$resultstun['time']>=$resultstun['effect_time']){
mysql_query("DELETE FROM `effect` WHERE
`id`='".$resultstun['id']."'");
}else{
mysql_query("UPDATE `account` SET
`battle_last_attack`='".time()."'
WHERE
`id`='".$mob['id']."'");
}
}elseif($resultstun['fear']){
if (time()-$resultstun['time']>=$resultstun['effect_time']){
mysql_query("DELETE FROM `effect`
WHERE
`id`='".$resultstun['id']."'");
}else{
mysql_query("UPDATE `account` SET
`battle_last_attack`='".time()."'
WHERE
`id`='".$mob['id']."'");
}
}
$mob['last_battle_attack']=mysql_result(mysql_query("SELECT `battle_last_attack` FROM `account`
WHERE
`id`='".$mob['id']."'"),0);
}
}/*
$battlemobs=mysql_query("SELECT * FROM `account` WHERE `duel_battle`='".$account['duel_battle']."'");
while($resmob=mysql_fetch_assoc($battlemobs)){
if (!mysql_result(mysql_query("SELECT COUNT(*) FROM `account` WHERE `duel_battle`='".$resmob['duel_battle']."' AND `id`='".$resmob['battle_attack']."'"),0)){
$qrtargets=mysql_fetch_assoc(mysql_query("SELECT * FROM `account` WHERE `battle`='".$resmob['battle']."' ORDER BY `lvl` DESC LIMIT 1"));
mysql_query("UPDATE `mobs` SET
`last_damag`='',
`battle_attack`='".$qrtargets['id']."'
WHERE `id`='".$resmob['id']."'");
}else{
$attackcol=intval((time()-$resmob['last_damag'])/$resmob['damag_every_sec']);
//echo $attackcol;
for ($i=1;$i<=$attackcol;$i++){
$targete=mysql_fetch_assoc(mysql_query("SELECT * FROM `account` WHERE `id`='".$resmob['battle_attack']."'"));
$damagmob=rand($resmob['min_damag'],$resmob['max_damag']);
$damagmob=(floor($damagmob/100)*$resmob['feature_attack_weapon'])+$damagmob;
//$damagmob=$damagmob-(floor($damagmob/100)*$targete['feature_armor_weapon']);
$damagmob=round($damagmob);
if ($damagmob<=0){
$damagmob=1;
}
$damagmob+=rand(1,3);
$kritpower=$resmob['power']-20;
if ($kritpower<=0){
$kritpower=1;
}
$kritdexterity=$resmob['dexterity']-15;
if ($kritdexterity<=0){
$kritdexterity=2;
}
$kritwit=$resmob['wit']-10;
if ($kritwit<=0){
$kritwit=2;
}
$krit=$kritdexterity+$kritpower+$kritwit;
if ($krit>65){
$krit=65;
}
$start=100-$krit;
$start=rand(1,$start);
$end=$start+$krit;
$chanse=rand(1,100);
if ($chanse>=$start && $chanse<=$end){
$damagmob=round($damagmob*rand(1.5,1.9));
}
$hpdm=$targete['hp']-$damagmob;
if ($hpdm<=0){
$hpdm=1;
mysql_query("DELETE FROM `effect` WHERE
`target_type`='mob'
AND `target`='".$resmob['id']."' AND `account`='".$targete['id']."'");
mysql_query("UPDATE `account` SET
`battle`='',
`battle_attack`='' WHERE `id`='".$targete['id']."'");
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `account` WHERE `battle`='".$resmob['battle']."'"),0)){
$qrtargets=mysql_fetch_assoc(mysql_query("SELECT * FROM `account` WHERE `battle`='".$resmob['battle']."' ORDER BY `lvl` DESC LIMIT 1"));
mysql_query("UPDATE `mobs` SET
`last_damag`='".time()."',
`battle_attack`='".$qrtargets['id']."'
WHERE `id`='".$resmob['id']."'");
mysql_query("UPDATE `account` SET `battle_target_type`='mob',`battle_attack`='".$resmob['id']."' WHERE `battle_target_type`='user' AND `battle_attack`='".$targete['id']."'");
}else{
mysql_query("DELETE FROM `battle` WHERE
`id`='".$targete['battle']."'");
mysql_query("UPDATE `mobs` SET
`last_damag`='',
`battle`='',
`battle_attack`=''
WHERE `id`='".$resmob['id']."'");
}
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targete['id']."','<div class="help">Бой окончен, вы проиграли!</div>')");
break;
header('Location: /location.php?');
exit;
}
mysql_query("UPDATE `account` SET
`hp`='".$hpdm."'
WHERE
`id`='".$targete['id']."'");
mysql_query("INSERT INTO `battle_log`(
`account`,
`mess`)VALUES(
'".$targete['id']."',
'<div class="help"><img src="/data/img/units/mobs/".$resmob['icon'].".jpg" width="15px" height="15px">".$resmob['name']." наносит вам ".$damagmob." урона!</div>')");
//$ld=$resmob['last_damag']+$resmob['damag_every_sec'];
$ld=time();
if ($ld>time()){
$ld=time();
}
mysql_query("UPDATE `mobs` SET
`last_damag`='".$ld."'
WHERE
`id`='".$resmob['id']."'");
$account['hp']=mysql_result(mysql_query("SELECT `hp` FROM `account` WHERE
`id`='".$account['id']."'"),0);
}
}
}*/
//echo time();
//Доты
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `effect` WHERE
`target_type`='user'
AND `dota`='1' AND `target`='".$mob['id']."'"),0)){
//echo mysql_result(mysql_query("SELECT COUNT(*) FROM `effect` WHERE `target_type`='mob' AND `account`='".$account['id']."'"),0);
$qd=mysql_query("SELECT * FROM `effect` WHERE
`target_type`='user'
AND `dota`='1' AND `target`='".$mob['id']."'");
while($resultd=mysql_fetch_assoc($qd)){
$mobe=mysql_fetch_array(mysql_query("SELECT * FROM `account` WHERE
`id`='".$resultd['target']."'"));
//$mobe['expee'] = round(100/2);
//$mobe['drop_goldee'] = round(100/2);
//$mobe['exp'] = rand($mobe['expee'],100);
//$mobe['drop_gold'] = rand($mobe['drop_goldee'],100);
$mobe['exp']=round(100/$account['lvl'])*$mobe['lvl'];
if ($resultd['last_cast']-$resultd['time']>=$resultd['effect_time']){
mysql_query("DELETE FROM `effect` WHERE `id`='".$resultd['id']."'");
header("Location:?");
exit;
}
$col_hp_damaged=time()-$resultd['last_cast'];
$col_hp_damaged=floor($col_hp_damaged/$resultd['effect_every_sec'])+rand(1,3);
if ($col_hp_damaged){
for($i=1; $i<=$col_hp_damaged; $i++){
$hpd=$mobe['hp']-$resultd['effect_damage'];
if ($hpd<=0){
$targett=mysql_fetch_assoc(mysql_query("SELECT * FROM `account` WHERE `id`='".$mobe['battle_attack']."'"));
$hpd=0;
mysql_query("DELETE FROM `effect` WHERE
`target_type`='user'
AND `target`='".$mobe['id']."'");
mysql_query("UPDATE `account` SET
`hp`='".$mobe['max_hp']."',
`mp`='".$mobe['max_mp']."',
`duel_battle`=''
WHERE
`id`='".$mobe['id']."'");
//mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Вы победили</div>')");
$levl=mysql_fetch_assoc(mysql_query("SELECT * FROM `lvl` WHERE `id`='".$targett['lvl']."'"));
mysql_query("UPDATE `account` SET `exp`='".($targett['exp']+$mobe['exp'])."' WHERE `id`='".$targett['id']."'");
$targett['exp']=mysql_result(mysql_query("SELECT `exp` FROM `account` WHERE `id`='".$targett['id']."'"),0);
//echo 'Получено опыта: '.$mobe['exp'].'<br />';
if ($targett['exp']>$levl['exp']){
mysql_query("UPDATE `account` SET `lvl`='".($targett['lvl']+1)."',`exp`='0',`skill_point`=`skill_point`+'1',`character_point`=`character_point`+'2' WHERE `id`='".$targett['id']."'");
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Уровень повышен</div>')");
}
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Получено опыта: ".$mobe['exp']."</div>')");
$targett['exp']=mysql_result(mysql_query("SELECT `exp` FROM `account` WHERE `id`='".$targett['id']."'"),0);
if ($targett['clan']){
mysql_query("UPDATE `clan` SET `exp`=`exp`+".($mob['exp']/2)." WHERE `id`='".$targett['clan']."'");
}
if ($mobe['drop_gold']){
mysql_query("UPDATE `account` SET
`gold`='".($targett['gold']+$mobe['drop_gold'])."' WHERE `id`='".$targett['id']."'");
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Получено золота: ".$mobe['drop_gold']."</div>')");
}
if ($skill['damage']){
mysql_query("DELETE FROM `battle` WHERE
`id`='".$account['duel_battle']."'");
mysql_query("UPDATE `account` SET
`duel_battle`='',
`battle_attack`='' WHERE `duel_battle`='".$account['duel_battle']."'");
$qb=mysql_query("SELECT * FROM `account` WHERE `battle`='".$account['duel_battle']."'");
while($resqb=mysql_fetch_assoc($qb)){
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$resqb['id']."','<div class="help">Бой окончен</div>')");
}
header("Location: ?");
exit;
}else{
$nextmob=mysql_result(mysql_query("SELECT `id` FROM `account` WHERE `duel_battle`='".$account['duel_battle']."' AND `id`!='".$account['id']."' LIMIT 1"),0);
mysql_query("UPDATE `account` SET `battle_attack`='".$nextmob."' WHERE `id`='".$account['id']."'");
header("Location: ?");
exit;
}
}
mysql_query("UPDATE `account` SET
`hp`='".$hpd."'
WHERE `id`='".$mobe['id']."'");
mysql_query("INSERT INTO `battle_log`(
`acount`,
`mess`)VALUES(
'".$targett['id']."',
'<div class="help"><img src="/data/img/skill/".mysql_result(mysql_query("SELECT `icon` FROM `skill` WHERE `id`='".$resultd['skill']."'"),0).".jpg" width="15px" height="15px">Вы наносите ".$resultd['effect_damage']." урона</div>')");
mysql_query("INSERT INTO `battle_log`(
`acount`,
`mess`)VALUES(
'".$mobe['id']."',
'<div class="help"><img src="/data/img/skill/".mysql_result(mysql_query("SELECT `icon` FROM `skill` WHERE `id`='".$resultd['skill']."'"),0).".jpg" width="15px" height="15px">Вы получаете ".$resultd['effect_damage']." урона</div>')");
mysql_query("UPDATE `effect` SET
`last_cast`='".($resultd['last_cast']+$resultd['effect_every_sec'])."'
WHERE `id`='".$resultd['id']."'");
$resultd['last_cast']=mysql_result(mysql_query("SELECT `last_cast` FROM `effect` WHERE
`id`='".$resultd['id']."'"),0);
if ($resultd['last_cast']-$resultd['time']>=$resultd['effect_time']){
mysql_query("DELETE FROM `effect` WHERE
`id`='".$resultd['id']."'");
header("Location: ?");
exit;
}
$mobe['hp']=mysql_result(mysql_query("SELECT `hp` FROM `account`
WHERE `id`='".$mobe['id']."'"),0);
}
}
}
}
if (isset($_GET['skill'])){
echo 'skill';
$_GET['skill']=intval($_GET['skill']);
if (!mysql_result(mysql_query("SELECT COUNT(*) FROM `skill` WHERE
`id`='".$_GET['skill']."'
AND `account`='".$account['id']."'"),0)){
header("Location: ?");
exit;
}
$skill=mysql_fetch_assoc(mysql_query("SELECT * FROM `skill` WHERE
`id`='".mysql_real_escape_string($_GET['skill'])."'
AND `account`='".$account['id']."'"));
if (time()-$skill['last_cast']<$skill['res_time']){
header("Location: ?");
exit;
}
if (time()-$account['battle_last_attack']<1){
header("Location: ?");
exit;
}
if ($account['mp']<$skill['mp_need_from_cast']){
header("Location: ?");
exit;
}
/*******************************************************************
**********************DAMAG******************************************
**********************************************************************/
if ($skill['type']){
if ($skill['damage']){
$rand=rand(-3,3);
$damag=$skill['damage']+$rand;
if ($skill['type']=='phisical'){
$damag=(ceil($damag/100)*$account['feature_attack_weapon'])+$damag;
$damag=$damag - (ceil($damag/100)*$mob['feature_armor_weapon']);
}elseif($skill['type']=='magic'){
$damag=(ceil($damag/100)*$account['feature_attack_magic'])+$damag;
$damag= $damag - (ceil($damag/100)*$mob['feature_armor_magic']);
}elseif($skill['type']=='arrow'){
$damag=(ceil($damag/100)*$account['feature_attack_arrow'])+$damag;
$damag= $damag - (ceil($damag/100)*$mob['feature_armor_arrow']);
}
$damag=round($damag);
if ($damag<=0){
$damag=1;
}
$damag+=rand(1,3);
$kritpower=$account['power']-20;
if ($kritpower<=0){
$kritpower=1;
}
$kritdexterity=$account['dexterity']-15;
if ($kritdexterity<=0){
$kritdexterity=2;
}
$kritwit=$account['wit']-10;
if ($kritwit<=0){
$kritwit=2;
}
$krit=$kritdexterity+$kritpower+$kritwit;
if ($krit>65){
$krit=65;
}
$start=100-$krit;
$start=rand(1,$start);
$end=$start+$krit;
$chanse=rand(1,100);
if ($chanse>=$start && $chanse<=$end){
$damag=round($damag*rand(1.5,1.9));
}
$hp=$mob['hp']-$damag;
$damaglast=$damag;
if ($hp<0){
$hp=0;
if($skill['damage']){
mysql_query("UPDATE `account` SET
`hp`='".$hp."'
WHERE `id`='".$mob['id']."'");
mysql_query("INSERT INTO `battle_log`(
`account`,
`mess`)VALUES(
'".$account['id']."',
'<div class="help"><img src="/data/img/skill/".$skill['icon'].".jpg" width="15px" height="15px">Вы наносите ".$damag." урона</div>')");
mysql_query("INSERT INTO `battle_log`(
`account`,
`mess`)VALUES(
'".$mob['id']."',
'<div class="help"><img src="/data/img/skill/".$skill['icon'].".jpg" width="15px" height="15px">Вы получаете ".$damag." урона</div>')");
}
mysql_query("UPDATE `account` SET
`mp`='".($account['mp']-$skill['mp_need_from_cast'])."'
WHERE
`id`='".$account['id']."'");
mysql_query("UPDATE `skill` SET
`last_cast`='".time()."'
WHERE
`account`='".$account['id']."'
AND `id`='".$skill['id']."'");
mysql_query("UPDATE `account` SET
`battle_last_attack`='".time()."'
WHERE
`id`='".$account['id']."'");
//$hp=0;
$targett=mysql_fetch_assoc(mysql_query("SELECT * FROM `account` WHERE `id`='".$mob['battle_attack']."'"));
mysql_query("DELETE FROM `effect` WHERE
`target_type`='user'
AND `target`='".$mob['id']."'");
mysql_query("UPDATE `account` SET
`hp`='".$mob['max_hp']."',
`mp`='".$mob['max_mp']."',
`last_death`='".time()."',
`duel_battle`=''
WHERE
`id`='".$mob['id']."'");
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$mob['battle_attack']."','<div class="help">Вы победили</div>')");
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$mob['id']."','<div class="help">Дуэль окончена, вы проиграли</div>')");
$levl=mysql_fetch_assoc(mysql_query("SELECT * FROM `lvl` WHERE `id`='".$targett['lvl']."'"));
mysql_query("UPDATE `account` SET `exp`='".($targett['exp']+$mob['exp'])."' WHERE `id`='".$targett['id']."'");
$targett['exp']=mysql_result(mysql_query("SELECT `exp` FROM `account` WHERE `id`='".$targett['id']."'"),0);
//echo 'Получено опыта: '.$mob['exp'].'<br />';
if ($targett['clan']){
mysql_query("UPDATE `clan` SET `exp`=`exp`+".($mob['exp']/2)." WHERE `id`='".$targett['clan']."'");
}
if ($targett['exp']>$levl['exp']){
//$expe=$targett['exp']-$levl['exp'];
mysql_query("UPDATE `account` SET `lvl`='".($targett['lvl']+1)."',`exp`='0',`skill_point`=`skill_point`+'1',`character_point`=`character_point`+'2' WHERE `id`='".$targett['id']."'");
//echo 'Уровень повышен!<br />';
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Уровень повышен!</div>')");
}
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Получено опыта: ".$mob['exp']."</div>')");
$targett['exp']=mysql_result(mysql_query("SELECT `exp` FROM `account` WHERE `id`='".$targett['id']."'"),0);
if ($mob['drop_gold']){
mysql_query("UPDATE `account` SET
`gold`='".($targett['gold']+$mob['drop_gold'])."' WHERE `id`='".$targett['id']."'");
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Получено золота: ".$mob['drop_gold']."</div>')");
}
//mysql_query("UPDATE `account` SET `hp`='".$hp."' WHERE `id`='".$mob['id']."'");
mysql_query("DELETE FROM `battle` WHERE
`id`='".$account['duel_battle']."'");
mysql_query("UPDATE `account` SET
`duel_battle`='',
`battle_attack`='' WHERE `duel_battle`='".$account['duel_battle']."'");
header("Location: ?");
exit;
}
}
if($skill['heal']){
if ($account['battle_target_type']=='user'){
$damag=$skill['heal'] + 1;
$damag=(ceil($damag/100)*$account['feature_attack_magic'])+$damag;
$damag=round($damag);
if ($damag<=0){
$damag=1;
}
$damag+=rand(1,3);
$kritpower=$account['power']-20;
if ($kritpower<=0){
$kritpower=1;
}
$kritdexterity=$account['dexterity']-15;
if ($kritdexterity<=0){
$kritdexterity=2;
}
$kritwit=$account['wit']-10;
if ($kritwit<=0){
$kritwit=2;
}
$krit=$kritdexterity+$kritpower+$kritwit;
if ($krit>65){
$krit=65;
}
$start=100-$krit;
$start=rand(1,$start);
$end=$start+$krit;
$chanse=rand(1,100);
if ($chanse>=$start && $chanse<=$end){
$damag=round($damag*rand(1.5,1.9));
}
$hpheal=$account['hp']+$damag;
if ($account['max_hp']<$hpheal){
$hpheal=$account['max_hp'];
}
mysql_query("UPDATE `account` SET
`hp`='".$hpheal."'
WHERE
`id`='".$account['id']."'");
mysql_query("INSERT INTO `battle_log`(
`account`,
`mess`)VALUES(
'".$account['id']."',
'<div class="help"><img src="/data/img/skill/".$skill['icon'].".jpg" width="15px" height="15px">Вы исцелились на ".$damag." единиц</div>')");
mysql_query("UPDATE `skill` SET
`last_cast`='".time()."'
WHERE
`id`='".$skill['id']."'");
mysql_query("UPDATE `account` SET
`battle_last_attack`='".time()."'
WHERE
`id`='".$account['id']."'");
}else{
//если цель союзник
$damag=$skill['heal'] + 1;
$damag=(ceil($damag/100)*$account['feature_attack_magic'])+$damag;
$damag=round($damag);
if ($damag<=0){
$damag=1;
}
$damag+=rand(1,3);
$kritpower=$account['power']-20;
if ($kritpower<=0){
$kritpower=1;
}
$kritdexterity=$account['dexterity']-15;
if ($kritdexterity<=0){
$kritdexterity=2;
}
$kritwit=$account['wit']-10;
if ($kritwit<=0){
$kritwit=2;
}
$krit=$kritdexterity+$kritpower+$kritwit;
if ($krit>65){
$krit=65;
}
$start=100-$krit;
$start=rand(1,$start);
$end=$start+$krit;
$chanse=rand(1,100);
if ($chanse>=$start && $chanse<=$end){
$damag=round($damag*rand(1.5,1.9));
}
$hpheal=$mob['hp']+$damag;
if ($mob['max_hp']<$hpheal){
$hpheal=$mob['max_hp'];
}
mysql_query("UPDATE `account` SET
`hp`='".$hpheal."'
WHERE
`id`='".$mob['id']."'");
mysql_query("INSERT INTO `battle_log`(
`account`,
`mess`)VALUES(
'".$mob['id']."',
'<div class="help"><img src="/data/img/skill/".$skill['icon'].".jpg" width="15px" height="15px"><div class="help">".$account['name']." исцелил вас на ".$damag." единиц</div>')");
mysql_query("UPDATE `skill` SET
`last_cast`='".time()."'
WHERE
`id`='".$skill['id']."'");
mysql_query("UPDATE `account` SET
`battle_last_attack`='".time()."'
WHERE
`id`='".$account['id']."'");
}
}
/*if (mysql_result(mysql_query("SElECT COUNT(*) FROM `effect` WHERE
`skill`='".$skill['id']."' AND `target_type`='user' AND `target`='".$mob['id']."'"),0)){
mysql_query("UPDATE `effect` SET
`last_cast`='".time()."',
`time`='".time()."'
WHERE
`skill`='".$skill['id']."'");
mysql_query("UPDATE `skill` SET
`last_cast`='".time()."'
WHERE
`id`='".$skill['id']."'");
header('Location:?');
exit;
}*/
if ($skill['stun'] OR $skill['paralich'] OR $skill['sleep'] OR $skill['fear'] AND $account['battle_target_type']){
if ($account['battle_target_type']='user'){
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `effect`
WHERE `skill`='".$skill['id']."'
AND `account`='".$account['id']."'
AND `target_type`='user'
AND `target`='".$mob['id']."'"),0)){
mysql_query("UPDATE `effect` SET `time`='".time()."',`last_cast`='".time()."' WHERE `account`='".$account['id']."' AND `skill`='".$skill['id']."' AND `target_type`='user' AND `target`='".$mob['id']."'");
}else{
mysql_query("INSERT INTO `effect`(
`effect_time`,
`skill`,
`account`,
`target_type`,
`target`,
`fear`,
`sleep`,
`paralich`,
`stun`,
`time`)VALUES(
'".$skill['effect_time']."',
'".$skill['id']."',
'".$account['id']."',
'user',
'".$mob['id']."',
'".$skill['fear']."',
'".$skill['sleep']."',
'".$skill['paralich']."',
'".$skill['stun']."',
'".time()."')");
mysql_query("UPDATE `skill` SET
`last_cast`='".time()."'
WHERE
`id`='".$skill['id']."'");
}
}else{
}
}
if ($skill['debaph']){
if ($account['battle_target_type']=='user'){
//Сложение
$adding=0+$skill['baph_adding'];
//Воля
$will=0+$skill['baph_will'];
//Реакция
$reaction=0+$skill['baph_reaction'];
//Очки здоровья
$max_hp=0+$skill['baph_max_hp'];
//Очки маны
$max_mp=0+$skill['baph_max_mp'];
//Защита от ударов
$feature_armor_weapon=0+$skill['baph_feature_armor_weapon'];
//Защита от стрел
$feature_armor_arrow=0+$skill['baph_feature_armor_arrow'];
//Защита от магии
$feature_armor_magic=0+$skill['baph_feature_armor_magic'];
//Урон от ударов
$feature_attack_weapon=0+$skill['baph_feature_attack_weapon'];
//Урон от стрел
$feature_attack_arrow=0+$skill['baph_feature_attack_arrow'];
//Урон от магии
$feature_attack_magic=0+$skill['baph_feature_attack_magic'];
//Восстановление жизни
$hp_regen=0+$skill['baph_hp_regen'];
//Восстановление маны
$mp_regen=0+$skill['baph_mp_regen'];
//Power
$power=0+$skill['baph_power'];
//Wit
$wit=0+$skill['baph_wit'];
//Dexterity
$dexterity=0+$skill['baph_dexterity'];
//Vitality
$vitality=0+$skill['baph_vitality'];
//Spirit
$spirit=0+$skill['baph_spirit'];
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `effect`
WHERE `skill`='".$skill['id']."'
AND `account`='".$account['id']."'
AND `target_type`='user'
AND `target`='".$mob['id']."'"),0)){
mysql_query("UPDATE `effect` SET
`debaph`='1',
`effect_time`='".$skill['effect_time']."',
`target_type`='user',
`target`='".$mob['id']."',
`time`='".time()."',
`last_cast`='".time()."',
`baph_adding`='".$adding."',
`baph_will`='".$will."',
`baph_reaction`='".$reaction."',
`baph_max_hp`='".$max_hp."',
`baph_max_mp`='".$max_mp."',
`baph_feature_armor_weapon`='".$feature_armor_weapon."',
`baph_feature_armor_arrow`='".$feature_armor_arrow."',
`baph_feature_armor_magic`='".$feature_armor_magic."',
`baph_feature_attack_weapon`='".$feature_attack_weapon."',
`baph_feature_attack_arrow`='".$feature_attack_arrow."',
`baph_feature_attack_weapon`='".$feature_attack_magic."',
`baph_hp_regen`='".$hp_regen."',
`baph_mp_regen`='".$mp_regen."',
`baph_power`='".$power."',
`baph_wit`='".$wit."',
`baph_dexterity`='".$dexterity."',
`baph_spirit`='".$spirit."'
WHERE
`skill`='".$skill['id']."'
AND `account`='".$account['id']."'");
}else{
mysql_query("INSERT INTO `effect`(
`debaph`,
`account`,
`time`,
`last_cast`,
`effect_time`,
`skill`,
`target_type`,
`target`,
`baph_adding`,
`baph_will`,
`baph_reaction`,
`baph_max_hp`,
`baph_max_mp`,
`baph_feature_armor_weapon`,
`baph_feature_armor_arrow`,
`baph_feature_armor_magic`,
`baph_feature_attack_weapon`,
`baph_feature_attack_arrow`,
`baph_feature_attack_magic`,
`baph_hp_regen`,
`baph_mp_regen`,
`baph_power`,
`baph_wit`,
`baph_dexterity`,
`baph_spirit`
)VALUES(
'1',
'".$account['id']."',
'".time()."',
'".time()."',
'".$skill['effect_time']."',
'".$skill['id']."',
'user',
'".$mob['id']."',
'".$adding."',
'".$will."',
'".$reaction."',
'".$max_hp."',
'".$max_mp."',
'".$feature_armor_weapon."',
'".$feature_armor_arrow."',
'".$feature_armor_magic."',
'".$feature_attack_weapon."',
'".$feature_attack_arrow."',
'".$feature_attack_magic."',
'".$hp_regen."',
'".$mp_regen."',
'".$power."',
'".$wit."',
'".$dexterity."',
'".$spirit."'
)");
}
}else{
}
}
if ($skill['baph']){
if ($account['battle_target_type']=='user'){
//Сложение
$adding=0+$skill['baph_adding'];
//Воля
$will=0+$skill['baph_will'];
//Реакция
$reaction=0+$skill['baph_reaction'];
//Очки здоровья
$max_hp=0+$skill['baph_max_hp'];
//Очки маны
$max_mp=0+$skill['baph_max_mp'];
//Защита от ударов
$feature_armor_weapon=0+$skill['baph_feature_armor_weapon'];
//Защита от стрел
$feature_armor_arrow=0+$skill['baph_feature_armor_arrow'];
//Защита от магии
$feature_armor_magic=0+$skill['baph_feature_armor_magic'];
//Урон от ударов
$feature_attack_weapon=0+$skill['baph_feature_attack_weapon'];
//Урон от стрел
$feature_attack_arrow=0+$skill['baph_feature_attack_arrow'];
//Урон от магии
$feature_attack_magic=0+$skill['baph_feature_attack_magic'];
//Восстановление жизни
$hp_regen=0+$skill['baph_hp_regen'];
//Восстановление маны
$mp_regen=0+$skill['baph_mp_regen'];
//Power
$power=0+$skill['baph_power'];
//Wit
$wit=0+$skill['baph_wit'];
//Dexterity
$dexterity=0+$skill['baph_dexterity'];
//Vitality
$vitality=0+$skill['baph_vitality'];
//Spirit
$spirit=0+$skill['baph_spirit'];
if (mysql_result("SELECT COUNT(*) FROM `effect` WHERE
`account`='".$account['id']."'
AND `skill`='".$skill['id']."'")){
mysql_query("UPDATE `effect` SET
`time`='".time()."',
`last_cast`='".time()."',
`baph_adding`='".$adding."',
`baph_will`='".$will."',
`baph_reaction`='".$reaction."',
`baph_max_hp`='".$max_hp."',
`baph_max_mp`='".$max_mp."',
`baph_feature_armor_weapon`='".$feature_armor_weapon."',
`baph_feature_armor_arrow`='".$feature_armor_arrow."',
`baph_feature_armor_magic`='".$feature_armor_magic."',
`baph_feature_attack_weapon`='".$feature_attack_weapon."',
`baph_feature_attack_arrow`='".$feature_attack_arrow."',
`baph_feature_attack_weapon`='".$feature_attack_magic."',
`baph_hp_regen`='".$hp_regen."',
`baph_mp_regen`='".$mp_regen."',
`baph_power`='".$power."',
`baph_wit`='".$wit."',
`baph_dexterity`='".$dexterity."',
`baph_spirit`='".$spirit."'
WHERE
`skill`='".$skill['id']."'
AND `account`='".$account['id']."'");
}else{
mysql_query("INSERT INTO `effect`(
`baph`,
`account`,
`time`,
`last_cast`,
`effect_time`,
`skill`,
`baph_adding`,
`baph_will`,
`baph_reaction`,
`baph_max_hp`,
`baph_max_mp`,
`baph_feature_armor_weapon`,
`baph_feature_armor_arrow`,
`baph_feature_armor_magic`,
`baph_feature_attack_weapon`,
`baph_feature_attack_arrow`,
`baph_feature_attack_magic`,
`baph_hp_regen`,
`baph_mp_regen`,
`baph_power`,
`baph_wit`,
`baph_dexterity`,
`baph_spirit`
)VALUES(
'1',
'".$account['id']."',
'".time()."',
'".time()."',
'".$skill['effect_time']."',
'".$skill['id']."',
'".$adding."',
'".$will."',
'".$reaction."',
'".$max_hp."',
'".$max_mp."',
'".$feature_armor_weapon."',
'".$feature_armor_arrow."',
'".$feature_armor_magic."',
'".$feature_attack_weapon."',
'".$feature_attack_arrow."',
'".$feature_attack_magic."',
'".$hp_regen."',
'".$mp_regen."',
'".$power."',
'".$wit."',
'".$dexterity."',
'".$spirit."'
)");
}
}else{
//Сложение
$adding=0+$skill['baph_adding'];
//Воля
$will=0+$skill['baph_will'];
//Реакция
$reaction=0+$skill['baph_reaction'];
//Очки здоровья
$max_hp=0+$skill['baph_max_hp'];
//Очки маны
$max_mp=0+$skill['baph_max_mp'];
//Защита от ударов
$feature_armor_weapon=0+$skill['baph_feature_armor_weapon'];
//Защита от стрел
$feature_armor_arrow=0+$skill['baph_feature_armor_arrow'];
//Защита от магии
$feature_armor_magic=0+$skill['baph_feature_armor_magic'];
//Урон от ударов
$feature_attack_weapon=0+$skill['baph_feature_attack_weapon'];
//Урон от стрел
$feature_attack_arrow=0+$skill['baph_feature_attack_arrow'];
//Урон от магии
$feature_attack_magic=0+$skill['baph_feature_attack_magic'];
//Восстановление жизни
$hp_regen=0+$skill['baph_hp_regen'];
//Восстановление маны
$mp_regen=0+$skill['baph_mp_regen'];
//Power
$power=0+$skill['baph_power'];
//Wit
$wit=0+$skill['baph_wit'];
//Dexterity
$dexterity=0+$skill['baph_dexterity'];
//Vitality
$vitality=0+$skill['baph_vitality'];
//Spirit
$spirit=0+$skill['baph_spirit'];
if (mysql_result("SELECT COUNT(*) FROM `effect` WHERE
`account`='".$account['id']."'
AND `skill`='".$skill['id']."' AND `target_type`='user' AND `target`='".$account['battle_attack']."'")){
mysql_query("UPDATE `effect` SET
`time`='".time()."',
`last_cast`='".time()."',
`baph_adding`='".$adding."',
`baph_will`='".$will."',
`baph_reaction`='".$reaction."',
`baph_max_hp`='".$max_hp."',
`baph_max_mp`='".$max_mp."',
`baph_feature_armor_weapon`='".$feature_armor_weapon."',
`baph_feature_armor_arrow`='".$feature_armor_arrow."',
`baph_feature_armor_magic`='".$feature_armor_magic."',
`baph_feature_attack_weapon`='".$feature_attack_weapon."',
`baph_feature_attack_arrow`='".$feature_attack_arrow."',
`baph_feature_attack_weapon`='".$feature_attack_magic."',
`baph_hp_regen`='".$hp_regen."',
`baph_mp_regen`='".$mp_regen."',
`baph_power`='".$power."',
`baph_wit`='".$wit."',
`baph_dexterity`='".$dexterity."',
`baph_spirit`='".$spirit."',
`target_type`='user',
`target`='".$account['battle_attack']."'
WHERE
`skill`='".$skill['id']."'
AND `account`='".$account['id']."'");
}else{
mysql_query("INSERT INTO `effect`(
`baph`,
`account`,
`time`,
`last_cast`,
`effect_time`,
`skill`,
`baph_adding`,
`baph_will`,
`baph_reaction`,
`baph_max_hp`,
`baph_max_mp`,
`baph_feature_armor_weapon`,
`baph_feature_armor_arrow`,
`baph_feature_armor_magic`,
`baph_feature_attack_weapon`,
`baph_feature_attack_arrow`,
`baph_feature_attack_magic`,
`baph_hp_regen`,
`baph_mp_regen`,
`baph_power`,
`baph_wit`,
`baph_dexterity`,
`baph_spirit`,
`target_type`,
`target`
)VALUES(
'1',
'".$account['id']."',
'".time()."',
'".time()."',
'".$skill['effect_time']."',
'".$skill['id']."',
'".$adding."',
'".$will."',
'".$reaction."',
'".$max_hp."',
'".$max_mp."',
'".$feature_armor_weapon."',
'".$feature_armor_arrow."',
'".$feature_armor_magic."',
'".$feature_attack_weapon."',
'".$feature_attack_arrow."',
'".$feature_attack_magic."',
'".$hp_regen."',
'".$mp_regen."',
'".$power."',
'".$wit."',
'".$dexterity."',
'".$spirit."',
'user',
'".$account['battle_attack']."'
)");
}
}
}
if ($skill['effect_damage'] && $account['battle_target_type']=='user'){
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `effect` WHERE
`skill`='".$skill['id']."'
AND `account`='".$account['id']."'
AND `target_type`='user'
AND `target`='".$mob['id']."'"),0)){
mysql_query("UPDATE `effect` SET
`time`='".time()."',
`last_cast`='".time()."',
`effect_damage`='".$skill['effect_damage']."',
`effect_time`='".$skill['effect_time']."',
`effect_every_sec`='".$skill['effect_every']."',
`target_type`='user',
`target`='".$mob['id']."',
`dota`='1',
WHERE `skill`='".$skill['id']."'");
}else{
mysql_query("INSERT INTO `effect`(
`effect_damage`,
`time`,
`effect_time`,
`effect_every_sec`,
`account`,
`target_type`,
`target`,
`skill`,
`last_cast`,
`dota`)VALUES(
'".$skill['effect_damage']."',
'".time()."',
'".$skill['effect_time']."',
'".$skill['effect_every_sec']."',
'".$account['id']."',
'user',
'".$mob['id']."',
'".$skill['id']."',
'".time()."',
'1')");
}
}
if($skill['effect_hp_regen'] || $skill['effect_hp_regen_percent']){
if ($account['battle_target_type']=='user'){
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `effect` WHERE
`skill`='".$skill['id']."'
AND `account`='".$account['id']."'"),0)){
mysql_query("UPDATE `effect` SET
`time`='".time()."',
`last_cast`='".time()."',
`effect_hp_regen`='".$skill['effect_hp_regen']."',
`effect_hp_regen_percent`='".$skill['effect_hp_regen_percent']."',
`effect_time`='".$skill['effect_time']."',
`effect_every_sec`='".$skill['effect_every_sec']."'
WHERE `skill`='".$skill['id']."'");
}else{
mysql_query("INSERT INTO `effect`(
`time`,
`last_cast`,
`skill`,
`effect_hp_regen`,
`effect_hp_regen_percent`,
`effect_time`,
`effect_every_sec`,
`account`)VALUES(
'".time()."',
'".time()."',
'".$skill['id']."',
'".$skill['effect_hp_regen']."',
'".$skill['effect_hp_regen_percent']."',
'".$skill['effect_time']."',
'".$skill['effect_every_sec']."',
'".$account['id']."')");
}
}else{
$hpregtarget=mysql_fetch_assoc(mysql_query("SELECT * FROM `account` WHERE `id`='".$account['battle_attack']."'"));
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `effect` WHERE
`skill`='".$skill['id']."'
AND `account`='".$account['id']."'"),0)){
mysql_query("UPDATE `effect` SET
`time`='".time()."',
`last_cast`='".time()."',
`effect_hp_regen`='".$skill['effect_hp_regen']."',
`effect_hp_regen_percent`='".$skill['effect_hp_regen_percent']."',
`effect_time`='".$skill['effect_time']."',
`effect_every_sec`='".$skill['effect_every_sec']."'
WHERE `skill`='".$skill['id']."'");
}else{
mysql_query("INSERT INTO `effect`(
`time`,
`last_cast`,
`skill`,
`effect_hp_regen`,
`effect_hp_regen_percent`,
`effect_time`,
`effect_every_sec`,
`account`,
`target_type`,
`target`)VALUES(
'".time()."',
'".time()."',
'".$skill['id']."',
'".$skill['effect_hp_regen']."',
'".$skill['effect_hp_regen_percent']."',
'".$skill['effect_time']."',
'".$skill['effect_every_sec']."',
'".$account['id']."',
'user',
'".$hpregtarget['id']."')");
}
}
}
if ($skill['damage']){
mysql_query("UPDATE `account` SET
`hp`='".$hp."'
WHERE `id`='".$mob['id']."'") or die(mysql_error());
mysql_query("INSERT INTO `battle_log`(
`account`,
`mess`)VALUES(
'".$account['id']."',
'<div class="help"><img src="/data/img/skill/".$skill['icon'].".jpg" width="15px" height="15px">Вы наносите ".$damaglast." урона</div>')");
mysql_query("INSERT INTO `battle_log`(
`account`,
`mess`)VALUES(
'".$mob['id']."',
'<div class="help"><img src="/data/img/skill/".$skill['icon'].".jpg" width="15px" height="15px">Вы получаете ".$damaglast." урона</div>')");
}
mysql_query("UPDATE `account` SET
`mp`='".($account['mp']-$skill['mp_need_from_cast'])."'
WHERE
`id`='".$account['id']."'");
mysql_query("UPDATE `skill` SET
`last_cast`='".time()."'
WHERE
`account`='".$account['id']."'
AND `id`='".$skill['id']."'");
mysql_query("UPDATE `account` SET
`battle_last_attack`='".time()."'
WHERE
`id`='".$account['id']."'");
header("Location: ?");
exit;
}
}
if (isset($_GET['attack'])){
if (time()-$account['battle_last_attack']<2){
header("Location: ?");
exit;
}
//if ($account['battle_target_type']=='user'){
//header('Location: ?');
//exit;
//}
/*************Обнуляем характеристики************/
/*
$mob['adding'] = 0;
//Воля
$mob['will'] = 0;
//Реакция
$mob['reaction'] = 0;
//Защита от ударов
$mob['feature_armor_weapon']=0;
//Защита от стрел
$mob['feature_armor_arrow']=0;
//Защита от магии
$mob['feature_armor_magic']=0;
//Урон от ударов
$mob['feature_attack_weapon']=0;
//Урон от стрел
$mob['feature_attack_arrow']=0;
//Урон от магии
$mob['feature_attack_magic']=0;
//Минимальный урон(оружие)
$mob['min_damag']=0;
//Максимальный урон(оружие)
$mob['max_damag']=0;
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `effect` WHERE
`debaph`='1'
AND `target_type`='user'
AND `target`='".$mob['id']."'"),0)){
$qdb=mysql_query("SELECT * FROM `effect` WHERE
`debaph`='1'
AND `target_type`='user'
AND `target`='".$mob['id']."'");
while($resultdb=mysql_fetch_assoc($qdb)){
if (time()-$resultdb['time']>=$resultdb['effect_time']){
mysql_query("DELETE FROM `effect` WHERE
`id`='".$resultdb['id']."'");
header("Location: ?");
exit;
}
//Сложение
$mob['adding']-=$resultdb['baph_adding'];
//Воля
$mob['will']-=$resultdb['baph_will'];
//Реакция
$mob['reaction']-=$resultdb['baph_reaction'];
//Очки здоровья
$mob['max_hp']-=$resultdb['baph_max_hp'];
//Очки маны
$mob['max_mp']-=$resultdb['baph_max_mp'];
//Защита от ударов
$mob['feature_armor_weapon']-=$resultdb['baph_feature_armor_weapon'];
//Защита от стрел
$mob['feature_armor_arrow']-=$resultdb['baph_feature_armor_arrow'];
//Защита от магии
$mob['feature_armor_magic']-=$resultdb['baph_feature_armor_magic'];
//Урон от ударов
$mob['feature_attack_weapon']-=$resultdb['baph_feature_attack_weapon'];
//Урон от стрел
$mob['feature_attack_arrow']-=$resultdb['baph_feature_attack_arrow'];
//Урон от магии
$mob['feature_attack_magic']-=$resultdb['baph_feature_attack_magic'];
//Восстановление жизни
$mob['hp_regen']-=$resultdb['baph_hp_regen'];
//Восстановление маны
$mob['mp_regen']-=$resultdb['baph_mp_regen'];
//Power
$mob['power']-=$resultdb['baph_power'];
//Wit
$mob['wit']-=$resultdb['baph_wit'];
//Dexterity
$mob['dexterity']-=$resultdb['baph_dexterity'];
//Vitality
$mob['vitality']-=$resultdb['baph_vitality'];
//Spirit
$mob['spirit']-=$resultdb['baph_spirit'];
foreach($mob as $key=>$value){
if (is_numeric($value)){
if ($value<0){
$mob[$key]=0;
}
}
}
}
}*/
/*************************************************************************************
************************Характеристики*************************************************
****************************************************************************************/
/*
$addingmin=0.02*$mob['power'];
$mob['adding'] += ceil($mob['power']-$addingmin);
//Воля
$willmin=0.02*$mob['wit'];
$mob['will'] += ceil($mob['wit']-$willmin);
//Реакция
$reactionmin=0.02*$mob['dexterity'];
$mob['reaction'] += ceil($mob['dexterity']-$reactionmin);
//Защита от ударов
$armorweaponmin=floor($mob['power']/2)*0.01;
$mob['feature_armor_weapon']+=($mob['power']*0.55)-$armorweaponmin;
//Защита от стрел
$armorarrowmin=floor($mob['dexterity']/2)*0.01;
$mob['feature_armor_arrow']+=($mob['dexterity']*0.55)-$armorarrowmin;
//Защита от магии
$armormagicmin=floor($mob['wit']/2)*0.01;
$mob['feature_armor_magic']+=($mob['wit']*0.55)-$armormagicmin;
//Урон от ударов
$mob['feature_attack_weapon']+=floor($mob['power']/2)*1;
//Урон от стрел
$mob['feature_attack_arrow']+=floor($mob['dexterity']/2)*1;
//Урон от магии
$mob['feature_attack_magic']+=floor($mob['wit']/2)*1;*/
/*******************************************************************
**********************DAMAG******************************************
**********************************************************************/
$damag=rand($account['min_damag'],$account['max_damag']);
$damag=(ceil($damag/100)*$account['feature_attack_weapon'])+$damag;
$damag=$damag-(ceil($damag/100)*$mob['feature_armor_weapon']);
$damag=round($damag);
if ($damag<=0){
$damag=1;
}
$damag+=rand(1,3);
$kritpower=$account['power']-20;
if ($kritpower<=0){
$kritpower=1;
}
$kritdexterity=$account['dexterity']-15;
if ($kritdexterity<=0){
$kritdexterity=2;
}
$kritwit=$account['wit']-10;
if ($kritwit<=0){
$kritwit=2;
}
$krit=$kritdexterity+$kritpower+$kritwit;
if ($krit>65){
$krit=65;
}
$start=100-$krit;
$start=rand(1,$start);
$end=$start+$krit;
$chanse=rand(1,100);
if ($chanse>=$start && $chanse<=$end){
$damag=round($damag*rand(1.5,1.9));
}
$hp=$mob['hp']-$damag;
if ($hp<0){
$hp=0;
if($damag && $account['battle_target_type']=='user'){
mysql_query("UPDATE `account` SET
`hp`='".$hp."'
WHERE `id`='".$mob['id']."'");
mysql_query("INSERT INTO `battle_log`(
`account`,
`mess`)VALUES(
'".$account['id']."',
'<div class="help"><img src="/data/img/skill/attack.jpg" width="15px" height="15px">Вы наносите ".$damag." урона</div>')");
mysql_query("INSERT INTO `battle_log`(
`account`,
`mess`)VALUES(
'".$mob['id']."',
'<div class="help"><img src="/data/img/skill/attack.jpg" width="15px" height="15px">Вы получаете ".$damag." урона</div>')");
}
//mysql_query("UPDATE `account` SET
//`mp`='".($account['mp']-$skill['mp_need_from_cast'])."'
//WHERE
//`id`='".$account['id']."'");
mysql_query("UPDATE `skill` SET
`last_cast`='".time()."'
WHERE
`account`='".$account['id']."'
AND `id`='".$skill['id']."'");
mysql_query("UPDATE `account` SET
`battle_last_attack`='".time()."'
WHERE
`id`='".$account['id']."'");
$targett=mysql_fetch_assoc(mysql_query("SELECT * FROM `account` WHERE `id`='".$mob['battle_attack']."'"));
mysql_query("DELETE FROM `effect` WHERE
`target_type`='user'
AND `target`='".$mob['id']."'");
mysql_query("UPDATE `account` SET
`hp`='".$mob['max_hp']."',
`mp`='".$mob['max_mp']."',
`last_death`='".time()."',
`duel_battle`=''
WHERE
`id`='".$mob['id']."'");
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$mob['battle_attack']."','<div class="help">Вы победили</div>')");
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$mob['id']."','<div class="help">Дуэль окончена, вы проиграли</div>')");
$levl=mysql_fetch_assoc(mysql_query("SELECT * FROM `lvl` WHERE `id`='".$targett['lvl']."'"));
mysql_query("UPDATE `account` SET `exp`='".($targett['exp']+$mob['exp'])."' WHERE `id`='".$targett['id']."'");
$targett['exp']=mysql_result(mysql_query("SELECT `exp` FROM `account` WHERE `id`='".$targett['id']."'"),0);
//echo 'Получено опыта: '.$mob['exp'].'<br />';
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Получено опыта: ".$mob['exp']."</div>')");
if ($targett['clan']){
mysql_query("UPDATE `clan` SET `exp`=`exp`+".($mob['exp']/2)." WHERE `id`='".$targett['clan']."'");
}
$targett['exp']=mysql_result(mysql_query("SELECT `exp` FROM `account` WHERE `id`='".$targett['id']."'"),0);
if ($targett['exp']>$levl['exp']){
//$expe=$targett['exp']-$levl['exp'];
mysql_query("UPDATE `account` SET `lvl`='".($targett['lvl']+1)."',`exp`='0',`skill_point`=`skill_point`+'1',`character_point`=`character_point`+'2' WHERE `id`='".$targett['id']."'");
//echo 'Уровень повышен!<br />';
mysql_query("INSERT INTO `msg_list`(`acount`,`msg`)VALUES('".$targett['id']."','<div class="help">Уровень повышен!</div>')");
}
mysql_query("UPDATE `account` SET `duel_battle`='',`battle_attack`='' WHERE `id`='".$account['id']."'");
mysql_query("UPDATE `account` SET `duel_battle`='',`battle_attack`='' WHERE `id`='".$account['battle_attack']."'");
mysql_query("DELETE FROM `battle` WHERE `id`='".$account['duel_battle']."'");
header("Location: ?");
exit;
}
mysql_query("UPDATE `account` SET
`hp`='".$hp."'
WHERE
`id`='".$mob['id']."'");
mysql_query("INSERT INTO `battle_log`(
`account`,
`mess`)VALUES(
'".$account['id']."',
'<div class="help"><img src="/data/img/skill/attack.jpg" width="15px" height="15px">Вы наносите ".$damag." урона</div>')");
mysql_query("INSERT INTO `battle_log`(
`account`,
`mess`)VALUES(
'".$mob['id']."',
'<div class="help"><img src="/data/img/skill/attack.jpg" width="15px" height="15px">Вы получаете ".$damag." урона</div>')");
mysql_query("UPDATE `account` SET
`battle_last_attack`='".time()."'
WHERE
`id`='".$account['id']."'");
header("Location: ?");
exit;
}
echo '
</center>
';
/*@$hpe['width']=round(100/($account['max_hp']/$account['hp']));
//@$mpe['width']=round(100/($account['max_mp']/$account['mp']));
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `effect` WHERE (`account`='".$account['id']."' AND `target_type`='0') OR (`target_type`='user' AND `target`='".$account['id']."')"),0)){
$qrea=mysql_query("SELECT * FROM `effect` WHERE (`account`='".$account['id']."' AND `target_type`='0') OR (`target_type`='user' AND `target`='".$account['id']."')");
while($resea=mysql_fetch_assoc($qrea)){
$skillea=mysql_fetch_assoc(mysql_query("SELECT * FROM `skill` WHERE
`id`='".$resea['skill']."'"));
echo '<img src="/data/img/skill/'.$skillea['icon'].'.jpg" height="10px" width="10px" title="'.$skillea['name'].'">';
}
}
echo '
<table width="100%">
<tr>
<td valign="top" width="50%">
<div style="height:20px;background:#FA8072;margin-bottom:2px;border-radius:5px 5px 5px 5px;">
<div style="height:20px;padding-left:5px;float:left;font-size:11px;color:white;border-radius:5px 5px 5px 5px;"><center><!--'.$account['hp'].'/'.$account['max_hp'].'!--></center></div>
<div style="height:20px;border-radius:5px 5px 5px 5px;width:'.$hpe['width'].'%;background:url(style/img/hp.jpg) left repeat-x;"></div></div>
</td><td valign="top" width="50%">
<div style="height:20px;background:#5B5BB5;margin-bottom:2px;border-radius:5px 5px 5px 5px;">
<div style="font-align:right;height:20px;padding-left:0px;float:left;font-size:11px;border-radius:5px 5px 5px 5px;color:white;"><font align="right"><center><!--'.$account['mp'].'/'.$account['max_mp'].'--!></center></font></div>
<div style="height:20px;width:'.$mpe['width'].'%;background:url(style/img/mp.jpg) left repeat-x;border-radius:5px 5px 5px 5px;"></div></div>
</td>
</tr>
</table>';
echo '</div>';*/
echo '<div class="title">Дуэль</div>';
echo '<div class="border-top"></div>';
if ($account['battle_target_type']=='mob'){
if ($mob['hp']){
$mob_hp['hp']=round(100/($mob['max_hp']/$mob['hp']));
}else{
$mob_hp['hp']=1;
}
if ($mob['mp']){
$mob_mp['mp']=round(100/($mob['max_mp']/$mob['mp']));
}else{
$mob_mp['mp']=1;
}
echo '<div class="help">'.$mob['name'].' ';
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `effect`
WHERE `target_type`='mob'
AND `target`='".$mob['id']."'"),0)){
echo '<div class="link_str">';
$queryeffects=mysql_query("SELECT * FROM `effect`
WHERE `target_type`='mob'
AND `target`='".$mob['id']."'");
while($resulteffects=mysql_fetch_assoc($queryeffects)){
$skilll=mysql_fetch_array(mysql_query("SELECT * FROM `skill` WHERE
`id`='".$resulteffects['skill']."'"));
echo '<img src="/data/img/skill/'.$skilll['icon'].'.jpg" height="15px" width="15px" title="'.$skilll['about'].'">';
}
echo '</div>';
}
echo '
<table width="100%">
<tr>
<td valign="top" width="50%">
<div style="height:14px;opacity:0.5;margin-bottom:2px;border-radius:5px 0px 5px 0px;">
<div style="height:14px;padding-left:5px;float:left;font-size:11px;color:white;border-radius:5px 0px 5px 0px;"><center>'.$mob['hp'].'/'.$mob['max_hp'].'</center></div>
<div style="height:14px;border-radius:5px 0px 5px 0px;width:'.$mob_hp['hp'].'%;background:';
echo ';"></div></div>
</td><td valign="top" width="50%">
<div style="height:14px;background:#5B5BB5;margin-bottom:2px;border-radius:5px 5px 5px 5px;">
<div style="font-align:right;height:20px;padding-left:0px;float:left;font-size:11px;border-radius:5px 5px 5px 5px;color:white;"><font align="right"><center>'.$mob['mp'].'/'.$mob['max_mp'].'</center></font></div>
<div style="height:14px;width:'.$mob_mp['mp'].'%;background:url(style/img/mp.jpg) left repeat-x;border-radius:5px 5px 5px 5px;"></div></div>
</td>
</tr>
</table>';
echo '</div>';
}else{
if ($mob['hp']){
@$mob_hp['hp']=round(100/($mob['max_hp']/$mob['hp']));
}else{
$mob_hp['hp']=1;
}
if ($mob['mp']){
@$mob_mp['mp']=round(100/($mob['max_mp']/$mob['mp']));
}else{
$mob_mp['mp']=1;
}
echo '<div class="help">'.$mob['name'].' ';
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `effect`
WHERE (`account`='".$mob['id']."' AND `target_type`='0') OR (`target_type`='user' AND `target`='".$mob['id']."')"),0)){
$queryeffects=mysql_query("SELECT * FROM `effect`
WHERE (`account`='".$mob['id']."' AND `target_type`='0') OR (`target_type`='user' AND `target`='".$mob['id']."')");
while($resulteffects=mysql_fetch_assoc($queryeffects)){
$skilll=mysql_fetch_array(mysql_query("SELECT * FROM `skill` WHERE
`id`='".$resulteffects['skill']."'"));
echo '<img src="/data/img/skill/'.$skilll['icon'].'.jpg" height="10px" width="10px" title="'.$skilll['about'].'">';
}
}
echo '
<table width="100%">
<tr>
<td valign="top" width="50%">
<div style="height:14px;opacity:0.5;margin-bottom:2px;border-radius:5px 0px 5px 0px;border:2px solid black;">
<div style="height:14px;padding-left:10px;float:left;font-size:11px;color:white;border-radius:5px 0px 5px 0px;"><center>'.$mob['hp'].'/'.$mob['max_hp'].'</center></div>
<div style="height:14px;border-radius:5px 0px 5px 0px;width:'.$mob_hp['hp'].'%;background:';
if ($mob_hp['hp'] >= 90){
echo '#32CD32';
}elseif($mob_hp['hp'] <= 89 AND $mob_hp['hp'] >=80){
echo '#9ACD32';
}elseif($mob_hp['hp'] >= 70 AND $mob_hp['hp'] <=79){
echo '#FFD700';
}elseif($mob_hp['hp'] >= 60 AND $mob_hp['hp'] <=69){
echo '#FFA500';
}elseif($mob_hp['hp'] >= 50 AND $mob_hp['hp'] <=59){
echo '#FF8C00';
}elseif($mob_hp['hp'] >= 40 AND $mob_hp['hp'] <=49){
echo '#FF4500';
}elseif($mob_hp['hp'] >= 30 AND $mob_hp['hp'] <=39){
echo '#D2691E';
}elseif($mob_hp['hp'] >= 20 AND $mob_hp['hp'] <=29){
echo '#FF0000';
}elseif($mob_hp['hp'] >= 10 AND $mob_hp['hp'] <=19){
echo '#B22222';
}elseif($mob_hp['hp'] >=1 AND $mob_hp['hp'] <= 9){
echo '#A52A2A';
}
echo ';"></div></div>
</td><td valign="top" width="50%">
<div style="height:14px;opacity:0.5;margin-bottom:2px;border-radius:0px 5px 0px 5px;border:2px solid black;">
<div style="font-align:right;height:14px;padding-left:10px;float:left;font-size:11px;border-radius:0px 5px 0px 5px;color:white;"><font align="right"><center>'.$mob['mp'].'/'.$mob['max_mp'].'</center></font></div>
<div style="height:14px;width:'.$mob_mp['mp'].'%;background:#7B68EE;border-radius:0px 5px 0px 5px;"></div></div>
</td>
</tr>
</table>';
echo '</div>';
}
echo '<div class="help">';
echo '<a href="?attack" title="Ударить"><img src="/data/img/skill/attack.jpg" width="24px" height="24px"></a>';
$q=mysql_query("SELECT * FROM `skill` WHERE
`account`='".$account['id']."'");
while($result=mysql_fetch_array($q)){
if (time()-$result['last_cast']<$result['res_time']){
echo '<img src="/data/img/skill/'.$result['icon'].'.jpg" style="opacity:0.5;" title="'.$result['name'].' ('.floor($result['res_time']-(time()-$result['last_cast'])).')"></a>';
}else{
echo '<a href="?skill='.$result['id'].'" title="'.$result['name'].'"><img src="/data/img/skill/'.$result['icon'].'.jpg"></a>';
}
}
echo '</div>';
mysql_query("OPTIMIZATE TABLE `battle_log`");
$ql=mysql_query("SELECT * FROM `battle_log` WHERE `account`='".$account['id']."' ORDER BY `id` DESC LIMIT 5");
while($resultl=mysql_fetch_assoc($ql)){
echo $resultl['mess'];
}
echo '</div>';
down();
}else{
header("Location: location.php?");
exit;
}
}else{
header("Location: /?");
exit;
}
?>