diff --git a/_incl_data/class/Insallah/Core/Math.php b/_incl_data/class/Insallah/Core/Math.php
index f9279129..83a50b3c 100644
--- a/_incl_data/class/Insallah/Core/Math.php
+++ b/_incl_data/class/Insallah/Core/Math.php
@@ -14,4 +14,13 @@ class Math
{
return min(self::getPercentage($total, $number), 100);
}
+
+ /** Number-20% and Number+20% */
+ public static function get20PercentRange($number)
+ {
+ return [
+ 'min' => $number * ((100 - 20) / 100),
+ 'max' => $number * ((100 - 20) / 100)
+ ];
+ }
}
\ No newline at end of file
diff --git a/_incl_data/class/__magic.php b/_incl_data/class/__magic.php
index 3965cb88..a4c869fd 100644
--- a/_incl_data/class/__magic.php
+++ b/_incl_data/class/__magic.php
@@ -1,2489 +1,1997 @@
1, //
- //264 => 1, //
- //306 => 1, //
- //383 => 1, //
-
- //
- //8 => 2,
- //265 => 2,
- //308 => 2, //
- //385 => 2, //
-
- //
- //7 => 3,
- //266 => 3,
- //307 => 3, //
- //384 => 3, //
-
- //
- //9 => 4,
- //267 => 4,
- //309 => 4, //
- //333 => 4,
- //405 => 4, //
-
- //
- //14 => 5,
- //27 => 5,
- //37 => 5,
- //361 => 5,
-
- //
- //10 => 6,
- //
- //12 => 7,
- //
- //13 => 8,
- //
- //11 => 9,
-
- //
- //28 => 10,
- //38 => 10,
- //362 => 10,
- //369 => 10,
-
- //
- 272 => 11,
- 370 => 11,
- //
- 334 => 12,
- 275 => 12,
- 372 => 12,
- //
- 274 => 13,
- 373 => 13,
- //
- 273 => 14,
- 374 => 14,
-
- //
- 268 => 15,
- //
- 300 => 16,
-
- 10000000000000 => 0
- );*/
-
- /* ( )
- public $pgtype_second = array(
- //
- 14 => array(6,7,8,9),
- 27 => array(6,7,8,9),
- 37 => array(6,7,8,9),
- 361 => array(6,7,8,9),
-
- //
- 10 => array(5,7,8,9),
- //
- 12 => array(6,5,8,9),
- //
- 13 => array(6,7,5,9),
- //
- 11 => array(6,7,8,5),
-
- //
- //28 => 10,
- //38 => 10,
-
- //
- 272 => array( 10 , 11 , 12 , 13 , 14 ),
- 370 => array( 10 , 11 , 12 , 13 , 14 ),
- //
- 334 => array( 10 , 11 , 12 , 13 , 14 ),
- 275 => array( 10 , 11 , 12 , 13 , 14 ),
- 372 => array( 10 , 11 , 12 , 13 , 14 ),
- //
- 274 => array( 10 , 11 , 12 , 13 , 14 ),
- 373 => array( 10 , 11 , 12 , 13 , 14 ),
- //
- 273 => array( 10 , 11 , 12 , 13 , 14 ),
- 374 => array( 10 , 11 , 12 , 13 , 14 ),
-
- //
- //268 => 15,
- //
- //300 => 16,
-
- 10000000000000 => 0
- );
-
- //
- // , , , ,
- public $pgpar = array(
- 1 => array('', 25, 29, 1.2, 's1', 301),
- 2 => array('', 25, 29, 1.2, 's2', 302),
- 3 => array('', 25, 29, 1.2, 's3', 303),
- 4 => array('', 25, 29, 1.2, 's5', 304),
-
- 5 => array(' ', 25, 175, 1.2, 'za', 321),
- 6 => array(' ', 25, 98, 1.2, 'za1', 322),
- 7 => array(' ', 25, 98, 1.2, 'za2', 323),
- 8 => array(' ', 25, 98, 1.2, 'za3', 324),
- 9 => array(' ', 25, 98, 1.2, 'za4', 325),
-
- 10 => array(' ', 25, 175, 1.2, 'zm', 326),
- 11 => array(' ', 25, 98, 1.2, 'zm1', 327),
- 12 => array(' ', 25, 98, 1.2, 'zm3', 328),
- 13 => array(' ', 25, 98, 1.2, 'zm2', 329),
- 14 => array(' ', 25, 98, 1.2, 'zm4', 330),
-
- 15 => array(' HP', 25, 294, 1.2, 'speedhp', 331),
- 16 => array(' MP', 25, 294, 1.2, 'speedmp', 332)
- );
-
- //
- public $pgel = array(
- //
- 1 => array(5), //
- 264 => array(7), //
- 306 => array(7),
- 383 => array(6),
- //
- 8 => array(5),
- 265 => array(7),
- 308 => array(7),
- 385 => array(6),
- //
- 7 => array(5),
- 266 => array(7),
- 307 => array(7),
- 384 => array(6),
- //
- 9 => array(5),
- 267 => array(7),
- 309 => array(7),
- 333 => array(5),
- 405 => array(6),
- //
- 14 => array(12),
- 27 => array(18),
- 37 => array(25),
- 361 => array(45),
- //
- 10 => array(12),
- //
- 11 => array(12),
- //
- 12 => array(12),
- //
- 13 => array(12),
- //
- 369 => array(8),
- 28 => array(18),
- 38 => array(25),
- 362 => array(45),
-
- //
- 334 => array(18), //
- //
- 272 => array(12),
- 273 => array(12),
- 274 => array(12),
- 275 => array(12),
- //
- 370 => array(20),
- 372 => array(20),
- 373 => array(20),
- 374 => array(20),
- //
- //
- 268 => array(75),
- //
- 300 => array(75)
- );
-
- //
- public $elrazgon = array( 405 => true , 383 => true , 384 => true , 385 => true );
-
- public function paguba( $eff ) {
- //global $u;
- if(isset($this->pgtype[$eff['id2']])) {
- global $u;
- $re = '';
-
- $tp = $this->pgtype[$eff['id2']];
- $tp_sec = $this->pgtype_second[$eff['id2']];
- $v = $this->pgpar[$tp];
- $el = $this->pgel[$eff['id2']];
- $pgb = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `v1` = "pgb'.$tp.'" AND `delete` = "0" AND `uid` = "'.$u->info['id'].'" ORDER BY `id` DESC LIMIT 1'));
- if( is_array($tp_sec) ) {
- $i = 0;
- while( $i < count($tp_sec) ) {
- if( $tp_sec[$i] > 0 ) {
- $pgb_ref = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `v1` = "pgb'.$tp_sec[$i].'" AND `delete` = "0" AND `uid` = "'.$u->info['id'].'" ORDER BY `id` DESC LIMIT 1'));
- if( isset($pgb_ref['id']) ) {
- $lvl = explode('[',$pgb['name']);
- $lvl = explode(']',$lvl[1]);
- $lvl = $lvl[0];
- mysql_query('UPDATE `eff_users` SET `deactiveTime` = "'.(time()+$eff['actionTime']).'", `timeUse` = "'.(time()+floor($lvl*$this->pgpar[$tp_sec[$i]][3]*86400)).'" WHERE `id` = "'.$pgb_ref['id'].'" LIMIT 1');
- }
- }
- $i++;
- }
- unset($pgb_ref,$i);
- }
- if(!isset($pgb['id'])) {
- // , , 10%
- $prc11 = 5;
- if( $this->elrazgon[$eff['id2']] == true ) {
- $prc11 = 101;
- }
- if(rand(0,100) < $prc11) {
- //
- $d = 'add_'.$v[4].'=-'.ceil($v[2]/$v[1]*1);
- mysql_query('INSERT INTO `eff_users` (`v1`,`overType`,`id_eff`,`uid`,`name`,`timeUse`,`data`,`no_Ace`,`deactiveTime`) VALUES ("pgb'.$tp.'","0","'.$v[5].'","'.$u->info['id'].'"," [1]","'.(time()+floor($v[3]*86400)).'","'.$d.'","0","'.(time()+$eff['actionTime']).'")');
- }
- }else{
- $lvl = explode('[',$pgb['name']);
- $lvl = explode(']',$lvl[1]);
- $lvl = $lvl[0];
- $prc11 = 7;
- if( $this->elrazgon[$eff['id2']] == true ) {
- $prc11 = 101;
- }
- // 5% , 75%
- if(rand(0,100) < $prc11 && $lvl < $v[1]) {
- //
- $lvl++;
- $d = 'add_'.$v[4].'=-'.ceil($v[2]/$v[1]*$lvl);
- mysql_query('DELETE FROM `eff_users` WHERE `id` = "'.$pgb['id'].'" LIMIT 1');
- mysql_query('INSERT INTO `eff_users` (`v1`,`overType`,`id_eff`,`uid`,`name`,`timeUse`,`data`,`no_Ace`,`deactiveTime`) VALUES ("pgb'.$tp.'","0","'.$v[5].'","'.$u->info['id'].'"," ['.$lvl.']","'.(time()+floor($lvl*$v[3]*86400)).'","'.$d.'","0","'.(time()+$eff['actionTime']).'")');
- $pgb = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `v1` = "pgb'.$tp.'" AND `delete` = "0" AND `uid` = "'.$u->info['id'].'" RODER BY `id` DESC LIMIT 1'));
- }else{
- //
- mysql_query('UPDATE `eff_users` SET `deactiveTime` = "'.(time()+$eff['actionTime']).'", `timeUse` = "'.(time()+floor($lvl*$v[3]*86400)).'" WHERE `id` = "'.$pgb['id'].'" LIMIT 1');
- }
-
-
- //
- $eff['mdata'] = $u->lookStats($eff['mdata']);
- $eff['mdata']['add_'.$v[4]] += floor($el[0]/$v[1]*$lvl);
- $eff['mdata'] = $u->impStats($eff['mdata']);
- }
- }
- return $eff;
- }*/
+class Magic
+{
+ public $youuse = 0;
+ public $c_magic = [4174, 4175, 4176, 4177, 4178, 4179, 4180];
+ public $e_magic = [4185, 4186, 4187];
+ public function inBattleLog($txt, $usr = null)
+ {
+ global $u;
+ $lastHOD = mysql_fetch_array(mysql_query('SELECT * FROM `battle_logs` WHERE `battle` = "' . $u->info['battle'] . '" ORDER BY `id_hod` DESC LIMIT 1'));
+ if (isset($lastHOD['id'])) {
+ $id_hod = $lastHOD['id_hod'];
+ if ($lastHOD['type'] != 6) {
+ $id_hod++;
+ }
+ mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . time() . '","' . $u->info['battle'] . '","' . ($id_hod) . '","{tm1} ' . $txt . '","login1=' . $u->info['login'] . '||t1=' . $u->info['team'] . '||login2=' . $usr['login'] . '||t2=' . $usr['team'] . '||time1=' . time() . '","","","","","6")');
+ }
+ }
+ //Использование предмета
+ public function useItems($id)
+ {
+ global $u, $c, $code, $btl, $e_magic, $c_magic;
+ $itm = mysql_fetch_array(mysql_query('SELECT `iu`.`id` AS `iuid`,`im`.*,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`uid` = "' . $u->info['id'] . '" AND `iu`.`inShop`="0" AND `iu`.`delete`="0" AND `iu`.`id` = "' . mysql_real_escape_string((int)$id) . '" LIMIT 1'));
+ $bs_is = mysql_fetch_array(mysql_query('SELECT * FROM `bs_turnirs` WHERE `id` = "' . $u->info['inTurnir'] . '" LIMIT 1'));
+ if (isset($itm['id'])) {
- public function inBattleLog($txt,$usr=NULL) {
- global $u;
- $lastHOD = mysql_fetch_array(mysql_query('SELECT * FROM `battle_logs` WHERE `battle` = "'.$u->info['battle'].'" ORDER BY `id_hod` DESC LIMIT 1'));
- if(isset($lastHOD['id'])) {
- $id_hod = $lastHOD['id_hod'];
- if($lastHOD['type']!=6) {
- $id_hod++;
- }
- mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("'.time().'","'.$u->info['battle'].'","'.($id_hod).'","{tm1} '.$txt.'","login1='.$u->info['login'].'||t1='.$u->info['team'].'||login2='.$usr['login'].'||t2='.$usr['team'].'||time1='.time().'","","","","","6")');
- }
- }
-
-
-
- //
- public function useItems($id)
- {
- global $u, $c, $code, $btl, $e_magic, $c_magic;
-
- $itm = mysql_fetch_array(mysql_query('SELECT `iu`.`id` AS `iuid`,`im`.*,`iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`uid` = "'.$u->info['id'].'" AND `iu`.`inShop`="0" AND `iu`.`delete`="0" AND `iu`.`id` = "'.mysql_real_escape_string((int)$id).'" LIMIT 1'));
- $bs_is = mysql_fetch_array(mysql_query('SELECT * FROM `bs_turnirs` WHERE `id` = "'.$u->info['inTurnir'].'" LIMIT 1'));
- if(isset($itm['id']))
- {
-
- if($itm['group'] == 1) {
- //
- if($u->itemsX($itm['id'])>1) {
- //
- $u->unstack($itm['id'],1);
- /*$itm = mysql_fetch_array(mysql_query('SELECT `iu`.`id` AS `iuid`,`im`.*, `iu`.* FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`item_id`) WHERE `iu`.`inOdet`="0" AND `iu`.`inShop`="0" AND `iu`.`delete`="1000" AND `iu`.`inGroup` = "'.$itm['id'].'" LIMIT 1'));
- if(!isset($itm['id'])) {
- $this->error = ' ...';
- }else{
- $itm['delete'] = 0;
- }*/
- }
- }
-
- $st = $u->lookStats($itm['data']);
-
- if (isset($st['tr_lvl']) && $st['tr_lvl']> $u->info['level'])
- {
- $u->error = ' ';
- $err=' ';
- return $err;
- }
-
- if($itm['magic_chance'] > 0 && $itm['magic_chance'] < 100) {
- $itm['magic_chance'] += floor($u->stats['s5']*3);
- if($itm['magic_chance'] >= 99) { $itm['magic_chance'] = 99; }
- }
- if(isset($bs_is['id'])) {
- if(in_array($itm['item_id'], $e_magic) || in_array($itm['item_id'], $c_magic)) {
- $itm['magic_chance'] += $bs_is['users'];
- if($itm['magic_chance'] >= 99) { $itm['magic_chance'] = 99; }
- }
+ if ($itm['group'] == 1) {
+ //Группа предметов
+ if ($u->itemsX($itm['id']) > 1) {
+ //вытаскиваем предмет из группы
+ $u->unstack($itm['id'], 1);
+ }
}
- if($itm['iznosNOW'] >= $itm['iznosMAX']) {
- $u->error = ' ...';
- }elseif( $st['useOnlyInBattle'] == 1 && $u->info['battle'] == 0 ) {
- //
- $u->error = ' ';
- }elseif( $u->info['battle'] > 0 && $itm['btl_zd'] > 0 ) {
- //
- $u->error = ' '.$itm['btl_zd'].' ';
- }elseif( $st['useOnlyInBattle'] == 1 && $u->info['battle'] > 0 && $u->stats['hpNow'] < 1 ) {
- //
- $u->error = ' , ';
- } elseif($itm['magic_chance'] > 0 && rand(0, 100) > $itm['magic_chance']) {
+ $st = $u->lookStats($itm['data']);
+
+ if (isset($st['tr_lvl']) && $st['tr_lvl'] > $u->info['level']) {
+ $u->error = 'Вы слишком малы чтобы использовать данный предмет ';
+ $err = 'Вы слишком малы чтобы использовать данный предмет';
+ return $err;
+ }
+
+ if ($itm['magic_chance'] > 0 && $itm['magic_chance'] < 100) {
+ $itm['magic_chance'] += floor($u->stats['s5'] * 3);
+ if ($itm['magic_chance'] >= 99) {
+ $itm['magic_chance'] = 99;
+ }
+ }
+ if (isset($bs_is['id'])) {
+ if (in_array($itm['item_id'], $e_magic) || in_array($itm['item_id'], $c_magic)) {
+ $itm['magic_chance'] += $bs_is['users'];
+ if ($itm['magic_chance'] >= 99) {
+ $itm['magic_chance'] = 99;
+ }
+ }
+ }
+
+ if ($itm['iznosNOW'] >= $itm['iznosMAX']) {
+ $u->error = 'Не осталось зарядов...';
+ } elseif ($st['useOnlyInBattle'] == 1 && $u->info['battle'] == 0) {
+ //Можно использовать только в поединке
+ $u->error = 'Можно использовать только в поединке';
+ } elseif ($u->info['battle'] > 0 && $itm['btl_zd'] > 0) {
+ //Можно использовать только в поединке
+ $u->error = 'Задержка использования еще ' . $itm['btl_zd'] . ' ходов';
+ } elseif ($st['useOnlyInBattle'] == 1 && $u->info['battle'] > 0 && $u->stats['hpNow'] < 1) {
+ //Можно использовать только в поединке
+ $u->error = 'Вы погибли, нельзя пользоваться свитками и магией';
+ } elseif ($itm['magic_chance'] > 0 && rand(0, 100) > $itm['magic_chance']) {
- $u->error = ' "'.$itm['name'].'" ';
- $itm['iznosNOW']++;
- if($itm['inGroup'] > 0 && $itm['delete'] == 0) {
- mysql_query('UPDATE `items_users` SET `inGroup` = 0, `delete` = 0 WHERE `id` = "'.$itm['id'].'" LIMIT 1');
- }
- mysql_query('UPDATE `items_users` SET `iznosNOW` = "'.$itm['iznosNOW'].'" WHERE `id` = "'.$itm['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1');
- $u->addDelo(1, $u->info['id'],'"System.inventory":( ) "'.$itm['name'].'" ('.$us[1].') [itm:'.$itm['id'].'].',time(),$u->info['city'],'System.inventory',0,0);
-
- } elseif(isset($st['usefromfile'])) {
-
- //
- $st = $u->lookStats($itm['data']);
- if( isset($st['zazuby']) && $_GET['login'] != $u->info['login'] ) {
- //unset($st['useOnLogin']);
- $_GET['login'] = $u->info['login'];
- }
- $jl = $_GET['login'];
- $_GET['login'] = urlencode($_GET['login']);
- // ( )
- $_GET['login'] = str_replace('%',' ',$_GET['login']);
- $_GET['login'] = str_replace('25','',$_GET['login']);
- $jl = str_replace('%',' ',$jl);
- $jl = str_replace('25','',$jl);
-
- if(isset($st['useOnLogin']) && $st['useOnLogin']==1) {
- if( $u->info['inTurnir'] == 0 ) {
- if( $u->info['battle'] > 0 ) {
- $usr = mysql_fetch_array(mysql_query('SELECT `st`.`atack`, `st`.`clone`, `u`.`bot_id`, `u`.`type_pers`,`u`.`inTurnir`,`st`.`zv`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "'.$u->info['city'].'" AND `u`.`battle` = "'.$u->info['battle'].'" AND (`u`.`login`="'.mysql_real_escape_string($_GET['login']).'" OR `u`.`login`="'.mysql_real_escape_string($jl).'") LIMIT 1'));
- }else{
- $usr = mysql_fetch_array(mysql_query('SELECT `st`.`atack`, `st`.`clone`, `u`.`bot_id`, `u`.`type_pers`,`u`.`inTurnir`,`st`.`zv`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "'.$u->info['city'].'" AND (`u`.`login`="'.mysql_real_escape_string($_GET['login']).'" OR `u`.`login`="'.mysql_real_escape_string($jl).'") LIMIT 1'));
- }
- }else{
- if( $u->info['battle'] > 0 ) {
- $usr = mysql_fetch_array(mysql_query('SELECT `st`.`atack`,`st`.`clone`,`u`.`bot_id`,`u`.`type_pers`,`u`.`inTurnir`,`st`.`zv`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "'.$u->info['city'].'" AND `u`.`battle` = "'.$u->info['battle'].'" AND (`u`.`login`="'.mysql_real_escape_string($_GET['login']).'" OR `u`.`login`="'.mysql_real_escape_string($jl).'") AND `u`.`inTurnir` > 0 LIMIT 1'));
- }else{
- $usr = mysql_fetch_array(mysql_query('SELECT `st`.`atack`,`st`.`clone`,`u`.`bot_id`,`u`.`type_pers`,`u`.`inTurnir`,`st`.`zv`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "'.$u->info['city'].'" AND (`u`.`login`="'.mysql_real_escape_string($_GET['login']).'" OR `u`.`login`="'.mysql_real_escape_string($jl).'") AND `u`.`inTurnir` > 0 LIMIT 1'));
- }
- }
- }
-
- if($st['usefromfile']==1) {
- if($u->info['battle'] > 0) {
- if(file_exists('../../_incl_data/class/magic/'.$itm['magic_inci'].'.php'))
- {
- require('../../_incl_data/class/magic/'.$itm['magic_inci'].'.php');
- }else{
- $u->error = ' ('.$itm['magic_inci'].'.b)';
- }
- }else{
- if(file_exists('_incl_data/class/magic/'.$itm['magic_inci'].'.php'))
- {
- require('_incl_data/class/magic/'.$itm['magic_inci'].'.php');
- }else{
- $u->error = ' ('.$itm['magic_inci'].')';
- }
- }
- }else{
- if($itm['useInBattle'] > 0) {
- if(file_exists('../../_incl_data/class/priems/'.$st['usefromfile'].'.php'))
- {
- require('../../_incl_data/class/priems/'.$st['usefromfile'].'.php');
- }else{
- $u->error = ' ('.$st['usefromfile'].'.)';
- }
- }else{
- $u->error = ' ('.$st['usefromfile'].'!)';
- }
- }
- }elseif($itm['type']==30)
- {
- //
- $goodUse = 0; $use = array();
- if(isset($st['moment']))
- {
- // ( )
- if(isset($st['moment_hp'])) {
- //
- if($u->stats['hpNow']<$u->stats['hpAll']) {
- $goodUse = 1;
- $use['moment_hp'] = $st['moment_hp'];
-
- if($u->stats['hpNow']+$use['moment_hp']>$u->stats['hpAll']) {
- $use['moment_hp'] = ceil($u->stats['hpAll']-$u->stats['hpNow']);
- }
-
- $u->error .= ' '.($use['moment_hp']).' HP.
';
- }else{
- $u->error = '
';
- $goodUse = 0;
- }
- }
-
- if(isset($st['moment_mp'])) {
- //
- if($u->stats['mpNow'] < $u->stats['mpAll']) {
- $goodUse = 1;
- $use['moment_mp'] = $st['moment_mp'];
- if($u->stats['mpNow']+$use['moment_mp'] > $u->stats['mpAll']) {
- $use['moment_mp'] = ceil($u->stats['mpAll']-$u->stats['mpNow']);
- }
- $u->error .= ' '.($use['moment_mp']).' MP.
';
- } else {
- $u->error = ' ';
- $goodUse = 0;
- }
- }
-
- if($itm['iznosNOW']>=$itm['iznosMAX'])
- {
- $u->error = ' ...';
- $goodUse = 0;
- }
-
- if(($u->info['align']==2 || $u->info['haos']>time()) && isset($st['nohaos']))
- {
- $goodUse = 0;
- $u->error = ' ';
- }
-
- //
- if($goodUse==1)
- {
- $itm['iznosNOW']++;
- $upd = mysql_query('UPDATE `items_users` SET `iznosNOW` = "'.$itm['iznosNOW'].'" WHERE `id` = "'.$itm['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1');
- if($upd) {
- $u->stats['hpNow'] += $use['moment_hp'];
- $u->info['hpNow'] += $use['moment_hp'];
- $u->stats['mpNow'] += $use['moment_mp'];
- $u->info['mpNow'] += $use['moment_mp'];
- if($itm['inGroup'] > 0 && $itm['delete'] == 0) {
- mysql_query('UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "'.$itm['id'].'" LIMIT 1');
- }
- mysql_query('UPDATE `stats` SET `hpNow` = "'.$u->info['hpNow'].'", `mpNow` = "'.$u->info['mpNow'].'" WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
- $u->addDelo(1,$u->info['id'],'"System.inventory": "'.$itm['name'].'" (+'.$use['moment_hp'].' HP) [itm:'.$itm['id'].'].',time(),$u->info['city'],'System.inventory',0,0);
- $this->youuse++;
- $u->error = ' "'.$itm['name'].'"
'.$u->error.'';
- }else{
- $u->error = ' ...';
- }
- }
- }else{
- //
- $goodUse = 1;
- if(($u->info['align']==2 || $u->info['haos']>time()) && isset($st['nohaos']))
- {
- $goodUse = 0;
- $u->error = ' ';
- }
- if($goodUse==1)
- {
- $upd1 = 1;
- $upd2 = 1;
- //
- if(isset($st['onlyOne']))
- {
- //
- $goodUse = 0;
- $upd1 = mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$u->info['id'].'" AND `delete` = "0" AND `id_eff` = "'.$itm['magic_inc'].'"');
- if($upd1)
- {
- $goodUse = 1;
- }
- }
- if(isset($st['oneType']))
- {
- //
- $goodUse = 0;
- $upd2 = mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `uid` = "'.$u->info['id'].'" AND `delete` = "0" AND `overType` = "'.$itm['overType'].'"');
- if($upd1)
- {
- $goodUse = 1;
- }
- }
- if($goodUse == 1)
- {
- $us = $this->add_eff($u->info['id'],$itm['magic_inc']);
- if($us[0]==1)
- {
- $itm['iznosNOW']++;
- if($itm['inGroup'] > 0 && $itm['delete'] == 0) {
- mysql_query('UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "'.$itm['id'].'" LIMIT 1');
- }
- mysql_query('UPDATE `items_users` SET `iznosNOW` = "'.$itm['iznosNOW'].'" WHERE `id` = "'.$itm['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1');
- $u->addDelo(1,$u->info['id'],'"System.inventory": "'.$itm['name'].'" ('.$us[1].') [itm:'.$itm['id'].'].',time(),$u->info['city'],'System.inventory',0,0);
- $this->youuse++;
- $u->error = ' "'.$itm['name'].'"
'.$us[1].'';
- }else{
- $u->error = ' "'.$itm['name'].'"';
- }
- }else{
- $u->error = ' "'.$itm['name'].'"';
- }
- }
- }
- //---------------
- }elseif($itm['type']==29)
- {
- //
- $st = $u->lookStats($itm['data']);
- if( isset($st['zazuby']) && $_GET['login'] != $u->info['login'] ) {
- //unset($st['useOnLogin']);
- $_GET['login'] = $u->info['login'];
- }
- $jl = $_GET['login'];
- $_GET['login'] = urlencode($_GET['login']);
- // ( )
- $_GET['login'] = str_replace('%',' ',$_GET['login']);
- $_GET['login'] = str_replace('25','',$_GET['login']);
- $jl = str_replace('%',' ',$jl);
- $jl = str_replace('25','',$jl);
- if($itm['magic_inci']=='nextuplvl') {
- if($itm['iznosNOW']>=$itm['iznosMAX']) {
- $u->error = ' ...';
- }elseif( $u->info['battle'] > 0 ) {
- //
- $u->error = ' ';
- }else{
- if( $u->info['twink'] > 0 ) {
- $u->error = ' ';
- }else{
- mysql_query('UPDATE `users` SET `stopexp` = 0 WHERE `id` = "'.$u->info['id'].'" LIMIT 1');
- mysql_query('UPDATE `users_twink` SET `stopexp` = 0 WHERE `uid` = "'.$u->info['id'].'" LIMIT 1');
- $itm['iznosNOW']++;
- if($itm['inGroup'] > 0 && $itm['delete'] == 0) {
- mysql_query('UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "'.$itm['id'].'" LIMIT 1');
- }
- mysql_query('UPDATE `items_users` SET `iznosNOW` = "'.$itm['iznosNOW'].'" WHERE `id` = "'.$itm['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1');
- }
- }
- }elseif(isset($st['useOnLogin']) && $st['useOnLogin']==1)
- {
- if( $u->info['inTurnir'] == 0 ) {
- if( $u->info['battle'] > 0 ) {
- $usr = mysql_fetch_array(mysql_query('SELECT `st`.`atack`, `st`.`clone`, `u`.`bot_id`, `u`.`type_pers`,`u`.`inTurnir`,`st`.`zv`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "'.$u->info['city'].'" AND `u`.`battle` = "'.$u->info['battle'].'" AND (`u`.`login`="'.mysql_real_escape_string($_GET['login']).'" OR `u`.`login`="'.mysql_real_escape_string($jl).'") LIMIT 1'));
- }else{
- $usr = mysql_fetch_array(mysql_query('SELECT `st`.`atack`, `st`.`clone`, `u`.`bot_id`, `u`.`type_pers`,`u`.`inTurnir`,`st`.`zv`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "'.$u->info['city'].'" AND (`u`.`login`="'.mysql_real_escape_string($_GET['login']).'" OR `u`.`login`="'.mysql_real_escape_string($jl).'") LIMIT 1'));
- }
- }else{
- if( $u->info['battle'] > 0 ) {
- $usr = mysql_fetch_array(mysql_query('SELECT `st`.`atack`,`st`.`clone`,`u`.`bot_id`,`u`.`type_pers`,`u`.`inTurnir`,`st`.`zv`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "'.$u->info['city'].'" AND `u`.`battle` = "'.$u->info['battle'].'" AND (`u`.`login`="'.mysql_real_escape_string($_GET['login']).'" OR `u`.`login`="'.mysql_real_escape_string($jl).'") AND `u`.`inTurnir` > 0 LIMIT 1'));
- }else{
- $usr = mysql_fetch_array(mysql_query('SELECT `st`.`atack`,`st`.`clone`,`u`.`bot_id`,`u`.`type_pers`,`u`.`inTurnir`,`st`.`zv`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "'.$u->info['city'].'" AND (`u`.`login`="'.mysql_real_escape_string($_GET['login']).'" OR `u`.`login`="'.mysql_real_escape_string($jl).'") AND `u`.`inTurnir` > 0 LIMIT 1'));
- }
- }
- if(isset($usr['id']))
- {
- //
- if($itm['iznosNOW']>=$itm['iznosMAX'])
- {
- $u->error = ' ...';
- }elseif($itm['magic_inci']=='snowball')
- {
- if( $u->info['battle'] == 0 ) {
- $usr = mysql_fetch_array(mysql_query('SELECT `st`.`clone`,`u`.`type_pers`,`u`.`bot_id`,`st`.`zv`,`u`.`inTurnir`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "'.$u->info['city'].'" AND (`u`.`battle` = 0 OR `u`.`battle` = "'.$u->info['battle'].'") AND (`u`.`login`="'.mysql_real_escape_string($_GET['login']).'" OR `u`.`login`="'.mysql_real_escape_string($jl).'") LIMIT 1'));
- }else{
- $usr = mysql_fetch_array(mysql_query('SELECT `st`.`clone`,`u`.`type_pers`,`u`.`bot_id`,`st`.`zv`,`u`.`inTurnir`,`st`.`bot`,`st`.`hpNow`,`u`.`login`,`st`.`dnow`,`u`.`id`,`u`.`align`,`u`.`admin`,`u`.`clan`,`u`.`level`,`u`.`room`,`u`.`online`,`u`.`battle`,`st`.`team` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`city` = "'.$u->info['city'].'" AND (`u`.`battle` = 0 OR `u`.`battle` = "'.$u->info['battle'].'") AND (`u`.`login`="'.mysql_real_escape_string($_GET['login']).'" OR `u`.`login`="'.mysql_real_escape_string($jl).'") AND `u`.`battle` = "'.$u->info['battle'].'" LIMIT 1'));
- }
- if($usr['battle']>0 && $u->info['battle']!=$usr['battle'])
- {
- $u->error = ' ';
- }elseif($usr['battle']>0) {
- //
- if($usr['team'] != $u->info['team'] && $usr['hpNow'] > 0) {
- $txt = 1;
-
- //
- if($usr['bot_id'] >= 439 && $usr['bot_id'] <= 460) {
- $txt = 500;
- }elseif($usr['bot_id'] == 291 ) {
- if($usr['hpNow'] < 961) {
- $txt = 1982;
- }elseif($usr['hpNow'] > 980 && $usr['hpNow'] < 1981) {
- $txt = 1982;
- }
- }elseif($usr['id'] == 1008 ) {
- $txt = $u->info['level']*250;
- }
-
- $usr['hpNow'] -= $txt;
- if($txt<0) {
- $txt = '+'.$txt;
- }elseif($txt==0) {
- $txt = '--';
- }else{
- $txt = '-'.$txt;
- }
- if($usr['hpNow']<0)
- {
- $usr['hpNow'] = 0;
- }
- $btl->stats[$btl->uids[$usr['id']]]['hpNow'] = $usr['hpNow'];
- $lastHOD = mysql_fetch_array(mysql_query('SELECT * FROM `battle_logs` WHERE `battle` = "'.$u->info['battle'].'" ORDER BY `id_hod` DESC LIMIT 1'));
- if(isset($lastHOD['id']))
- {
- $btl->stats[$btl->uids[$usr['id']]]['hpNow'] = floor($btl->stats[$btl->uids[$usr['id']]]['hpNow']);
- if($btl->stats[$btl->uids[$usr['id']]]['hpNow'] > $btl->stats[$btl->uids[$usr['id']]]['hpAll']) {
- $btl->stats[$btl->uids[$usr['id']]]['hpNow'] = $btl->stats[$btl->uids[$usr['id']]]['hpAll'];
- }
- if($btl->stats[$btl->uids[$usr['id']]]['hpNow'] < 1) {
- $btl->stats[$btl->uids[$usr['id']]]['hpNow'] = 0;
- }
- $id_hod = $lastHOD['id_hod'];
- if($lastHOD['type']!=6)
- {
- $id_hod++;
- }
- mysql_query('UPDATE `stats` SET `hpNow` = "'.$btl->stats[$btl->uids[$usr['id']]]['hpNow'].'" WHERE `id` = "'.$usr['id'].'" LIMIT 1');
- $itm['iznosNOW']++;
- if($itm['inGroup'] > 0 && $itm['delete'] == 0) {
- mysql_query('UPDATE `items_users` SET `inGroup` = "0", `delete` = "0" WHERE `id` = "'.$itm['id'].'" LIMIT 1');
- }
- mysql_query('UPDATE `items_users` SET `iznosNOW` = "'.$itm['iznosNOW'].'" WHERE `id` = "'.$itm['id'].'" AND `uid` = "'.$u->info['id'].'" LIMIT 1');
- $txt = ''.$txt.'';
- if($u->info['sex']==1) {
- $txt = ' {u1} {u2}. '.$txt.' ['.$btl->stats[$btl->uids[$usr['id']]]['hpNow'].'/'.$btl->stats[$btl->uids[$usr['id']]]['hpAll'].']';
- }else{
- $txt = ' {u1} {u2}. '.$txt.' ['.$btl->stats[$btl->uids[$usr['id']]]['hpNow'].'/'.$btl->stats[$btl->uids[$usr['id']]]['hpAll'].']';
- }
- mysql_query('INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("'.time().'","'.$u->info['battle'].'","'.($id_hod).'","{tm1} '.$txt.'","login1='.$u->info['login'].'||t1='.$u->info['team'].'||login2='.$usr['login'].'||t2='.$usr['team'].'||time1='.time().'","","","","","6")');
- }
-
- unset($txt);
- }else{
- $u->error = ' ';
- }
- }elseif($u->info['dnow']!=$usr['dnow'])
- {
- $u->error = ' ';
- }elseif($usr['id']==$u->info['id'])
- {
- $u->error = ' ';
- }elseif($usr['online']