rename dir

This commit is contained in:
Ivor Barhansky 2023-08-11 18:28:54 +03:00
parent e359eb6f40
commit e5c7ff4a33
93 changed files with 86 additions and 127 deletions

View File

@ -3,13 +3,14 @@
use Core\ConversionHelper; use Core\ConversionHelper;
use Core\Db; use Core\Db;
use Insallah\Math; use Insallah\Math;
use User\ItemsModel;
class Magic class Magic
{ {
public $youuse = 0; public int $youuse = 0;
public $c_magic = [4174, 4175, 4176, 4177, 4178, 4179, 4180]; public array $cMagic = [4174, 4175, 4176, 4177, 4178, 4179, 4180];
public $e_magic = [4185, 4186, 4187]; public array $eMagic = [4185, 4186, 4187];
public function __construct() public function __construct()
{ {
@ -54,8 +55,8 @@ class Magic
$itm['magic_chance'] = 99; $itm['magic_chance'] = 99;
} }
} }
if (isset($bs_is['id']) && (in_array($itm['item_id'], $this->e_magic) || in_array( if (isset($bs_is['id']) && (in_array($itm['item_id'], $this->eMagic) || in_array(
$itm['item_id'], $this->c_magic $itm['item_id'], $this->cMagic
))) { ))) {
$itm['magic_chance'] += $bs_is['users']; $itm['magic_chance'] += $bs_is['users'];
if ($itm['magic_chance'] >= 99) { if ($itm['magic_chance'] >= 99) {
@ -155,14 +156,14 @@ class Magic
if ($st['usefromfile'] == 1) { if ($st['usefromfile'] == 1) {
if ($u->info['battle'] > 0) { if ($u->info['battle'] > 0) {
if (file_exists('../../_incl_data/class/magic/' . $itm['magic_inci'] . '.php')) { if (file_exists('../../_incl_data/class/Magic/' . $itm['magic_inci'] . '.php')) {
require('../../_incl_data/class/magic/' . $itm['magic_inci'] . '.php'); require('../../_incl_data/class/Magic/' . $itm['magic_inci'] . '.php');
} else { } else {
$u->error = 'Не удалось использовать (' . $itm['magic_inci'] . '.b)'; $u->error = 'Не удалось использовать (' . $itm['magic_inci'] . '.b)';
} }
} else { } else {
if (file_exists('_incl_data/class/magic/' . $itm['magic_inci'] . '.php')) { if (file_exists('_incl_data/class/Magic/' . $itm['magic_inci'] . '.php')) {
require('_incl_data/class/magic/' . $itm['magic_inci'] . '.php'); require('_incl_data/class/Magic/' . $itm['magic_inci'] . '.php');
} else { } else {
$u->error = 'Не удалось использовать (' . $itm['magic_inci'] . ')'; $u->error = 'Не удалось использовать (' . $itm['magic_inci'] . ')';
} }
@ -271,8 +272,7 @@ class Magic
//убираем прошлые эффекты //убираем прошлые эффекты
$goodUse = 0; $goodUse = 0;
$upd1 = mysql_query( $upd1 = mysql_query(
'UPDATE `eff_users` SET `delete` = "' . time( 'UPDATE `eff_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $u->info['id'] . '" AND `delete` = "0" AND `id_eff` = "' . $itm['magic_inc'] . '"'
) . '" WHERE `uid` = "' . $u->info['id'] . '" AND `delete` = "0" AND `id_eff` = "' . $itm['magic_inc'] . '"'
); );
if ($upd1) { if ($upd1) {
$goodUse = 1; $goodUse = 1;
@ -282,8 +282,7 @@ class Magic
//убираем прошлые эффекты //убираем прошлые эффекты
$goodUse = 0; $goodUse = 0;
$upd2 = mysql_query( $upd2 = mysql_query(
'UPDATE `eff_users` SET `delete` = "' . time( 'UPDATE `eff_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $u->info['id'] . '" AND `delete` = "0" AND `overType` = "' . $itm['overType'] . '"'
) . '" WHERE `uid` = "' . $u->info['id'] . '" AND `delete` = "0" AND `overType` = "' . $itm['overType'] . '"'
); );
if ($upd1) { if ($upd1) {
$goodUse = 1; $goodUse = 1;
@ -501,9 +500,7 @@ class Magic
$txt = 'Хитрый {u1} бросил кусок снега в {u2}. <b>' . $txt . '</b> [' . $btl->stats[$btl->uids[$usr['id']]]['hpNow'] . '/' . $btl->stats[$btl->uids[$usr['id']]]['hpAll'] . ']'; $txt = 'Хитрый {u1} бросил кусок снега в {u2}. <b>' . $txt . '</b> [' . $btl->stats[$btl->uids[$usr['id']]]['hpNow'] . '/' . $btl->stats[$btl->uids[$usr['id']]]['hpAll'] . ']';
} }
mysql_query( mysql_query(
'INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . time( '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")'
) . '","' . $u->info['battle'] . '","' . ($id_hod) . '","{tm1} ' . $txt . '","login1=' . $u->info['login'] . '||t1=' . $u->info['team'] . '||login2=' . $usr['login'] . '||t2=' . $usr['team'] . '||time1=' . time(
) . '","","","","","6")'
); );
} }
@ -693,8 +690,7 @@ class Magic
mysql_query( mysql_query(
'INSERT INTO `spells` (`btl`,`uid`,`time`,`item_id`,`var`,`hod`) VALUES ( 'INSERT INTO `spells` (`btl`,`uid`,`time`,`item_id`,`var`,`hod`) VALUES (
"' . $u->info['battle'] . '","' . $u->info['id'] . '","' . time( "' . $u->info['battle'] . '","' . $u->info['id'] . '","' . time() . '","' . $itm['item_id'] . '","' . $itm['name'] . '","1"
) . '","' . $itm['item_id'] . '","' . $itm['name'] . '","1"
)' )'
); );
@ -767,9 +763,7 @@ class Magic
} }
} }
mysql_query( mysql_query(
'INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . time( '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")'
) . '","' . $u->info['battle'] . '","' . ($id_hod) . '","{tm1} ' . $txt . '","login1=' . $u->info['login'] . '||t1=' . $u->info['team'] . '||login2=' . $usr['login'] . '||t2=' . $usr['team'] . '||time1=' . time(
) . '","","","","","6")'
); );
} }
} }
@ -854,8 +848,7 @@ class Magic
mysql_query( mysql_query(
'INSERT INTO `spells` (`btl`,`uid`,`time`,`item_id`,`var`,`hod`) VALUES ( 'INSERT INTO `spells` (`btl`,`uid`,`time`,`item_id`,`var`,`hod`) VALUES (
"' . $u->info['battle'] . '","' . $u->info['id'] . '","' . time( "' . $u->info['battle'] . '","' . $u->info['id'] . '","' . time() . '","' . $itm['item_id'] . '","' . $itm['name'] . '","1"
) . '","' . $itm['item_id'] . '","' . $itm['name'] . '","1"
)' )'
); );
@ -926,9 +919,7 @@ class Magic
} }
} }
mysql_query( mysql_query(
'INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . time( '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")'
) . '","' . $u->info['battle'] . '","' . ($id_hod) . '","{tm1} ' . $txt . '","login1=' . $u->info['login'] . '||t1=' . $u->info['team'] . '||login2=' . $usr['login'] . '||t2=' . $usr['team'] . '||time1=' . time(
) . '","","","","","6")'
); );
} }
} }
@ -1065,8 +1056,7 @@ class Magic
$u->error = 'Вы уже один из лекарей'; $u->error = 'Вы уже один из лекарей';
} elseif ($lech_co >= $lech_aa[$type_lechenie]) { } elseif ($lech_co >= $lech_aa[$type_lechenie]) {
mysql_query( mysql_query(
'UPDATE `eff_users` SET `delete` = "' . time( 'UPDATE `eff_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $travm['id'] . '" LIMIT 1'
) . '" WHERE `id` = "' . $travm['id'] . '" LIMIT 1'
); );
$itm['iznosNOW']++; $itm['iznosNOW']++;
mysql_query( mysql_query(
@ -1090,8 +1080,7 @@ class Magic
//mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `id` = "'.$travm_cep['id'].'" LIMIT 1'); //mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `id` = "'.$travm_cep['id'].'" LIMIT 1');
mysql_query( mysql_query(
'UPDATE `eff_users` SET `delete` = "' . time( 'UPDATE `eff_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $usr['id'] . '" AND `id_eff` = 4 AND `delete` = 0 LIMIT 1'
) . '" WHERE `uid` = "' . $usr['id'] . '" AND `id_eff` = 4 AND `delete` = 0 LIMIT 1'
); );
// сообщение в чат // сообщение в чат
@ -1121,8 +1110,7 @@ class Magic
( (
`id_eff`,`uid`,`name`,`data`,`overType`,`timeUse`,`user_use`,`v1`,`x` `id_eff`,`uid`,`name`,`data`,`overType`,`timeUse`,`user_use`,`v1`,`x`
) VALUES ( ) VALUES (
"335","' . $usr['id'] . '","Цепь исцеления","' . $u->info['id'] . '","28","' . time( "335","' . $usr['id'] . '","Цепь исцеления","' . $u->info['id'] . '","28","' . time() . '","' . $u->info['id'] . '","' . $type_lechenie . '","1"
) . '","' . $u->info['id'] . '","' . $type_lechenie . '","1"
)' )'
); );
} }
@ -1229,8 +1217,7 @@ class Magic
$u->error = 'Вы уже один из лекарей'; $u->error = 'Вы уже один из лекарей';
} elseif ($lech_co >= $lech_aa[$type_lechenie]) { } elseif ($lech_co >= $lech_aa[$type_lechenie]) {
mysql_query( mysql_query(
'UPDATE `eff_users` SET `delete` = "' . time( 'UPDATE `eff_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $travm['id'] . '" LIMIT 1'
) . '" WHERE `id` = "' . $travm['id'] . '" LIMIT 1'
); );
$itm['iznosNOW']++; $itm['iznosNOW']++;
mysql_query( mysql_query(
@ -1243,8 +1230,7 @@ class Magic
} }
mysql_query( mysql_query(
'UPDATE `eff_users` SET `delete` = "' . time( 'UPDATE `eff_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $usr['id'] . '" AND `id_eff` = 4 AND `delete` = 0 LIMIT 1'
) . '" WHERE `uid` = "' . $usr['id'] . '" AND `id_eff` = 4 AND `delete` = 0 LIMIT 1'
); );
// сообщение в чат // сообщение в чат
@ -1274,8 +1260,7 @@ class Magic
( (
`id_eff`,`uid`,`name`,`data`,`overType`,`timeUse`,`user_use`,`v1`,`x` `id_eff`,`uid`,`name`,`data`,`overType`,`timeUse`,`user_use`,`v1`,`x`
) VALUES ( ) VALUES (
"335","' . $usr['id'] . '","Цепь исцеления","' . $u->info['id'] . '","28","' . time( "335","' . $usr['id'] . '","Цепь исцеления","' . $u->info['id'] . '","28","' . time() . '","' . $u->info['id'] . '","' . $type_lechenie . '","1"
) . '","' . $u->info['id'] . '","' . $type_lechenie . '","1"
)' )'
); );
} }
@ -1376,8 +1361,7 @@ class Magic
//убираем прошлые эффекты //убираем прошлые эффекты
$goodUse = 0; $goodUse = 0;
$upd1 = mysql_query( $upd1 = mysql_query(
'UPDATE `eff_users` SET `delete` = "' . time( 'UPDATE `eff_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $usr['id'] . '" AND `delete` = "0" AND `id_eff` = "' . $itm['magic_inc'] . '"'
) . '" WHERE `uid` = "' . $usr['id'] . '" AND `delete` = "0" AND `id_eff` = "' . $itm['magic_inc'] . '"'
); );
if ($upd1) { if ($upd1) {
$goodUse = 1; $goodUse = 1;
@ -1387,8 +1371,7 @@ class Magic
//убираем прошлые эффекты //убираем прошлые эффекты
$goodUse = 0; $goodUse = 0;
$upd2 = mysql_query( $upd2 = mysql_query(
'UPDATE `eff_users` SET `delete` = "' . time( 'UPDATE `eff_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $usr['id'] . '" AND `delete` = "0" AND `overType` = "' . $itm['overType'] . '"'
) . '" WHERE `uid` = "' . $usr['id'] . '" AND `delete` = "0" AND `overType` = "' . $itm['overType'] . '"'
); );
if ($upd1) { if ($upd1) {
$goodUse = 1; $goodUse = 1;
@ -1513,8 +1496,7 @@ class Magic
if ($itm['magic_inci'] == 'sanich2') { if ($itm['magic_inci'] == 'sanich2') {
if ($u->info['battle'] == 0) { if ($u->info['battle'] == 0) {
$sz = $u->testAction( $sz = $u->testAction(
'`uid` = "' . $u->info['id'] . '" AND `vars` = "sanich2" AND `time` > ' . (time( '`uid` = "' . $u->info['id'] . '" AND `vars` = "sanich2" AND `time` > ' . (time() - 4 * 60 * 60) . ' LIMIT 1', 1
) - 4 * 60 * 60) . ' LIMIT 1', 1
); );
if (!isset($sz['id'])) { if (!isset($sz['id'])) {
$slech = rand(0, 4); $slech = rand(0, 4);
@ -1592,8 +1574,7 @@ class Magic
} elseif ($itm['magic_inci'] == 'sanich1' && $u->info['battle'] > 0) { } elseif ($itm['magic_inci'] == 'sanich1' && $u->info['battle'] > 0) {
$sz = $u->testAction( $sz = $u->testAction(
'`uid` = "' . $u->info['id'] . '" AND `vars` = "sanich1" AND `time` > ' . (time( '`uid` = "' . $u->info['id'] . '" AND `vars` = "sanich1" AND `time` > ' . (time() - 6 * 60) . ' LIMIT 1', 1
) - 6 * 60) . ' LIMIT 1', 1
); );
if (!isset($sz['id'])) { if (!isset($sz['id'])) {
$goodUse = 0; $goodUse = 0;
@ -1628,8 +1609,7 @@ class Magic
} elseif ($itm['magic_inci'] == 'sanich3' && $u->info['battle'] > 0) { } elseif ($itm['magic_inci'] == 'sanich3' && $u->info['battle'] > 0) {
$sz = $u->testAction( $sz = $u->testAction(
'`uid` = "' . $u->info['id'] . '" AND `vars` = "sanich3" AND `time` > ' . (time( '`uid` = "' . $u->info['id'] . '" AND `vars` = "sanich3" AND `time` > ' . (time() - 3 * 60 * 60) . ' LIMIT 1', 1
) - 3 * 60 * 60) . ' LIMIT 1', 1
); );
if (!isset($sz['id'])) { if (!isset($sz['id'])) {
@ -1688,8 +1668,7 @@ class Magic
$u->error = 'У вас неизлечимая травма, вам помогут только боги или время.'; $u->error = 'У вас неизлечимая травма, вам помогут только боги или время.';
} elseif ($travm) { } elseif ($travm) {
mysql_query( mysql_query(
'UPDATE `eff_users` SET `delete` = "' . time( 'UPDATE `eff_users` SET `delete` = "' . time() . '" WHERE `id` = "' . $travm['id'] . '" LIMIT 1'
) . '" WHERE `id` = "' . $travm['id'] . '" LIMIT 1'
); );
$itm['iznosNOW']++; $itm['iznosNOW']++;
mysql_query( mysql_query(
@ -1718,8 +1697,7 @@ class Magic
//убираем прошлые эффекты //убираем прошлые эффекты
$goodUse = 0; $goodUse = 0;
$upd1 = mysql_query( $upd1 = mysql_query(
'UPDATE `eff_users` SET `delete` = "' . time( 'UPDATE `eff_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $u->info['id'] . '" AND `delete` = "0" AND `id_eff` = "' . $itm['magic_inc'] . '"'
) . '" WHERE `uid` = "' . $u->info['id'] . '" AND `delete` = "0" AND `id_eff` = "' . $itm['magic_inc'] . '"'
); );
if ($upd1) { if ($upd1) {
$goodUse = 1; $goodUse = 1;
@ -1729,8 +1707,7 @@ class Magic
//убираем прошлые эффекты //убираем прошлые эффекты
$goodUse = 0; $goodUse = 0;
$upd2 = mysql_query( $upd2 = mysql_query(
'UPDATE `eff_users` SET `delete` = "' . time( 'UPDATE `eff_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $u->info['id'] . '" AND `delete` = "0" AND `overType` = "' . $itm['overType'] . '"'
) . '" WHERE `uid` = "' . $u->info['id'] . '" AND `delete` = "0" AND `overType` = "' . $itm['overType'] . '"'
); );
if ($upd1) { if ($upd1) {
$goodUse = 1; $goodUse = 1;
@ -1828,15 +1805,14 @@ class Magic
$trnt .= $pl['login'] . ' Комната : ' . $rrm['name'] . ', '; $trnt .= $pl['login'] . ' Комната : ' . $rrm['name'] . ', ';
} }
$trnt = rtrim($trnt, ', '); $trnt = rtrim($trnt, ', ');
$it_ = \User\ItemsModel::addItem( $it_ = ItemsModel::addItem(
2435, $u->info['id'], 'noodet=1|noremont=1|sudba=' . $u->info['login'] . '' 2435, $u->info['id'], 'noodet=1|noremont=1|sudba=' . $u->info['login'] . ''
); );
mysql_query( mysql_query(
'UPDATE `items_users` SET `use_text` = 500 WHERE `id` = "' . $it_ . '" LIMIT 1' 'UPDATE `items_users` SET `use_text` = 500 WHERE `id` = "' . $it_ . '" LIMIT 1'
); );
mysql_query( mysql_query(
'INSERT INTO `items_text` (`item_id`,`time`,`login`,`text`,`city`,`x`,`type`) VALUES ("' . $it_ . '","' . time( 'INSERT INTO `items_text` (`item_id`,`time`,`login`,`text`,`city`,`x`,`type`) VALUES ("' . $it_ . '","' . time() . '","","' . mysql_real_escape_string(
) . '","","' . mysql_real_escape_string(
$trnt $trnt
) . '","' . $u->info['city'] . '","1","1")' ) . '","' . $u->info['city'] . '","1","1")'
); );
@ -1860,8 +1836,7 @@ class Magic
} else { } else {
// //
mysql_query( mysql_query(
'INSERT INTO `tactic` (`btl`,`uid`,`time`,`item_id`,`var`,`hod`) VALUES ("' . $u->info['battle'] . '","' . $u->info['id'] . '","' . time( 'INSERT INTO `tactic` (`btl`,`uid`,`time`,`item_id`,`var`,`hod`) VALUES ("' . $u->info['battle'] . '","' . $u->info['id'] . '","' . time() . '","' . $itm['item_id'] . '","' . $itm['name'] . '","1")'
) . '","' . $itm['item_id'] . '","' . $itm['name'] . '","1")'
); );
// //
mysql_query( mysql_query(
@ -2023,8 +1998,7 @@ class Magic
} }
if ($goodUse == 1) { if ($goodUse == 1) {
mysql_query( mysql_query(
'UPDATE `items_users` SET `lastUPD` = ' . time( 'UPDATE `items_users` SET `lastUPD` = ' . time() . ' WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'
) . ' WHERE `id` = "' . $itm['id'] . '" AND `uid` = "' . $u->info['id'] . '" LIMIT 1'
); );
} }
} else { } else {
@ -2055,8 +2029,7 @@ class Magic
//убираем прошлые эффекты //убираем прошлые эффекты
$goodUse = 0; $goodUse = 0;
$upd1 = mysql_query( $upd1 = mysql_query(
'UPDATE `eff_users` SET `delete` = "' . time( 'UPDATE `eff_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $uid . '" AND `delete` = "0" AND `id_eff` = "' . $eff['id2'] . '"'
) . '" WHERE `uid` = "' . $uid . '" AND `delete` = "0" AND `id_eff` = "' . $eff['id2'] . '"'
); );
if ($upd1) { if ($upd1) {
$goodUse = 1; $goodUse = 1;
@ -2066,8 +2039,7 @@ class Magic
//убираем прошлые эффекты //убираем прошлые эффекты
$goodUse = 0; $goodUse = 0;
$upd2 = mysql_query( $upd2 = mysql_query(
'UPDATE `eff_users` SET `delete` = "' . time( 'UPDATE `eff_users` SET `delete` = "' . time() . '" WHERE `uid` = "' . $uid . '" AND `delete` = "0" AND `overType` = "' . $eff['overType'] . '"'
) . '" WHERE `uid` = "' . $uid . '" AND `delete` = "0" AND `overType` = "' . $eff['overType'] . '"'
); );
if ($upd2) { if ($upd2) {
$goodUse = 1; $goodUse = 1;
@ -2080,8 +2052,7 @@ class Magic
$n = $eff['mname']; $n = $eff['mname'];
$d = $eff['mdata']; $d = $eff['mdata'];
$ins = mysql_query( $ins = mysql_query(
'INSERT INTO `eff_users` (`overType`,`id_eff`,`uid`,`name`,`timeUse`,`data`,`no_Ace`) VALUES ("' . $eff['oneType'] . '","' . $eff['id2'] . '","' . $uid . '","' . $n . '","' . time( 'INSERT INTO `eff_users` (`overType`,`id_eff`,`uid`,`name`,`timeUse`,`data`,`no_Ace`) VALUES ("' . $eff['oneType'] . '","' . $eff['id2'] . '","' . $uid . '","' . $n . '","' . time() . '","' . $d . '","' . $eff['noAce'] . '")'
) . '","' . $d . '","' . $eff['noAce'] . '")'
); );
if ($ins) { if ($ins) {
$g[0] = 1; $g[0] = 1;
@ -2105,8 +2076,7 @@ class Magic
); );
$clan_test = mysql_fetch_array( $clan_test = mysql_fetch_array(
mysql_query( mysql_query(
'SELECT * FROM `clan_wars` WHERE ((`clan1`="' . $u->info['clan'] . '" AND `clan2`="' . $usr['clan'] . '") OR (`clan2`="' . $u->info['clan'] . '" AND `clan1`="' . $usr['clan'] . '")) AND `time_finish` > "' . time( 'SELECT * FROM `clan_wars` WHERE ((`clan1`="' . $u->info['clan'] . '" AND `clan2`="' . $usr['clan'] . '") OR (`clan2`="' . $u->info['clan'] . '" AND `clan1`="' . $usr['clan'] . '")) AND `time_finish` > "' . time() . '" LIMIT 1'
) . '" LIMIT 1'
) )
); );
$good = 0; $good = 0;
@ -2174,8 +2144,7 @@ class Magic
//effect ненападения //effect ненападения
if ($usr['no_ip'] == 'trupojor') { if ($usr['no_ip'] == 'trupojor') {
mysql_query( mysql_query(
'INSERT INTO `eff_users` (`no_Ace`,`id_eff`,`overType`,`uid`,`name`,`data`,`timeUse`) VALUES ("1","479","112","' . $u->info['id'] . '","Защита от нападения","zashitatk=1","' . time( 'INSERT INTO `eff_users` (`no_Ace`,`id_eff`,`overType`,`uid`,`name`,`data`,`timeUse`) VALUES ("1","479","112","' . $u->info['id'] . '","Защита от нападения","zashitatk=1","' . time() . '")'
) . '")'
); );
} }
//тут клан вар //тут клан вар
@ -2349,8 +2318,7 @@ class Magic
$text = str_replace('{u2}', $usrreal, $text); $text = str_replace('{u2}', $usrreal, $text);
mysql_query( mysql_query(
'INSERT INTO `bs_logs` (`type`,`text`,`time`,`id_bs`,`count_bs`,`city`,`m`,`u`) VALUES ( 'INSERT INTO `bs_logs` (`type`,`text`,`time`,`id_bs`,`count_bs`,`city`,`m`,`u`) VALUES (
"1", "' . mysql_real_escape_string($text) . '", "' . time( "1", "' . mysql_real_escape_string($text) . '", "' . time() . '", "' . $bs['id'] . '", "' . $bs['count'] . '", "' . $bs['city'] . '",
) . '", "' . $bs['id'] . '", "' . $bs['count'] . '", "' . $bs['city'] . '",
"' . round($bs['money'] * 0.85, 2) . '","' . $i . '")' "' . round($bs['money'] * 0.85, 2) . '","' . $i . '")'
); );
unset($text, $usrreal, $mereal, $usr_real, $me_real); unset($text, $usrreal, $mereal, $usr_real, $me_real);
@ -2371,8 +2339,7 @@ class Magic
//effect ненападения //effect ненападения
if ($usr['no_ip'] == 'trupojor') { if ($usr['no_ip'] == 'trupojor') {
mysql_query( mysql_query(
'INSERT INTO `eff_users` (`no_Ace`,`id_eff`,`overType`,`uid`,`name`,`data`,`timeUse`) VALUES ("1","479","112","' . $u->info['id'] . '","Защита от нападения","zashitatk=1","' . time( 'INSERT INTO `eff_users` (`no_Ace`,`id_eff`,`overType`,`uid`,`name`,`data`,`timeUse`) VALUES ("1","479","112","' . $u->info['id'] . '","Защита от нападения","zashitatk=1","' . time() . '")'
) . '")'
); );
} }
$upd = mysql_query('UPDATE `users` SET `battle`="' . $btl . '" WHERE `id` = "' . $uid1 . '" LIMIT 1'); $upd = mysql_query('UPDATE `users` SET `battle`="' . $btl . '" WHERE `id` = "' . $uid1 . '" LIMIT 1');
@ -2406,8 +2373,7 @@ class Magic
//Духовность, спасение //Духовность, спасение
if ($uid1st['s7'] > 49) { if ($uid1st['s7'] > 49) {
mysql_query( mysql_query(
'UPDATE `eff_users` SET `delete`="' . time( 'UPDATE `eff_users` SET `delete`="' . time() . '" WHERE `uid` = "' . $uid1st['id'] . '" AND `overType` = 101 AND `delete` = 0'
) . '" WHERE `uid` = "' . $uid1st['id'] . '" AND `overType` = 101 AND `delete` = 0'
); );
mysql_query( mysql_query(
" "
@ -2450,9 +2416,7 @@ class Magic
$id_hod++; $id_hod++;
} }
mysql_query( mysql_query(
'INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . time( 'INSERT INTO `battle_logs` (`time`,`battle`,`id_hod`,`text`,`vars`,`zona1`,`zonb1`,`zona2`,`zonb2`,`type`) VALUES ("' . time() . '","' . $btl . '","' . ($id_hod) . '","{tm1} ' . $btxt . '","login1=' . $uid1st['login'] . '||t1=' . $uid1st['team'] . '||login2=' . $uid1st['login'] . '||t2=' . $uid1st['team'] . '||time1=' . time() . '","","","","","6")'
) . '","' . $btl . '","' . ($id_hod) . '","{tm1} ' . $btxt . '","login1=' . $uid1st['login'] . '||t1=' . $uid1st['team'] . '||login2=' . $uid1st['login'] . '||t2=' . $uid1st['team'] . '||time1=' . time(
) . '","","","","","6")'
); );
} }
@ -2477,8 +2441,7 @@ class Magic
$tpa3 = [1 => 'Кошачья Ловкость', 2 => 'Интуиция Совы', 3 => 'Сила Стихий', 4 => 'Демоническая Сила', 5 => 'Друг', 6 => 'Полная Броня', 7 => 'Инферно']; $tpa3 = [1 => 'Кошачья Ловкость', 2 => 'Интуиция Совы', 3 => 'Сила Стихий', 4 => 'Демоническая Сила', 5 => 'Друг', 6 => 'Полная Броня', 7 => 'Инферно'];
mysql_query( mysql_query(
'UPDATE `eff_users` SET `delete`="' . time( 'UPDATE `eff_users` SET `delete`="' . time() . '" WHERE `uid` = "' . $u->info['id'] . '" AND `overType` = 100 AND `delete` = 0'
) . '" WHERE `uid` = "' . $u->info['id'] . '" AND `overType` = 100 AND `delete` = 0'
); );
mysql_query( mysql_query(
'INSERT INTO `eff_users` (`hod`,`v2`,`img2`,`id_eff`,`uid`,`name`,`data`,`overType`,`timeUse`,`v1`,`user_use`) VALUES ("-1","201","summon_pet_' . $tpa[$a['type']] . '.gif",22,"' . $u->info['id'] . '","' . $tpa3[$a['type']] . ' [' . $a['level'] . ']","' . $anl . '","100","77","priem","' . $u->info['id'] . '")' 'INSERT INTO `eff_users` (`hod`,`v2`,`img2`,`id_eff`,`uid`,`name`,`data`,`overType`,`timeUse`,`v1`,`user_use`) VALUES ("-1","201","summon_pet_' . $tpa[$a['type']] . '.gif",22,"' . $u->info['id'] . '","' . $tpa3[$a['type']] . ' [' . $a['level'] . ']","' . $anl . '","100","77","priem","' . $u->info['id'] . '")'
@ -2574,8 +2537,7 @@ class Magic
$text = str_replace('{u2}', $usrreal, $text); $text = str_replace('{u2}', $usrreal, $text);
mysql_query( mysql_query(
'INSERT INTO `bs_logs` (`type`,`text`,`time`,`id_bs`,`count_bs`,`city`,`m`,`u`) VALUES ( 'INSERT INTO `bs_logs` (`type`,`text`,`time`,`id_bs`,`count_bs`,`city`,`m`,`u`) VALUES (
"1", "' . mysql_real_escape_string($text) . '", "' . time( "1", "' . mysql_real_escape_string($text) . '", "' . time() . '", "' . $bs['id'] . '", "' . $bs['count'] . '", "' . $bs['city'] . '",
) . '", "' . $bs['id'] . '", "' . $bs['count'] . '", "' . $bs['city'] . '",
"' . round($bs['money'] * 0.85, 2) . '","' . $i . '")' "' . round($bs['money'] * 0.85, 2) . '","' . $i . '")'
); );
unset($text, $usrreal, $mereal, $usr_real, $me_real); unset($text, $usrreal, $mereal, $usr_real, $me_real);
@ -2587,7 +2549,7 @@ class Magic
//Проверка травмы //Проверка травмы
private static function canAttack8Level($attacker, $target) private static function canAttack8Level($attacker, $target): bool
{ {
$aSum = self::getDressedEkrTotalPrice($attacker); $aSum = self::getDressedEkrTotalPrice($attacker);
$tRange = Math::get20PercentRange(self::getDressedEkrTotalPrice($target)); $tRange = Math::get20PercentRange(self::getDressedEkrTotalPrice($target));
@ -2600,18 +2562,10 @@ class Magic
return Db::getValue('select sum(2price) from items_users where inOdet > 0 and uid = ?', [$uid]); return Db::getValue('select sum(2price) from items_users where inOdet > 0 and uid = ?', [$uid]);
} }
public function testTravma($uid, $vals) public function testTravma(int $uid, $vals): bool
{ {
$r = false; $v1 = Db::getValue('select v1 from eff_users where id_eff = 4 and uid = ? and `delete` = 0 and v1 >= ?', [$uid, $vals]);
$tr_pl = mysql_fetch_array( return intval($v1) >= intval($vals);
mysql_query(
'SELECT `id`,`v1` FROM `eff_users` WHERE `id_eff` = 4 AND `uid` = "' . $uid . '" AND `delete` = "0" ORDER BY `v1` DESC LIMIT 1'
)
);
if (isset($tr_pl['id']) && $tr_pl['v1'] >= $vals) {
$r = true;
}
return $r;
} }
//создаем нападение на персонажа //создаем нападение на персонажа
@ -2619,21 +2573,27 @@ class Magic
public function inBattleLog($txt, $usr = null) public function inBattleLog($txt, $usr = null)
{ {
global $u; global $u;
$lastHOD = mysql_fetch_array( $lastHOD = Db::getRow('select id_hod, type from battle_logs where battle = ? order by id_hod desc limit 1', [$u->info['battle']]);
mysql_query(
'SELECT * FROM `battle_logs` WHERE `battle` = "' . $u->info['battle'] . '" ORDER BY `id_hod` DESC LIMIT 1' if (!$lastHOD) {
) return;
); }
if (isset($lastHOD['id'])) {
$id_hod = $lastHOD['id_hod']; $idTurn = $lastHOD['id_hod'];
if ($lastHOD['type'] != 6) { if ($lastHOD['type'] != 6) {
$id_hod++; $idTurn++;
}
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")'
);
} }
$sql = 'insert into battle_logs (time, battle, id_hod, text, vars, zona1, zonb1, zona2, zonb2, type) values (unix_timestamp(),?,?,?,?,?,?,?,?,6)';
$args = [
$u->info['battle'],
$idTurn,
$txt,
"login1={$u->info['login']}||t1={$u->info['team']}||login2={$usr['login']}||t2={$usr['team']}||time1=" . time(),
'',
'',
'',
'',
];
Db::sql($sql, $args);
} }
} }

View File

@ -11,6 +11,7 @@ class Fire
private $color = '#a00'; private $color = '#a00';
private $colorCrit = '#f00'; private $colorCrit = '#f00';
private $colorMiss = '#909090'; private $colorMiss = '#909090';
public function __construct(Battle $btl) public function __construct(Battle $btl)
{ {
$this->btl = $btl; $this->btl = $btl;

View File

@ -26,8 +26,7 @@ if ($u->room['id'] != '9') {
$fid = $po['feerverk_eff']; $fid = $po['feerverk_eff'];
} }
mysql_query( mysql_query(
'INSERT INTO `feerverks` (`room`,`uid`,`time`,`fid`) VALUES ("' . $u->info['room'] . '","' . $u->info['id'] . '","' . time( 'INSERT INTO `feerverks` (`room`,`uid`,`time`,`fid`) VALUES ("' . $u->info['room'] . '","' . $u->info['id'] . '","' . time() . '","' . $fid . '")'
) . '","' . $fid . '")'
); );
// //
$a = $u->info['sex'] == 1 ? 'a' : ''; //окончание рода М\Ж в словах $a = $u->info['sex'] == 1 ? 'a' : ''; //окончание рода М\Ж в словах
@ -45,8 +44,7 @@ if ($u->room['id'] != '9') {
// У персонажа легкая травма - "Ожог от фейерверка" еще 3 мин. 43 сек. // У персонажа легкая травма - "Ожог от фейерверка" еще 3 мин. 43 сек.
// 22.02.14 21:14 лосенка пострадала от фейерверка! :fingal: // 22.02.14 21:14 лосенка пострадала от фейерверка! :fingal:
$spf = mysql_query( $spf = mysql_query(
'SELECT `id`,`login`,`sex` FROM `users` WHERE `online` > "' . (time( 'SELECT `id`,`login`,`sex` FROM `users` WHERE `online` > "' . (time() - 120) . '" AND `invis` = 0 AND `battle` = 0 AND `room` = "' . $u->info['room'] . '" ORDER BY `online` DESC LIMIT 100'
) - 120) . '" AND `invis` = 0 AND `battle` = 0 AND `room` = "' . $u->info['room'] . '" ORDER BY `online` DESC LIMIT 100'
); );
$fusr = []; $fusr = [];
while ($plf = mysql_fetch_array($spf)) { while ($plf = mysql_fetch_array($spf)) {

View File

@ -2765,8 +2765,8 @@ class User
if ($upd) { if ($upd) {
$po = ConversionHelper::dataStringToArray($e['data']); $po = ConversionHelper::dataStringToArray($e['data']);
if (isset($po['finish_file'])) { if (isset($po['finish_file'])) {
if (file_exists('_incl_data/class/magic/' . $po['finish_file'] . '.php')) { if (file_exists('_incl_data/class/Magic/' . $po['finish_file'] . '.php')) {
require('_incl_data/class/magic/' . $po['finish_file'] . '.php'); require('_incl_data/class/Magic/' . $po['finish_file'] . '.php');
} else { } else {
$this->error2 = '!File not exists &quot;cgi-bin/magic.pl?use_' . $po['finish_file'] . '&quot;.'; $this->error2 = '!File not exists &quot;cgi-bin/magic.pl?use_' . $po['finish_file'] . '&quot;.';
} }
@ -4641,7 +4641,6 @@ class User
* @param $nosudba * @param $nosudba
* @param $plavka * @param $plavka
* @return int|mixed|string * @return int|mixed|string
* @deprecated use ItemsModel::addItem()
*/ */
public function addItem($id, $uid, $md = null, $dn = null, $mxiznos = null, $nosudba = null, $plavka = null) public function addItem($id, $uid, $md = null, $dn = null, $mxiznos = null, $nosudba = null, $plavka = null)
{ {
@ -4658,6 +4657,7 @@ class User
* @param $nosudba * @param $nosudba
* @param $plavka * @param $plavka
* @return int|mixed|string * @return int|mixed|string
* @deprecated use ItemsModel::addItem()
*/ */
public function addItem($id, $uid, $md = null, $dn = null, $mxiznos = null, $nosudba = null, $plavka = null) public function addItem($id, $uid, $md = null, $dn = null, $mxiznos = null, $nosudba = null, $plavka = null)
{ {
@ -7464,7 +7464,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`
return $r; return $r;
} }
public function shopSaleM($val, $itm): float private function shopSaleM($val, $itm): float
{ {
$procs = [ $procs = [
0, //0 0, //0
@ -7509,7 +7509,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`
return round(($val / 100 * (100 - $proc)), 2); return round(($val / 100 * (100 - $proc)), 2);
} }
private function shopSaleM($val, $itm): float public function shopSaleM($val, $itm): float
{ {
$procs = [ $procs = [
0, //0 0, //0
@ -9080,8 +9080,8 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.`
'UPDATE `items_users` SET `lastUPD` = "' . time() . '",`inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1' 'UPDATE `items_users` SET `lastUPD` = "' . time() . '",`inGroup` = "0", `delete` = "0" WHERE `id` = "' . $itm['id'] . '" LIMIT 1'
); );
} }
if (file_exists('_incl_data/class/magic/' . $tr['items_in_file'] . '.php')) { if (file_exists('_incl_data/class/Magic/' . $tr['items_in_file'] . '.php')) {
require('_incl_data/class/magic/' . $tr['items_in_file'] . '.php'); require('_incl_data/class/Magic/' . $tr['items_in_file'] . '.php');
if (!isset($no_open_itm)) { if (!isset($no_open_itm)) {
$this->deleteItem($itm['id'], $this->info['id']); $this->deleteItem($itm['id'], $this->info['id']);
$this->error = 'Вы успешно открыли &quot;' . $itm['name'] . '&quot;:<br>' . $io . '...'; $this->error = 'Вы успешно открыли &quot;' . $itm['name'] . '&quot;:<br>' . $io . '...';
@ -9930,6 +9930,11 @@ LIMIT 1'
//получаем уровень //получаем уровень
public function addEkr($amount)
{
Db::sql('update users set money2 = money2 + ? where id = ?', [$amount, $this->info['id']]);
}
public function addEkr($amount, $uid = 0) public function addEkr($amount, $uid = 0)
{ {
if ($uid === 0) { if ($uid === 0) {
@ -9938,11 +9943,6 @@ LIMIT 1'
Db::sql('update users set money2 = money2 + ? where id = ?', [$amount, $uid]); Db::sql('update users set money2 = money2 + ? where id = ?', [$amount, $uid]);
} }
public function addEkr($amount)
{
Db::sql('update users set money2 = money2 + ? where id = ?', [$amount, $this->info['id']]);
}
public function r2($v): string public function r2($v): string
{ {
return number_format($v, 2, '.', ' '); return number_format($v, 2, '.', ' ');