Файл: cron/okr.php
Строк: 151
<?
define('PROTECTOR', 1);
$db_host = "localhost";
$db_user = "root";
$db_table = "sidonia";
$db_pass = "";
$connect = @ mysql_pconnect($db_host, $db_user, $db_pass) or die('cannot connect to server');
@ mysql_select_db($db_table) or die('cannot connect to db');
@ mysql_query("SET NAMES 'utf8'", $connect);
$okr=mysql_query("SELECT * FROM `okr_mob` WHERE `resp`<='".time()."' and `status`='0'");
while($ok=mysql_fetch_array($okr))
{
if($ok['lvl']<=16)
{
$hp=$ok['lvl']*53;
$sila=$ok['lvl']*5;
$arm=$ok['lvl']*2;
}
elseif($ok['lvl']>=17 and $ok['lvl']<=31)
{
$hp=$ok['lvl']*102;
$sila=$ok['lvl']*9;
$arm=$ok['lvl']*4;
}
elseif($ok['lvl']>=32 and $ok['lvl']<=39)
{
$hp=$ok['lvl']*149;
$sila=$ok['lvl']*15;
$arm=$ok['lvl']*7;
}
else
{
$hp=$ok['lvl']*211;
$sila=$ok['lvl']*21;
$arm=$ok['lvl']*10;
}
if($ok['rang']=='D')
{
$hp=$hp;
$sila=$sila;
$arm=$arm;
}
elseif($ok['rang']=='C')
{
$hp=round($hp*1.5);
$sila=round($sila*1.2);
$arm=round($arm*1.2);
}
elseif($ok['rang']=='B')
{
$hp=round($hp*2.3);
$sila=round($sila*1.4);
$arm=round($arm*1.6);
}
elseif($ok['rang']=='A')
{
$hp=round($hp*3);
$sila=round($sila*1.7);
$arm=round($arm*1.8);
}
elseif($ok['rang']=='S')
{
$hp=round($hp*3.8);
$sila=round($sila*2.2);
$arm=round($arm*2.2);
}
elseif($ok['rang']=='SS')
{
$hp=round($hp*6);
$sila=round($sila*3);
$arm=round($arm*3);
}
$ataka=10;
if($ok['stihia']==0)
{
$hp=$hp;
$sila=$sila;
$arm=$arm;
$sila_fire=0;
$sila_water=0;
$sila_air=0;
$sila_ground=0;
$arm_fire=0;
$arm_water=0;
$arm_air=0;
$arm_ground=0;
}
elseif($ok['stihia']==1)
{
if($ok['st_sila']==1)
{
$sila_fire=round($sila*0.2);
$sila_water=0;
$sila_air=0;
$sila_ground=0;
$arm_fire=round($arm*0.1);
$arm_water=0;
$arm_air=0;
$arm_ground=0;
$hp=$hp;
$sila=round($sila*0.9);
$arm=$arm;
}
elseif($ok['st_sila']==2)
{
$sila_fire=round($sila*0.5);
$sila_water=0;
$sila_air=0;
$sila_ground=0;
$arm_fire=round($arm*0.2);
$arm_water=0;
$arm_air=0;
$arm_ground=0;
$hp=$hp;
$sila=round($sila*0.7);
$arm=$arm;
}
elseif($ok['st_sila']==3)
{
$sila_fire=round($sila*1);
$sila_water=0;
$sila_air=0;
$sila_ground=0;
$arm_fire=round($arm*0.5);
$arm_water=0;
$arm_air=0;
$arm_ground=0;
$hp=$hp;
$sila=round($sila*0.4);
$arm=$arm;
}
}
elseif($ok['stihia']==2)
{
if($ok['st_sila']==1)
{
$sila_fire=0;
$sila_water=round($sila*0.2);
$sila_air=0;
$sila_ground=0;
$arm_fire=0;
$arm_water=round($arm*0.1);
$arm_air=0;
$arm_ground=0;
$hp=round($hp*1.2);
$sila=round($sila*0.8);
$arm=$arm;
}
elseif($ok['st_sila']==2)
{
$sila_fire=0;
$sila_water=round($sila*0.5);
$sila_air=0;
$sila_ground=0;
$arm_fire=0;
$arm_water=round($arm*0.2);
$arm_air=0;
$arm_ground=0;
$hp=round($hp*1.5);
$sila=round($sila*0.5);
$arm=$arm;
}
elseif($ok['st_sila']==3)
{
$sila_fire=0;
$sila_water=round($sila*1);
$sila_air=0;
$sila_ground=0;
$arm_fire=0;
$arm_water=round($arm*0.5);
$arm_air=0;
$arm_ground=0;
$hp=round($hp*2);
$sila=round($sila*0);
$arm=$arm;
}
}
elseif($ok['stihia']==3)
{
if($ok['st_sila']==1)
{
$sila_fire=0;
$sila_water=0;
$sila_air=round($sila*0.2);
$sila_ground=0;
$arm_fire=0;
$arm_water=0;
$arm_air=round($arm*0.1);
$arm_ground=0;
$hp=$hp;
$sila=round($sila*0.8);
$arm=$arm;
$ataka=8;
}
elseif($ok['st_sila']==2)
{
$sila_fire=0;
$sila_water=0;
$sila_air=round($sila*0.5);
$sila_ground=0;
$arm_fire=0;
$arm_water=0;
$arm_air=round($arm*0.2);
$arm_ground=0;
$hp=$hp;
$sila=round($sila*0.5);
$arm=$arm;
$ataka=6;
}
elseif($ok['st_sila']==3)
{
$sila_fire=0;
$sila_water=0;
$sila_air=round($sila*1);
$sila_ground=0;
$arm_fire=0;
$arm_water=0;
$arm_air=round($arm*0.5);
$arm_ground=0;
$hp=$hp;
$sila=round($sila*0);
$arm=$arm;
$ataka=4;
}
}
elseif($ok['stihia']==4)
{
if($ok['st_sila']==1)
{
$sila_fire=0;
$sila_water=0;
$sila_air=0;
$sila_ground=round($sila*0.2);
$arm_fire=0;
$arm_water=0;
$arm_air=0;
$arm_ground=round($arm*0.1);
$hp=$hp;
$sila=round($sila*0.8);
$arm=round($arm*1.2);
}
elseif($ok['st_sila']==2)
{
$sila_fire=0;
$sila_water=0;
$sila_air=0;
$sila_ground=round($sila*0.5);
$arm_fire=0;
$arm_water=0;
$arm_air=0;
$arm_ground=round($arm*0.2);
$hp=$hp;
$sila=round($sila*0.5);
$arm=round($arm*1.5);
}
elseif($ok['st_sila']==3)
{
$sila_fire=0;
$sila_water=0;
$sila_air=0;
$sila_ground=round($sila*1);
$arm_fire=0;
$arm_water=0;
$arm_air=0;
$arm_ground=round($arm*0.5);
$hp=$hp;
$sila=round($sila*0);
$arm=round($arm*2);
}
}
elseif($ok['stihia']==5)
{
if($ok['st_sila']==1)
{
$sila_fire=round($sila*0.2);
$sila_water=0;
$sila_air=round($sila*0.2);
$sila_ground=0;
$arm_fire=round($arm*0.1);
$arm_water=0;
$arm_air=round($arm*0.1);
$arm_ground=0;
$hp=$hp;
$sila=round($sila*0.8);
$arm=$arm;
$ataka=7;
}
elseif($ok['st_sila']==2)
{
$sila_fire=round($sila*0.5);
$sila_water=0;
$sila_air=round($sila*0.5);
$sila_ground=0;
$arm_fire=round($arm*0.2);
$arm_water=0;
$arm_air=round($arm*0.2);
$arm_ground=0;
$hp=$hp;
$sila=round($sila*0.4);
$arm=$arm;
$ataka=5;
}
elseif($ok['st_sila']==3)
{
$sila_fire=0;
$sila_water=round($sila*0.2);
$sila_air=0;
$sila_ground=round($sila*0.2);
$arm_fire=0;
$arm_water=round($arm*0.1);
$arm_air=0;
$arm_ground=round($arm*0.1);
$hp=round($hp*1.2);
$sila=round($sila*0.6);
$arm=round($arm*1.2);
}
elseif($ok['st_sila']==4)
{
$sila_fire=0;
$sila_water=round($sila*0.5);
$sila_air=0;
$sila_ground=round($sila*0.5);
$arm_fire=0;
$arm_water=round($arm*0.2);
$arm_air=0;
$arm_ground=round($arm*0.2);
$hp=round($hp*1.5);
$sila=round($sila*0);
$arm=round($arm*1.5);
}
}
mysql_query("INSERT INTO `okr_mobs` SET
`id`='',
`name`='".$ok['name']."',
`rang`='".$ok['rang']."',
`lvl`='".$ok['lvl']."',
`orig`='".$ok['id']."',
`img`='".$ok['img']."',
`hp`='".$hp."',
`hp_max`='".$hp."',
`sila`='".$sila."',
`arm`='".$arm."',
`sila_fire`='".$sila_fire."',
`sila_water`='".$sila_water."',
`sila_air`='".$sila_air."',
`sila_ground`='".$sila_ground."',
`arm_fire`='".$arm_fire."',
`arm_water`='".$arm_water."',
`arm_air`='".$arm_air."',
`arm_ground`='".$arm_ground."',
`ataka`='".$ataka."',
`okr`='".$ok['okr']."',
`x`='".rand(1,7)."',
`y`='".rand(1,7)."',
`activ`='".$ok['activ']."',
`stihia`='".$ok['stihia']."',
`drop_lvl_max`='".$ok['drop_lvl_max']."',
`drop_item`='".$ok['drop_item']."',
`drop_res`='".$ok['drop_res']."',
`drop_key`='".$ok['drop_key']."'
");
mysql_query("UPDATE `okr_mob` SET `status`='1' WHERE `id`='".$ok['id']."'");
}
mysql_query("DELETE FROM `okr_usr` WHERE `time`<='".time()."'");
$tie=time()-3600;
mysql_query("DELETE FROM `okr_chat` WHERE `time`<='".$tie."'");
?>