dev-fixes #27

Closed
lopar wants to merge 12 commits from dev-fixes into dev
3 changed files with 30 additions and 13 deletions
Showing only changes of commit dc710a8cb1 - Show all commits

View File

@ -199,11 +199,25 @@ class Achievements
return $this->info; 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']]); 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[] * @return array[]
*/ */

View File

@ -1,6 +1,9 @@
<?php <?php
namespace Insallah; namespace Insallah;
use Achievements;
use user;
class TournamentModel class TournamentModel
{ {
@ -182,11 +185,11 @@ class TournamentModel
$db = new Db(); $db = new Db();
$db::sql('update tournaments_users set death_time = unix_timestamp() where uid = ?', [$uid]); $db::sql('update tournaments_users set death_time = unix_timestamp() where uid = ?', [$uid]);
self::teleport($uid, 9); self::teleport($uid, 9);
(new Achievements(user::start()))->updateCounter('trn');
} }
/** /**
* Узнаём id турнира по id игрока. * Узнаём id турнира по id игрока.
* todo Проверить, возможно можно обращаться к уровню игрока.
* *
* @param int $uid * @param int $uid
* *

View File

@ -24,7 +24,7 @@ if (isset($_GET['nagr'])) {
$ai['klaszb'] > $ai['zb_n'] $ai['klaszb'] > $ai['zb_n']
) { ) {
$ai['zb_n'] += 1; $ai['zb_n'] += 1;
$a->updateTier('zb_n'); $a->updateTier('zb');
$a->givePrizeItems(10020, 'zb'); $a->givePrizeItems(10020, 'zb');
$nagrtxt .= 'Жетон успеха X' . $a->getData()['zb']['prize'][$ai['zb_n']]; $nagrtxt .= 'Жетон успеха X' . $a->getData()['zb']['prize'][$ai['zb_n']];
} elseif ( //Хаот задание vx } elseif ( //Хаот задание vx
@ -33,7 +33,7 @@ if (isset($_GET['nagr'])) {
$ai['klasvx'] > $ai['vx_n'] $ai['klasvx'] > $ai['vx_n']
) { ) {
$ai['vx_n'] += 1; $ai['vx_n'] += 1;
$a->updateTier('vx_n'); $a->updateTier('vx');
$u->addEkr($a->getData()['vx']['prize'][$ai['vx_n']]); $u->addEkr($a->getData()['vx']['prize'][$ai['vx_n']]);
$nagrtxt .= $a->getData()['vx']['prize'][$ai['vx_n']] . $a->getData()['vx']['prize'][0]; $nagrtxt .= $a->getData()['vx']['prize'][$ai['vx_n']] . $a->getData()['vx']['prize'][0];
} elseif ( //Сундуки трупожора snt } elseif ( //Сундуки трупожора snt
@ -42,7 +42,7 @@ if (isset($_GET['nagr'])) {
$ai['klassnt'] > $ai['snt_n'] $ai['klassnt'] > $ai['snt_n']
) { ) {
$ai['snt_n'] += 1; $ai['snt_n'] += 1;
$a->updateTier('snt_n'); $a->updateTier('snt');
$u->addEkr($a->getData()['snt']['prize'][$ai['snt_n']]); $u->addEkr($a->getData()['snt']['prize'][$ai['snt_n']]);
$nagrtxt .= $a->getData()['snt']['prize'][$ai['snt_n']] . $a->getData()['snt']['prize'][0]; $nagrtxt .= $a->getData()['snt']['prize'][$ai['snt_n']] . $a->getData()['snt']['prize'][0];
} elseif ( //Руны 8 лвл. rp } elseif ( //Руны 8 лвл. rp
@ -51,7 +51,7 @@ if (isset($_GET['nagr'])) {
$ai['klasrp'] > $ai['rp_n'] $ai['klasrp'] > $ai['rp_n']
) { ) {
$ai['rp_n'] += 1; $ai['rp_n'] += 1;
$a->updateTier('rp_n'); $a->updateTier('rp');
$a->givePrizeItems(10038, 'rp'); $a->givePrizeItems(10038, 'rp');
$nagrtxt .= 'Плохие Заготовки X' . $a->getData()['rp']['prize'][$ai['rp_n']]; $nagrtxt .= 'Плохие Заготовки X' . $a->getData()['rp']['prize'][$ai['rp_n']];
} elseif ( //Руны 9 лвл. rn } elseif ( //Руны 9 лвл. rn
@ -60,7 +60,7 @@ if (isset($_GET['nagr'])) {
$ai['klasrn'] > $ai['rn_n'] $ai['klasrn'] > $ai['rn_n']
) { ) {
$ai['rn_n'] += 1; $ai['rn_n'] += 1;
$a->updateTier('rn_n'); $a->updateTier('rn');
$a->givePrizeItems(10039, 'rn'); $a->givePrizeItems(10039, 'rn');
$nagrtxt .= 'Нормальные Заготовки X' . $a->getData()['rn']['prize'][$ai['rn_n']]; $nagrtxt .= 'Нормальные Заготовки X' . $a->getData()['rn']['prize'][$ai['rn_n']];
} elseif ( //Руны 10 лвл. rb } elseif ( //Руны 10 лвл. rb
@ -69,7 +69,7 @@ if (isset($_GET['nagr'])) {
$ai['klasrb'] > $ai['rb_n'] $ai['klasrb'] > $ai['rb_n']
) { ) {
$ai['rb_n'] += 1; $ai['rb_n'] += 1;
$a->updateTier('rb_n'); $a->updateTier('rb');
$a->givePrizeItems(10040, 'rb'); $a->givePrizeItems(10040, 'rb');
$nagrtxt .= 'Идеальные Заготовки X' . $a->getData()['rb']['prize'][$ai['rb_n']]; $nagrtxt .= 'Идеальные Заготовки X' . $a->getData()['rb']['prize'][$ai['rb_n']];
} elseif ( //Героик pg } elseif ( //Героик pg
@ -78,7 +78,7 @@ if (isset($_GET['nagr'])) {
$ai['klaspg'] > $ai['pg_n'] $ai['klaspg'] > $ai['pg_n']
) { ) {
$ai['pg_n'] += 1; $ai['pg_n'] += 1;
$a->updateTier('pg_n'); $a->updateTier('pg');
$a->givePrizeItems(10020, 'pg'); $a->givePrizeItems(10020, 'pg');
$nagrtxt .= 'Жетон Успеха X' . $a->getData()['pg']['prize'][$ai['pg_n']]; $nagrtxt .= 'Жетон Успеха X' . $a->getData()['pg']['prize'][$ai['pg_n']];
} elseif ( //Продать бабушке найденные вещи в пещере bv } elseif ( //Продать бабушке найденные вещи в пещере bv
@ -87,7 +87,7 @@ if (isset($_GET['nagr'])) {
$ai['klasbv'] > $ai['bv_n'] $ai['klasbv'] > $ai['bv_n']
) { ) {
$ai['bv_n'] += 1; $ai['bv_n'] += 1;
$a->updateTier('bv_n'); $a->updateTier('bv');
$u->addKr($a->getData()['bv']['prize'][$ai['bv_n']]); $u->addKr($a->getData()['bv']['prize'][$ai['bv_n']]);
$nagrtxt .= $a->getData()['bv']['prize'][$ai['bv_n']] . $a->getData()['bv']['prize'][0]; $nagrtxt .= $a->getData()['bv']['prize'][$ai['bv_n']] . $a->getData()['bv']['prize'][0];
} elseif ( //Клан вар kw } elseif ( //Клан вар kw
@ -96,7 +96,7 @@ if (isset($_GET['nagr'])) {
$ai['klaskw'] > $ai['kw_n'] $ai['klaskw'] > $ai['kw_n']
) { ) {
$ai['kw_n'] += 1; $ai['kw_n'] += 1;
$a->updateTier('kw_n'); $a->updateTier('kw');
$a->givePrizeItems(4917, 'kw'); $a->givePrizeItems(4917, 'kw');
$nagrtxt .= 'Клановый опыт +50000 X' . $a->getData()['kw']['prize'][$ai['kw_n']]; $nagrtxt .= 'Клановый опыт +50000 X' . $a->getData()['kw']['prize'][$ai['kw_n']];
} elseif ( //Башня смерти задание bs } elseif ( //Башня смерти задание bs
@ -105,7 +105,7 @@ if (isset($_GET['nagr'])) {
$ai['klasbs'] > $ai['bs_n'] $ai['klasbs'] > $ai['bs_n']
) { ) {
$ai['bs_n'] += 1; $ai['bs_n'] += 1;
$a->updateTier('bs_n'); $a->updateTier('bs');
$u->addEkr($a->getData()['bs']['prize'][$ai['bs_n']]); $u->addEkr($a->getData()['bs']['prize'][$ai['bs_n']]);
$nagrtxt .= $a->getData()['bs']['prize'][$ai['bs_n']] . $a->getData()['bs']['prize'][0]; $nagrtxt .= $a->getData()['bs']['prize'][$ai['bs_n']] . $a->getData()['bs']['prize'][0];
} elseif ( //Турниры победы trn } elseif ( //Турниры победы trn
@ -114,7 +114,7 @@ if (isset($_GET['nagr'])) {
$ai['klastrn'] > $ai['trn_n'] $ai['klastrn'] > $ai['trn_n']
) { ) {
$ai['trn_n'] += 1; $ai['trn_n'] += 1;
$a->updateTier('trn_n'); $a->updateTier('trn');
$u->addEkr($a->getData()['trn']['prize'][$ai['trn_n']]); $u->addEkr($a->getData()['trn']['prize'][$ai['trn_n']]);
$nagrtxt .= $a->getData()['trn']['prize'][$ai['trn_n']] . $a->getData()['trn']['prize'][0]; $nagrtxt .= $a->getData()['trn']['prize'][$ai['trn_n']] . $a->getData()['trn']['prize'][0];
} }