62 lines
1.7 KiB
PHP
62 lines
1.7 KiB
PHP
<?php
|
|
|
|
namespace FightRequest;
|
|
|
|
class FRHelper
|
|
{
|
|
/** Ń÷čňŕĺň đŕçđĺřĺííűĺ óđîâíč čăđîęîâ â ăđóďďîâűő çŕ˙âęŕő.
|
|
* @param int $type ňčď ôčëüňđŕ.
|
|
* @param int $userLevel óđîâĺíü čăđîęŕ ďîäŕţůĺăî çŕ˙âęó.
|
|
* @return object
|
|
*/
|
|
public static function getTeammatesLevel(int $type, int $userLevel): object
|
|
{
|
|
$min = 0;
|
|
$max = 21;
|
|
switch ($type) {
|
|
default:
|
|
break;
|
|
case 1: // ňîëüęî ěîĺăî č íčćĺ
|
|
$max = $userLevel;
|
|
break;
|
|
case 2: // ňîëüęî íčćĺ ěîĺăî
|
|
$max = $userLevel - 1;
|
|
break;
|
|
case 3: // ňîëüęî ěîĺăî
|
|
$min = $userLevel;
|
|
$max = $userLevel;
|
|
break;
|
|
case 4: // íĺ âűřĺ ěĺí˙ íŕ 1 óđîâĺíü
|
|
$min = $userLevel;
|
|
$max = $userLevel + 1;
|
|
break;
|
|
case 5: // íĺ íčćĺ ěĺí˙ íŕ 1 óđîâĺíü
|
|
$min = $userLevel - 1;
|
|
$max = $userLevel;
|
|
break;
|
|
case 6: // ěîé óđîâĺíü +- 1
|
|
$min = $userLevel - 1;
|
|
$max = $userLevel + 1;
|
|
break;
|
|
}
|
|
return (object)[
|
|
'min'=> $min,
|
|
'max'=> $max,
|
|
];
|
|
}
|
|
|
|
/** Ń÷čňŕĺň đŕçđĺřĺííűĺ óđîâíč čăđîęîâ â őŕîňč÷ĺńęčő çŕ˙âęŕő.
|
|
* @param int $type ňčď ôčëüňđŕ.
|
|
* @param int $userLevel óđîâĺíü čăđîęŕ ďîäŕţůĺăî çŕ˙âęó.
|
|
* @return object
|
|
*/
|
|
public static function getChaoticTeammatesLevel(int $type, int $userLevel): object
|
|
{
|
|
if (!in_array($type, [3, 6])) {
|
|
$type = 0;
|
|
}
|
|
return self::getTeammatesLevel($type, $userLevel);
|
|
}
|
|
}
|
|
|