diff --git a/_incl_data/class/Model/ActionModel.php b/_incl_data/class/Model/ActionModel.php index 4445a55a..3682eb84 100644 --- a/_incl_data/class/Model/ActionModel.php +++ b/_incl_data/class/Model/ActionModel.php @@ -40,12 +40,16 @@ class ActionModel Db::sql('delete from actions where uid = ? and vals = ?', [$this->uid, $vals]); } - public static function new(array $user, string $vals, string $vars) + public static function new(array $user, string $vals, string $vars, int $time = 0) { + if (!$time) { + $time = time(); + } Db::sql( - 'insert into actions (uid, time, city, room, vars, ip, vals, val) values (?,unix_timestamp(),?,?,?,?,?,?)', + 'insert into actions (uid, time, city, room, vars, ip, vals, val) values (?,?,?,?,?,?,?,?)', [ $user['id'], + $time, $user['city'], $user['room'], $vars, @@ -56,8 +60,10 @@ class ActionModel ); } - public static function getAll(): array + public static function getAll(string $filter = ''): array { return Db::getRows('select * from actions'); } + + } \ No newline at end of file diff --git a/_incl_data/class/User.php b/_incl_data/class/User.php index 07a89de1..78c11091 100644 --- a/_incl_data/class/User.php +++ b/_incl_data/class/User.php @@ -4,6 +4,7 @@ use Core\Config; use Core\ConversionHelper; use Core\Database; use Core\Db; +use Model\ActionModel; use User\ItemsModel; class User @@ -2257,18 +2258,12 @@ class User public function addAction($time, $vars, $vls, $uid = null): bool { - if ($uid == null) { - $uid = $this->info['id']; + $info = $this->info; + if ($uid) { + $info['id'] = $uid; } - $ins = mysql_query( - 'INSERT INTO `actions` (`uid`,`time`,`city`,`room`,`vars`,`ip`,`vals`) VALUES ("' . $uid . '","' . $time . '","' . $this->info['city'] . '","' . $this->info['room'] . '","' . mysql_real_escape_string( - $vars - ) . '","' . mysql_real_escape_string($_SERVER['HTTP_X_REAL_IP']) . '","' . mysql_real_escape_string( - $vls - ) . '")' - ); - - return (bool)$ins; + ActionModel::new($info, $vls, $vars, $time); + return true; } public function testAction($filter, $tp) @@ -6958,11 +6953,11 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $pl['rep'] = 2; } } - $is1 .= 'Выбрать'; + $is1 .= 'Выбрать'; } elseif ($type == 14) { - $is1 .= 'Выбрать'; + $is1 .= 'Выбрать'; } elseif ($type == 12) { - $is1 .= 'Выбрать'; + $is1 .= 'Выбрать'; } elseif ($type == 10) { //Общага (отображение предметов в общаге (под стеклом)) $is1 .= 'В рюкзак'; @@ -7164,7 +7159,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` $inv1 = 'inv=1&'; } if ($pl['item_id'] == 74) { - $is1 .= 'исп-ть'; + $is1 .= 'исп-ть'; } else { $useUrl = ''; if ($pl['magic_inc'] == '') { @@ -7192,7 +7187,7 @@ FROM `items_users` AS `iu` LEFT JOIN `items_main` AS `im` ON (`im`.`id` = `iu`.` } if ($pl['max_text'] > 0 && $pl['max_text'] - $pl['use_text'] > 0) { - $is1 .= 'Записать
'; + $is1 .= 'Записать
'; } if ($pl['type'] == 31 || $pl['type'] == 46 || $pl['type'] == 48 || $pl['type'] == 50 || $pl['type'] == 62 || $pl['type'] == 68 || $pl['type'] == 37 || $pl['type'] == 47) { if ($d[2] == 1) { @@ -8622,7 +8617,7 @@ LIMIT 1' if ($i1 == 0 && $u['battle'] == 0) { $rt[0] .= ''; + ) - $u['regMP']) . ',' . (0 + $this->rgd[0]) . ',' . (0 + $this->rgd[1]) . ',1)'; } if ($ivv == 0 && $i1 == 0) { $rt[0] .= $this->info_remont(); diff --git a/buttons.php b/buttons.php index 4b362678..008d723c 100644 --- a/buttons.php +++ b/buttons.php @@ -975,20 +975,20 @@ $u->stats = $u->getStats($u->info['id'], 0); info['align'] >= 1 && $u->info['align'] < 2) { ?> - info['align'] >= 3 && $u->info['align'] < 4) { ?> - Панель тьмы info['align'] == 7) { ?> - Панель нейтралитета tfer['id']) && $trololo == 1) { } elseif (isset($_GET['alh']) && !isset($u->tfer['id'])) { require_once('modules_data/_alh.php'); } elseif ($u->info['clan'] > 0 && isset($_GET['clan']) && !isset($u->tfer['id'])) { - require_once('modules_data/_clan.php'); -} elseif (isset($_GET['alhp']) && ($u->info['admin'] == 1 || $u->info['align'] == 50 || $u->info['align2'] == 50) && !isset($u->tfer['id'])) { - require_once('modules_data/_alhp.php'); - //Панель светлого -} elseif ($u->info['align'] >= 1 && $u->info['align'] < 2 && isset($_GET['1_panel']) && !isset($u->tfer['id'])) { - require_once('modules_data/1_panel.php'); - //Панель темного -} elseif ($u->info['align'] >= 3 && $u->info['align'] < 4 && isset($_GET['3_panel']) && !isset($u->tfer['id'])) { - require_once('modules_data/3_panel.php'); - //Панель темного -} elseif ($u->info['align'] >= 7 && $u->info['align'] < 8 && isset($_GET['7_panel']) && !isset($u->tfer['id'])) { - require_once('modules_data/7_panel.php'); + require_once('modules_data/_clan.php'); //Панель кланов +} elseif (isset($_GET['alhp']) && ($u->info['admin'] == 1 || $u->info['align'] == 50) && !isset($u->tfer['id'])) { + require_once('modules_data/_alhp.php'); //Панель алхимиков +} elseif ($u->info['align'] > 0 && !isset($u->tfer['id']) && !empty($_GET['ap'])) { + require_once('modules_data/alignPanel.php'); //Панель склонностей, GET чтобы вызывать по ссылке. } elseif ($u->info['battle'] != 0) { //поединок if ((!isset($btl_last['id']) || $u->info['battle'] > 0) && !isset($u->info['battle_lsto'])) { diff --git a/modules_data/1_panel.php b/modules_data/1_panel.php deleted file mode 100644 index 941b6a46..00000000 --- a/modules_data/1_panel.php +++ /dev/null @@ -1,75 +0,0 @@ -info['align'] !== 1) { - exit(); -} - -if ($u->error) { - echo '' . $u->error . '
'; -} - -//Абилки $item_light -$item_light = [ - [5048, 1, 0, 0, 0, 'usefromfile=1|nohaos=1|musor=2|noremont=1|tr_align=1|srok=86400|nosale=1|sudba=1', 1], -]; -$vi = []; -$vnr = [0 => 'на сегодня', 1 => ' всего']; -$seet = ''; -foreach ($item_light as $item) { - if (!$item[1]) { - continue; - } - $itm = Db::getRow('select * from items_main where id = ?', [$item[0]]); - if (!$itm['id']) { - continue; - } - $vix = 0; - if ($item[4] === 0) { - $vix = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `time`>=' . strtotime('now 00:00:00') . ' AND `vars` = "dark_itm' . $itm['id'] . '"', - 2); - } else { - $vix = $u->testAction('`uid` = "' . $u->info['id'] . '" AND `time`>=' . $vt['timeUse'] . ' AND `vars` = "dark_itm' . $itm['id'] . '" ', - 2); - } - $vix = $vix[0]; - if ($item[1] - $vix > 0 && $_GET['take_item_light_panel'] == $itm['id']) { - $nitm = \User\ItemsModel::addItem($itm['id'], $u->info['id'], $item[5]); - $u->addAction(time(), 'dark_itm' . $itm['id'], ''); - echo 'Предмет "' . $itm['name'] . '" перемещен к Вам в инвентарь!

'; - } - - //Вывод предметов - $seet0 = ' '; - if ($item[1] - $vix > 0) { - $seet0 = '' . $seet0 . ''; - } else { - $seet0 = '' . $seet0 . ''; - } - $seet .= $seet0; -} - -?> - - - - -

Светлая Сила с нами, собрат microLogin($u->info['id'], 1) ?>

-
- - -
-
-
Абилки:
(Чтобы забрать предмет просто нажмите на его изображение)
-
-
diff --git a/modules_data/3_panel.php b/modules_data/3_panel.php deleted file mode 100644 index 198d1cd7..00000000 --- a/modules_data/3_panel.php +++ /dev/null @@ -1,85 +0,0 @@ - - var elem = document.getElementById('se-pre-con'); - elem.parentNode.removeChild(elem); - - "; -if(!defined('GAME')) -{ - die(); -} -if($u->info['align']>=3 && $u->info['align'] <4) { -if($u->error!='') -{ - echo ''.$u->error.'
'; -} -$vu = array(0,0,0,0,0,0,0); -//Абилки $item_dark -$item_dark = array( -"" => array( - //array(4398,1,0,0,0,'useOnLogin=1|onlyOne=1|oneType=37|noremont=1|musor=1|tr_align=3|sudba='.$u->info['login'].'|srok=86400|nosale=1|sudba=1',1), - array(2391,1,0,0,0,'useOnLogin=1|musor=1|noremont=1|tr_align=3|sudba='.$u->info['login'].'|srok=86400|nosale=1|sudba=1',1) - ), -); -$vi = array( -); -?> - - - - - - -

Темная Сила с нами, собрат microLogin($u->info['id'],1)?>

- - -
-

Абилки:
(Чтобы забрать предмет просто нажмите на его изображение)

-

- 'на сегодня',1 => ' всего'); - while($i < count($item_dark[$dark_panel])) { - if($item_dark[$dark_panel][$i][1]>0) { - $itm = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "'.$item_dark[$dark_panel][$i][0].'" LIMIT 1')); - if(isset($itm['id'])) { - $vix = 0; - if($item_dark[$dark_panel][$i][4] == 0) { - $vix = $u->testAction('`uid` = "'.$u->info['id'].'" AND `time`>='.strtotime('now 00:00:00').' AND `vars` = "dark_itm'.$itm['id'].'"',2); - $vix = $vix[0]; - }else{ - $vix = $u->testAction('`uid` = "'.$u->info['id'].'" AND `time`>='.$vt['timeUse'].' AND `vars` = "dark_itm'.$itm['id'].'" ',2); - $vix = $vix[0]; - } - if($item_dark[$dark_panel][$i][1]-$vix > 0) { - if(isset($_GET['take_item_dark_panel']) && $_GET['take_item_dark_panel'] == $itm['id']) { - $nitm = \User\ItemsModel::addItem($itm['id'],$u->info['id'],$item_dark[$dark_panel][$i][5]); - if($item_dark[$dark_panel][6]>0) { - } - $u->addAction(time(),'dark_itm'.$itm['id'],''); - echo 'Предмет "'.$itm['name'].'" перемещен к Вам в инвентарь!

'; - } - } - $seet0 = ''; - //Вывод предметов - $seet0 .= ' '; - if($item_dark[$dark_panel][$i][1]-$vix > 0) { - $seet0 = ''.$seet0.''; - }else{ - $seet0 = ''.$seet0.''; - } - $seet .= $seet0; - } - } - $i++; - } -} - echo $seet; - ?> -

- - \ No newline at end of file diff --git a/modules_data/7_panel.php b/modules_data/7_panel.php deleted file mode 100644 index cb672dd5..00000000 --- a/modules_data/7_panel.php +++ /dev/null @@ -1,85 +0,0 @@ - - var elem = document.getElementById('se-pre-con'); - elem.parentNode.removeChild(elem); - - "; -if(!defined('GAME')) -{ - die(); -} -if($u->info['align']==7) { -if($u->error!='') -{ - echo ''.$u->error.'
'; -} -$vu = array(0,0,0,0,0,0,0); -//Абилки $item_neytral -$item_neytral = array( -"" => array( - //array(5050,1,0,0,0,'tr_s1=10|tr_s2=10|tr_s3=10|tr_s4=25|onlyOne=1|oneType=74|tr_align=7|noremont=1|musor=1|srok=86400|nosale=1|sudba=1',1), - array(4943,1,0,0,0,'usefromfile=1|musor=1|noremont=1|sudba=1|tr_align=7|srok=86400|nosale=1|sudba=1',1) - ), -); -$vi = array( -); -?> - - - - - - -

Нейтральная Сила с нами, собрат microLogin($u->info['id'],1)?>

- - -
-

Абилки:
(Чтобы забрать предмет просто нажмите на его изображение)

-

- 'на сегодня',1 => ' всего'); - while($i < count($item_neytral[$neytral_panel])) { - if($item_neytral[$neytral_panel][$i][1]>0) { - $itm = mysql_fetch_array(mysql_query('SELECT * FROM `items_main` WHERE `id` = "'.$item_neytral[$neytral_panel][$i][0].'" LIMIT 1')); - if(isset($itm['id'])) { - $vix = 0; - if($item_neytral[$neytral_panel][$i][4] == 0) { - $vix = $u->testAction('`uid` = "'.$u->info['id'].'" AND `time`>='.strtotime('now 00:00:00').' AND `vars` = "dark_itm'.$itm['id'].'"',2); - $vix = $vix[0]; - }else{ - $vix = $u->testAction('`uid` = "'.$u->info['id'].'" AND `time`>='.$vt['timeUse'].' AND `vars` = "dark_itm'.$itm['id'].'" ',2); - $vix = $vix[0]; - } - if($item_neytral[$neytral_panel][$i][1]-$vix > 0) { - if(isset($_GET['take_item_neytral_panel']) && $_GET['take_item_neytral_panel'] == $itm['id']) { - $nitm = \User\ItemsModel::addItem($itm['id'],$u->info['id'],$item_neytral[$neytral_panel][$i][5]); - if($item_neytral[$neytral_panel][6]>0) { - } - $u->addAction(time(),'dark_itm'.$itm['id'],''); - echo 'Предмет "'.$itm['name'].'" перемещен к Вам в инвентарь!

'; - } - } - $seet0 = ''; - //Вывод предметов - $seet0 .= ' '; - if($item_neytral[$neytral_panel][$i][1]-$vix > 0) { - $seet0 = ''.$seet0.''; - }else{ - $seet0 = ''.$seet0.''; - } - $seet .= $seet0; - } - } - $i++; - } -} - echo $seet; - ?> -

- - \ No newline at end of file diff --git a/modules_data/alignPanel.php b/modules_data/alignPanel.php new file mode 100644 index 00000000..72682631 --- /dev/null +++ b/modules_data/alignPanel.php @@ -0,0 +1,88 @@ + [ + 'name' => 'light', + 'items' => [ + [5048, 4, 0, 'usefromfile=1|nohaos=1|musor=2|noremont=1|tr_align=1|srok=86400|nosale=1|sudba=1'], + [391, 1, 0, 'useOnLogin=1|musor=1|noremont=1|tr_align=3|srok=86400|nosale=1|sudba=1'], + [4943, 1, 0, 'usefromfile=1|musor=1|noremont=1|tr_align=7|srok=86400|nosale=1|sudba=1'], + ], + ], + 3 => [ + 'name' => 'dark', + 'items' => [ + [391, 1, 0, 'useOnLogin=1|musor=1|noremont=1|tr_align=3|srok=86400|nosale=1|sudba=1'], + ], + ], + 7 => [ + 'name' => 'neytral', + 'items' => [ + [4943, 1, 0, 'usefromfile=1|musor=1|noremont=1|tr_align=7|srok=86400|nosale=1|sudba=1'], + ], + ], +]; + +//items > +// 0 → id, +// 1 → количество использований, +// 2 → [0 => 'на сегодня', 1 => ' всего'] (только отображение), +// 3 → data, + +$vnr = [0 => 'на сегодня', 1 => ' всего']; +$itemsString = ''; +$linkGET = 'take_item_' . $bonus[(int)$u->info['align']]['name'] . '_panel'; +$actionName = $bonus[(int)$u->info['align']]['name'] . '_itm'; + +Db::sql('delete from actions where uid = ? and time < unix_timestamp(current_date) and vars like ?', [$u->info['id'], $actionName . '%']); + +foreach ($bonus[(int)$u->info['align']]['items'] as $bonusItem) { + if ($bonusItem[1] === 0) { + continue; + } + $item = Db::getRow('select * from items_main where id = ?', [$bonusItem[0]]); + if (!$item['id']) { + continue; + } + + $bonusItemStock = Db::getValue('select count(*) from actions where uid = ? and time >= unix_timestamp(current_date) and vars = ?', [$u->info['id'], $actionName . $item['id']]); + + if ($bonusItem[1] - $bonusItemStock > 0 && intval($_GET[$linkGET]) === $item['id']) { + $nitm = ItemsModel::addItem($item['id'], $u->info['id'], $bonusItem[3]); + ActionModel::new($u->info, '', $actionName . $item['id']); + echo 'Предмет «' . $item['name'] . '» перемещен к Вам в инвентарь!

'; + } + + //Вывод предметов + $s = ' '; + if ($bonusItem[1] - $bonusItemStock > 0) { + $s = '' . $s . ''; + } else { + $s = '' . $s . ''; + } + $itemsString .= $s; +} + +?> + + + + +

Проходи, microLogin($u->info['id']) ?>, угощайся!

+
+ + +
+
+
Абилки:
(Чтобы забрать предмет просто нажмите на его изображение)
+
+