65 lines
2.5 KiB
PHP
65 lines
2.5 KiB
PHP
|
<?php
|
|||
|
|
|||
|
namespace Insallah;
|
|||
|
|
|||
|
class Runes
|
|||
|
{
|
|||
|
public static function get($level)
|
|||
|
{
|
|||
|
if (!in_array($level, [8, 9, 10])) {
|
|||
|
return [];
|
|||
|
}
|
|||
|
$power = [8 => 3, 9 => 5, 10 => 7];
|
|||
|
$rand9 = array_rand(array_flip(['hpAll', 'm2', 'm5']));
|
|||
|
$runes = [
|
|||
|
['s1', 'pa2', $rand9, 'antm3'],
|
|||
|
['s1', 'pa3', $rand9, 'za'],
|
|||
|
['s2', 'pa1', $rand9, 'antm3'],
|
|||
|
['s2', 'pa1', $rand9, 'm3'],
|
|||
|
['s3', 'pa4', $rand9, 'm3'],
|
|||
|
['s5', 'm11', 'mpAll', 'pzm']
|
|||
|
];
|
|||
|
$vars = [
|
|||
|
's1' => ['<27><><EFBFBD><EFBFBD>', mt_rand(1, 3)],
|
|||
|
's2' => ['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', mt_rand(1, 3)],
|
|||
|
's3' => ['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', mt_rand(1, 3)],
|
|||
|
's5' => ['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', mt_rand(1, 3)],
|
|||
|
'pa1' => ['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>', mt_rand(1, $power[$level])],
|
|||
|
'pa2' => ['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>', mt_rand(1, $power[$level])],
|
|||
|
'pa3' => ['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>', mt_rand(1, $power[$level])],
|
|||
|
'pa4' => ['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD>', mt_rand(1, $power[$level])],
|
|||
|
'm2' => ['???', mt_rand(5, 15)],
|
|||
|
'm3' => ['<27><>', mt_rand(1, 3)],
|
|||
|
'antm3' => ['<27><><EFBFBD>', mt_rand(1, 3)],
|
|||
|
'm5' => ['???', mt_rand(5, 10)],
|
|||
|
'm11' => ['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>', mt_rand(1, $power[$level])],
|
|||
|
'hpAll' => ['HP', mt_rand(5, 15)],
|
|||
|
'mpAll' => ['MP', mt_rand(10, 20)],
|
|||
|
'pzm' => ['<27><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><> <20><><EFBFBD><EFBFBD><EFBFBD>', 1]
|
|||
|
];
|
|||
|
|
|||
|
$rune = $runes[array_rand($runes)]; // arr (s, pa\m, rand9\mpAll, other)
|
|||
|
$runeTxt = [$vars[$rune[0][0]], $vars[$rune[1][0]], $vars[$rune[2][0]], $vars[$rune[3][0]]];
|
|||
|
$runeVals = [$vars[$rune[0][1]], $vars[$rune[1][1]], $vars[$rune[2][1]], $vars[$rune[3][1]]];
|
|||
|
$resultRune = array_combine($rune, $runeVals);
|
|||
|
$resultText = array_combine($runeTxt, array_map('self::addPlus', $runeVals));
|
|||
|
if ($level < 10) { // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 4.
|
|||
|
array_pop($resultRune);
|
|||
|
array_pop($resultText);
|
|||
|
}
|
|||
|
if ($level < 9) { // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 3.
|
|||
|
array_pop($resultRune);
|
|||
|
array_pop($resultText);
|
|||
|
}
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> data <20> <20><><EFBFBD><EFBFBD>
|
|||
|
$returnData = '|' . http_build_query($resultRune, 'add_', '|');
|
|||
|
//<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> <20> <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>.
|
|||
|
$returnText = implode(', ', $resultText);
|
|||
|
return [$returnData, $returnText];
|
|||
|
}
|
|||
|
|
|||
|
private static function addPlus($var)
|
|||
|
{
|
|||
|
return '+' . (string)$var;
|
|||
|
}
|
|||
|
}
|