From dc710a8cb19f02053444b6545e2b234157b134f2 Mon Sep 17 00:00:00 2001 From: Ivor Barhansky Date: Mon, 27 Jun 2022 14:44:30 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=BE=D0=B4=D1=80=D1=83=D0=B1=D0=B8?= =?UTF-8?q?=D0=BB=20=D1=81=D1=87=D1=91=D1=82=D1=87=D0=B8=D0=BA=20=D1=83?= =?UTF-8?q?=D1=87=D0=B0=D1=81=D1=82=D0=B8=D0=B9=20=D0=B2=20=D1=82=D1=83?= =?UTF-8?q?=D1=80=D0=BD=D0=B8=D1=80=D0=B0=D1=85=20#12?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _incl_data/class/Achievements.php | 16 +++++++++++++- .../Insallah/Tournament/TournamentModel.php | 5 ++++- modules_data/titul.php | 22 +++++++++---------- 3 files changed, 30 insertions(+), 13 deletions(-) diff --git a/_incl_data/class/Achievements.php b/_incl_data/class/Achievements.php index 71102dd4..b77335e6 100644 --- a/_incl_data/class/Achievements.php +++ b/_incl_data/class/Achievements.php @@ -199,11 +199,25 @@ class Achievements return $this->info; } - public function updateTier($name) + private function addOne($name) { Db::sql("update users_achiv set $name = $name + 1 where id = ?", [$this->user->info['id']]); } + public function updateTier($name) + { + if (in_array($name, array_keys($this->data))) { + $this->addOne($name . '_n'); + } + } + + public function updateCounter($name) + { + if (in_array($name, array_keys($this->data))) { + $this->addOne($name); + } + } + /** * @return array[] */ diff --git a/_incl_data/class/Insallah/Tournament/TournamentModel.php b/_incl_data/class/Insallah/Tournament/TournamentModel.php index 7985b0b7..619e7dbb 100644 --- a/_incl_data/class/Insallah/Tournament/TournamentModel.php +++ b/_incl_data/class/Insallah/Tournament/TournamentModel.php @@ -1,6 +1,9 @@ updateCounter('trn'); } /** * Узнаём id турнира по id игрока. - * todo Проверить, возможно можно обращаться к уровню игрока. * * @param int $uid * diff --git a/modules_data/titul.php b/modules_data/titul.php index 7f1a28b1..fbf4200e 100644 --- a/modules_data/titul.php +++ b/modules_data/titul.php @@ -24,7 +24,7 @@ if (isset($_GET['nagr'])) { $ai['klaszb'] > $ai['zb_n'] ) { $ai['zb_n'] += 1; - $a->updateTier('zb_n'); + $a->updateTier('zb'); $a->givePrizeItems(10020, 'zb'); $nagrtxt .= 'Жетон успеха X' . $a->getData()['zb']['prize'][$ai['zb_n']]; } elseif ( //Хаот задание vx @@ -33,7 +33,7 @@ if (isset($_GET['nagr'])) { $ai['klasvx'] > $ai['vx_n'] ) { $ai['vx_n'] += 1; - $a->updateTier('vx_n'); + $a->updateTier('vx'); $u->addEkr($a->getData()['vx']['prize'][$ai['vx_n']]); $nagrtxt .= $a->getData()['vx']['prize'][$ai['vx_n']] . $a->getData()['vx']['prize'][0]; } elseif ( //Сундуки трупожора snt @@ -42,7 +42,7 @@ if (isset($_GET['nagr'])) { $ai['klassnt'] > $ai['snt_n'] ) { $ai['snt_n'] += 1; - $a->updateTier('snt_n'); + $a->updateTier('snt'); $u->addEkr($a->getData()['snt']['prize'][$ai['snt_n']]); $nagrtxt .= $a->getData()['snt']['prize'][$ai['snt_n']] . $a->getData()['snt']['prize'][0]; } elseif ( //Руны 8 лвл. rp @@ -51,7 +51,7 @@ if (isset($_GET['nagr'])) { $ai['klasrp'] > $ai['rp_n'] ) { $ai['rp_n'] += 1; - $a->updateTier('rp_n'); + $a->updateTier('rp'); $a->givePrizeItems(10038, 'rp'); $nagrtxt .= 'Плохие Заготовки X' . $a->getData()['rp']['prize'][$ai['rp_n']]; } elseif ( //Руны 9 лвл. rn @@ -60,7 +60,7 @@ if (isset($_GET['nagr'])) { $ai['klasrn'] > $ai['rn_n'] ) { $ai['rn_n'] += 1; - $a->updateTier('rn_n'); + $a->updateTier('rn'); $a->givePrizeItems(10039, 'rn'); $nagrtxt .= 'Нормальные Заготовки X' . $a->getData()['rn']['prize'][$ai['rn_n']]; } elseif ( //Руны 10 лвл. rb @@ -69,7 +69,7 @@ if (isset($_GET['nagr'])) { $ai['klasrb'] > $ai['rb_n'] ) { $ai['rb_n'] += 1; - $a->updateTier('rb_n'); + $a->updateTier('rb'); $a->givePrizeItems(10040, 'rb'); $nagrtxt .= 'Идеальные Заготовки X' . $a->getData()['rb']['prize'][$ai['rb_n']]; } elseif ( //Героик pg @@ -78,7 +78,7 @@ if (isset($_GET['nagr'])) { $ai['klaspg'] > $ai['pg_n'] ) { $ai['pg_n'] += 1; - $a->updateTier('pg_n'); + $a->updateTier('pg'); $a->givePrizeItems(10020, 'pg'); $nagrtxt .= 'Жетон Успеха X' . $a->getData()['pg']['prize'][$ai['pg_n']]; } elseif ( //Продать бабушке найденные вещи в пещере bv @@ -87,7 +87,7 @@ if (isset($_GET['nagr'])) { $ai['klasbv'] > $ai['bv_n'] ) { $ai['bv_n'] += 1; - $a->updateTier('bv_n'); + $a->updateTier('bv'); $u->addKr($a->getData()['bv']['prize'][$ai['bv_n']]); $nagrtxt .= $a->getData()['bv']['prize'][$ai['bv_n']] . $a->getData()['bv']['prize'][0]; } elseif ( //Клан вар kw @@ -96,7 +96,7 @@ if (isset($_GET['nagr'])) { $ai['klaskw'] > $ai['kw_n'] ) { $ai['kw_n'] += 1; - $a->updateTier('kw_n'); + $a->updateTier('kw'); $a->givePrizeItems(4917, 'kw'); $nagrtxt .= 'Клановый опыт +50000 X' . $a->getData()['kw']['prize'][$ai['kw_n']]; } elseif ( //Башня смерти задание bs @@ -105,7 +105,7 @@ if (isset($_GET['nagr'])) { $ai['klasbs'] > $ai['bs_n'] ) { $ai['bs_n'] += 1; - $a->updateTier('bs_n'); + $a->updateTier('bs'); $u->addEkr($a->getData()['bs']['prize'][$ai['bs_n']]); $nagrtxt .= $a->getData()['bs']['prize'][$ai['bs_n']] . $a->getData()['bs']['prize'][0]; } elseif ( //Турниры победы trn @@ -114,7 +114,7 @@ if (isset($_GET['nagr'])) { $ai['klastrn'] > $ai['trn_n'] ) { $ai['trn_n'] += 1; - $a->updateTier('trn_n'); + $a->updateTier('trn'); $u->addEkr($a->getData()['trn']['prize'][$ai['trn_n']]); $nagrtxt .= $a->getData()['trn']['prize'][$ai['trn_n']] . $a->getData()['trn']['prize'][0]; }