refactor
This commit is contained in:
+339
-346
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace User;
|
||||
|
||||
use Core\Config;
|
||||
use Core\Db;
|
||||
use Helper\Conversion;
|
||||
use Item\Data\Bonuses;
|
||||
use Item\Data\Bonuses as ItemBonuses;
|
||||
use User;
|
||||
|
||||
class Stats
|
||||
@@ -118,27 +118,26 @@ class Stats
|
||||
/**
|
||||
* Присваиваем только разрешенные значения.
|
||||
*/
|
||||
private static function a(&$array, string $key, $value): array
|
||||
private static function a(&$array, string $key, $value): void
|
||||
{
|
||||
if (!in_array($key, array_keys(Bonuses::getBonusSystemNames()))) {
|
||||
return [];
|
||||
return;
|
||||
}
|
||||
$array[$key] = $value;
|
||||
return $array;
|
||||
}
|
||||
|
||||
public function getStats($uid, $i1 = null, $res = 0, $reimg = false, $btl_cache = false, $minimal = false): array
|
||||
public function getStats(int|array|null $uid = null, $i1 = 0, $res = 0, $reimg = false, $btl_cache = false): array
|
||||
{
|
||||
|
||||
if (is_array($uid)) {
|
||||
$u = $uid;
|
||||
} elseif ($uid != $this->u->info['id'] || $res == 1) {
|
||||
if (empty($uid) || $uid == $this->u->info['id'] && $res != 1) {
|
||||
//$u = $this->u->info;
|
||||
$u = User::getInfo($uid);
|
||||
} elseif (is_array($uid)) {
|
||||
$u = $uid;
|
||||
} else {
|
||||
$u = $this->u->info;
|
||||
$u = User::getInfo($uid);
|
||||
}
|
||||
|
||||
if (!isset($u['id'], $u['stats'])) {
|
||||
if (!isset($u['id'])) {
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -182,7 +181,7 @@ class Stats
|
||||
} else {
|
||||
$st['levels'] = 'undefined';
|
||||
}
|
||||
$st2 = [];
|
||||
|
||||
$st['id'] = $u['id'];
|
||||
$st['login'] = $u['login'];
|
||||
$st['lvl'] = $u['level'];
|
||||
@@ -207,6 +206,8 @@ class Stats
|
||||
}
|
||||
unset($stats);
|
||||
|
||||
$baseStats = $st;
|
||||
|
||||
//Шаблонные картинки
|
||||
if ($this->u->info['id'] === $u['id'] || $reimg) {
|
||||
$itemsImages = Db::getRows('select * from items_img where uid = ? and img_id != 0', [$u['id']]);
|
||||
@@ -228,7 +229,7 @@ class Stats
|
||||
item_id, inslot, useInBattle, btl_zd, iznosNOW, iznosMAX, magic_inci, name, items_users.id, img, `2h`
|
||||
from items_users left join items_main on items_main.id = item_id where inOdet != 0 and uid = ?', [$u['id']]);
|
||||
|
||||
$ia = ItemBonuses::getBonusSystemNames();
|
||||
$ia = Bonuses::getBonusSystemNames();
|
||||
$h = 0;
|
||||
$hnd1 = 0;
|
||||
$hnd2 = 0;
|
||||
@@ -485,8 +486,8 @@ from items_users left join items_main on items_main.id = item_id where inOdet !=
|
||||
$i9 = 1;
|
||||
$i39[0] = 1;
|
||||
while ($i9 <= 7) {
|
||||
$st['a' . $i9] = $st['a' . $i9] - $st2['a' . $i9] + $reitm[$i]['add_a' . $i9];
|
||||
$st['mg' . $i9] = $st['mg' . $i9] - $st2['mg' . $i9] + $reitm[$i]['add_mg' . $i9];
|
||||
$st['a' . $i9] = $st['a' . $i9] - $baseStats['a' . $i9] + $reitm[$i]['add_a' . $i9];
|
||||
$st['mg' . $i9] = $st['mg' . $i9] - $baseStats['mg' . $i9] + $reitm[$i]['add_mg' . $i9];
|
||||
$i9++;
|
||||
}
|
||||
} elseif (isset($reitm[$i]['sm_abil']) && $i39[1] == 0) {
|
||||
@@ -494,7 +495,7 @@ from items_users left join items_main on items_main.id = item_id where inOdet !=
|
||||
$i9 = 1;
|
||||
$i39[1] = 1;
|
||||
while ($i9 <= 12) {
|
||||
$st['s' . $i9] = $st['s' . $i9] - $st2['s' . $i9] + $reitm[$i]['add_s' . $i9];
|
||||
$st['s' . $i9] = $st['s' . $i9] - $baseStats['s' . $i9] + $reitm[$i]['add_s' . $i9];
|
||||
$i9++;
|
||||
}
|
||||
} elseif (isset($reitm[$i]['sm_skill2']) && $i39[2] == 0) {
|
||||
@@ -505,36 +506,7 @@ from items_users left join items_main on items_main.id = item_id where inOdet !=
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
|
||||
//Харки от иконок
|
||||
$efs = mysql_query(
|
||||
'SELECT * FROM `users_ico` WHERE `uid`="' . mysql_real_escape_string(
|
||||
$u['id']
|
||||
) . '" AND (`endTime` > "' . time() . '" OR `endTime` = 0)'
|
||||
);
|
||||
while ($e = mysql_fetch_array($efs)) {
|
||||
$sts = Conversion::dataStringToArray($e['bonus']);
|
||||
$i = 0;
|
||||
while ($i < count($ia)) {
|
||||
if (isset($ia[$i])) {
|
||||
if (!isset($sti[$ia[$i]])) {
|
||||
$sti[$ia[$i]] = 0;
|
||||
}
|
||||
if (!isset($sts['add_' . $ia[$i]])) {
|
||||
$sts['add_' . $ia[$i]] = 0;
|
||||
}
|
||||
|
||||
$sti[$ia[$i]] += intval($sts['add_' . $ia[$i]]);
|
||||
|
||||
if (!isset($st[$ia[$i]])) {
|
||||
$st[$ia[$i]] = 0;
|
||||
}
|
||||
//
|
||||
$st[$ia[$i]] += intval($sts['add_' . $ia[$i]]);
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}
|
||||
$st = $this->addMedalsBonuses($u['id'], $st);
|
||||
|
||||
$noeffectbattle = false;
|
||||
if ($u['battle'] > 0) {
|
||||
@@ -866,7 +838,10 @@ from items_users left join items_main on items_main.id = item_id where inOdet !=
|
||||
$st['act'] = 1;
|
||||
}
|
||||
}
|
||||
}//Характеристики от статов
|
||||
}
|
||||
|
||||
|
||||
//Характеристики от статов
|
||||
if (!isset($st['hpAll'])) {
|
||||
$st['hpAll'] = 0;
|
||||
}
|
||||
@@ -977,7 +952,8 @@ from items_users left join items_main on items_main.id = item_id where inOdet !=
|
||||
}
|
||||
$i++;
|
||||
}
|
||||
}//Бонусы статов
|
||||
}
|
||||
|
||||
//Замена свитков
|
||||
if ($u['autospell'] != 0 && $u['battle'] == 0) {
|
||||
//проверяем свитки
|
||||
@@ -1026,231 +1002,12 @@ from items_users left join items_main on items_main.id = item_id where inOdet !=
|
||||
[$i, $spe2g[$i], $u['id']]);
|
||||
}
|
||||
}
|
||||
}//Бонусы статов
|
||||
//ТУТ
|
||||
//сила
|
||||
if ($st['s1'] > 24 && $st['s1'] < 50) {
|
||||
$st['m2'] += 15;
|
||||
}
|
||||
if ($st['s1'] > 49 && $st['s1'] < 75) {
|
||||
$st['pa2'] += 2;
|
||||
$st['m2'] += 35;
|
||||
}
|
||||
if ($st['s1'] > 74 && $st['s1'] < 100) {
|
||||
$st['pa2'] += 5;
|
||||
$st['m2'] += 50;
|
||||
}
|
||||
if ($st['s1'] > 99 && $st['s1'] < 125) {
|
||||
$st['pa2'] += 8;
|
||||
$st['m2'] += 80;
|
||||
}
|
||||
if ($st['s1'] > 124 && $st['s1'] < 150) {
|
||||
$st['pa2'] += 12;
|
||||
$st['m2'] += 105;
|
||||
}
|
||||
if ($st['s1'] > 149 && $st['s1'] < 175) {
|
||||
$st['pa2'] += 17;
|
||||
$st['m7'] += 2;
|
||||
}
|
||||
if ($st['s1'] > 174 && $st['s1'] < 200) {
|
||||
$st['pa2'] += 23;
|
||||
$st['m7'] += 5;
|
||||
}
|
||||
if ($st['s1'] > 199) {
|
||||
$st['pa2'] += 30;
|
||||
$st['m7'] += 7;
|
||||
}
|
||||
if ($st['s2'] > 24 && $st['s2'] < 50) {
|
||||
$st['pa1'] += 2;
|
||||
$st['m4'] += 35;
|
||||
}
|
||||
if ($st['s2'] > 49 && $st['s2'] < 75) {
|
||||
$st['pa1'] += 5;
|
||||
$st['m2'] += 40;
|
||||
$st['m4'] += 75;
|
||||
}
|
||||
if ($st['s2'] > 74 && $st['s2'] < 100) {
|
||||
$st['pa1'] += 8;
|
||||
$st['m2'] += 65;
|
||||
$st['m4'] += 90;
|
||||
}
|
||||
if ($st['s2'] > 99 && $st['s2'] < 125) {
|
||||
$st['pa1'] += 12;
|
||||
$st['m2'] += 75;
|
||||
$st['m4'] += 105;
|
||||
}
|
||||
if ($st['s2'] > 124 && $st['s2'] < 150) {
|
||||
$st['pa1'] += 17;
|
||||
$st['m2'] += 85;
|
||||
$st['m4'] += 105;
|
||||
$st['m15'] += 1;
|
||||
}
|
||||
if ($st['s2'] > 149 && $st['s2'] < 175) {
|
||||
$st['pa1'] += 20;
|
||||
$st['m2'] += 110;
|
||||
$st['m4'] += 115;
|
||||
$st['m15'] += 2;
|
||||
}
|
||||
if ($st['s2'] > 174 && $st['s2'] < 200) {
|
||||
$st['pa1'] += 23;
|
||||
$st['m2'] += 145;
|
||||
$st['m4'] += 145;
|
||||
$st['m15'] += 3;
|
||||
}
|
||||
if ($st['s2'] > 199) {
|
||||
$st['pa1'] += 30;
|
||||
$st['m2'] += 165;
|
||||
$st['m4'] += 165;
|
||||
$st['m15'] += 5;
|
||||
}//интуиция
|
||||
if ($st['s3'] > 24 && $st['s3'] < 50) {
|
||||
$st['pa4'] += 2;
|
||||
$st['m3'] += 2;
|
||||
$st['m1'] += 25;
|
||||
}
|
||||
if ($st['s3'] > 49 && $st['s3'] < 75) {
|
||||
$st['pa4'] += 5;
|
||||
$st['m3'] += 5;
|
||||
$st['m1'] += 55;
|
||||
}
|
||||
if ($st['s3'] > 74 && $st['s3'] < 100) {
|
||||
$st['pa4'] += 8;
|
||||
$st['m3'] += 10;
|
||||
$st['m1'] += 75;
|
||||
$st['m5'] += 25;
|
||||
}
|
||||
if ($st['s3'] > 99 && $st['s3'] < 125) {
|
||||
$st['pa4'] += 12;
|
||||
$st['m3'] += 15;
|
||||
$st['m1'] += 105;
|
||||
$st['m5'] += 35;
|
||||
}
|
||||
if ($st['s3'] > 124 && $st['s3'] < 150) {
|
||||
$st['pa4'] += 17;
|
||||
$st['m3'] += 20;
|
||||
$st['m1'] += 125;
|
||||
$st['m5'] += 45;
|
||||
$st['m14'] += 1;
|
||||
}
|
||||
if ($st['s3'] > 149 && $st['s3'] < 175) {
|
||||
$st['pa4'] += 20;
|
||||
$st['m3'] += 30;
|
||||
$st['m1'] += 145;
|
||||
$st['m5'] += 50;
|
||||
$st['m14'] += 2;
|
||||
}
|
||||
if ($st['s3'] > 174 && $st['s3'] < 200) {
|
||||
$st['pa4'] += 23;
|
||||
$st['m3'] += 35;
|
||||
$st['m1'] += 165;
|
||||
$st['m5'] += 55;
|
||||
$st['m14'] += 3;
|
||||
}
|
||||
if ($st['s3'] > 199) {
|
||||
$st['pa4'] += 30;
|
||||
$st['m3'] += 40;
|
||||
$st['m1'] += 185;
|
||||
$st['m5'] += 65;
|
||||
$st['m14'] += 5;
|
||||
}//выносливость
|
||||
if ($st['s4'] > 0) {
|
||||
$st['hpAll'] += 30;
|
||||
}
|
||||
if ($st['s4'] > 24 && $st['s4'] < 50) {
|
||||
$st['hpAll'] += 50;
|
||||
}
|
||||
if ($st['s4'] > 49 && $st['s4'] < 75) {
|
||||
$st['hpAll'] += 100;
|
||||
}
|
||||
if ($st['s4'] > 74 && $st['s4'] < 100) {
|
||||
$st['hpAll'] += 175;
|
||||
$st['m19'] += 2;
|
||||
}
|
||||
if ($st['s4'] > 99 && $st['s4'] < 125) {
|
||||
$st['hpAll'] += 250;
|
||||
$st['m19'] += 4;
|
||||
}
|
||||
if ($st['s4'] > 124 && $st['s4'] < 150) {
|
||||
$st['hpAll'] += 400;
|
||||
$st['za'] += 25;
|
||||
$st['zm'] += 25;
|
||||
}
|
||||
if ($st['s4'] > 149 && $st['s4'] < 175) {
|
||||
$st['hpAll'] += 450;
|
||||
$st['za'] += 50;
|
||||
$st['zm'] += 50;
|
||||
}
|
||||
if ($st['s4'] > 174 && $st['s4'] < 200) {
|
||||
$st['hpAll'] += 600;
|
||||
$st['za'] += 100;
|
||||
$st['zm'] += 100;
|
||||
}
|
||||
if ($st['s4'] > 199) {
|
||||
$st['hpAll'] += 850;
|
||||
$st['za'] += 125;
|
||||
$st['zm'] += 125;
|
||||
}//интелект
|
||||
if ($st['s5'] > 24 && $st['s5'] < 50) {
|
||||
$st['m11'] += 10;
|
||||
}
|
||||
if ($st['s5'] > 49 && $st['s5'] < 75) {
|
||||
$st['m11'] += 15;
|
||||
}
|
||||
if ($st['s5'] > 74 && $st['s5'] < 100) {
|
||||
$st['m11'] += 20;
|
||||
}
|
||||
if ($st['s5'] > 99 && $st['s5'] < 125) {
|
||||
$st['m11'] += 25;
|
||||
}
|
||||
if ($st['s5'] > 124 && $st['s5'] < 150) {
|
||||
$st['m11'] += 35;
|
||||
}
|
||||
if ($st['s5'] > 149 && $st['s5'] < 175) {
|
||||
$st['m11'] += 50;
|
||||
}
|
||||
if ($st['s5'] > 174) {
|
||||
$st['m11'] += 65;
|
||||
$st['pzm'] += 2;
|
||||
}
|
||||
if ($st['s5'] > 199) {
|
||||
$st['pzm'] += 5;
|
||||
}//мудрость
|
||||
if ($st['s6'] > 24 && $st['s6'] < 50) {
|
||||
$st['mpAll'] += 150;
|
||||
$st['speedmp'] += 100;
|
||||
}
|
||||
if ($st['s6'] > 49 && $st['s6'] < 75) {
|
||||
$st['mpAll'] += 200;
|
||||
$st['speedmp'] += 200;
|
||||
}
|
||||
if ($st['s6'] > 74 && $st['s6'] < 100) {
|
||||
$st['mpAll'] += 250;
|
||||
$st['speedmp'] += 350;
|
||||
}
|
||||
if ($st['s6'] > 99 && $st['s6'] < 125) {
|
||||
$st['mpAll'] += 350;
|
||||
$st['speedmp'] += 500;
|
||||
}
|
||||
if ($st['s6'] > 124 && $st['s6'] < 150) {
|
||||
$st['mpAll'] += 500;
|
||||
$st['speedmp'] += 500;
|
||||
$st['pzm'] += 2;
|
||||
}
|
||||
if ($st['s6'] > 149 && $st['s6'] < 175) {
|
||||
$st['mpAll'] += 700;
|
||||
$st['speedmp'] += 600;
|
||||
$st['pzm'] += 3;
|
||||
}
|
||||
if ($st['s6'] > 174 && $st['s6'] < 200) {
|
||||
$st['mpAll'] += 900;
|
||||
$st['speedmp'] += 700;
|
||||
$st['pzm'] += 5;
|
||||
}
|
||||
if ($st['s6'] > 199) {
|
||||
$st['mpAll'] += 900;
|
||||
$st['speedmp'] += 700;
|
||||
$st['pzm'] += 7;
|
||||
}//если второе оружие одето
|
||||
|
||||
//Бонусы статов
|
||||
$this->addStatBonuses($st);
|
||||
|
||||
//если второе оружие одето
|
||||
if ($hnd2 == 1 && $hnd1 == 1) {
|
||||
$st['zona']++;
|
||||
}
|
||||
@@ -1399,75 +1156,16 @@ from items_users left join items_main on items_main.id = item_id where inOdet !=
|
||||
|
||||
$st['reting'] = 1 + ceil($st['reting']);
|
||||
|
||||
if ($st['vip'] > 0) { //$u
|
||||
$st['antm3'] += 20;
|
||||
$st['zaproc'] += 5;
|
||||
$st['zmproc'] += 5;
|
||||
$st['m10'] += 20;
|
||||
$st['pzm'] += 5;
|
||||
}
|
||||
|
||||
//Бонус от медалей
|
||||
$rep1 = mysql_fetch_array(
|
||||
mysql_query(
|
||||
'SELECT
|
||||
`add_slot`,`nu_sandcity`,`n_sandcity`,
|
||||
`dl1`,`id`,`rep1`,`repcapitalcity`,`repdemonscity`,`repangelscity`,`repabandonedplain`,
|
||||
`repdevilscity`,`repmooncity`,`repsuncity`,`repsandcity`,`repemeraldscity`,`repdreamscity`,`repizlom`,
|
||||
`n_capitalcity`,`n_demonscity`,`n_suncity`,`nu_demonscity`,`nu_angelscity`,`nu_abandonedplain`,`nu_emeraldscity`,
|
||||
`nu_capitalcity`,`nu_suncity`,`nu_devilscity`,`nu_dreamscity`,`add_stats`,`add_money`,`add_skills`,`add_skills2`,
|
||||
`rep3`,`rep3_buy`,`repdragonscity`,`n_dragonscity`,`nu_dragonscity`,
|
||||
(`repcapitalcity`+`repdemonscity`+`repangelscity`+`repsuncity`+`repdreamscity`+`repabandonedplain`+`repsandcity`+`repemeraldscity`+`repdevilscity`) as allrep,
|
||||
(`nu_capitalcity`+`nu_demonscity`+`nu_angelscity`+`nu_suncity`+`nu_dreamscity`+`nu_abandonedplain`+`nu_sandcity`+`nu_emeraldscity`+`nu_devilscity`) as allnurep FROM `rep` WHERE `id` = "' . $u['id'] . '" LIMIT 1'
|
||||
)
|
||||
);
|
||||
$this->addDungeonsBonuses($u['id'], $st);
|
||||
|
||||
if ($u['referals'] >= 3000) {
|
||||
$st['speedhp'] += 50;
|
||||
$st['speedmp'] += 50;
|
||||
$st['antm3'] += 25;
|
||||
$st['m10'] += 15;
|
||||
$st['m11'] += 15;
|
||||
$st['speed_dungeon'] += 25;
|
||||
$st['hpAll'] += 250;
|
||||
}//Водосток
|
||||
if ($rep1['repdreamscity'] >= 24999) {
|
||||
$st['m10'] += 10;
|
||||
$st['pzm'] += 1;
|
||||
}//излом
|
||||
if ($rep1['repizlom'] == 9999) {
|
||||
$st['m10'] += 10;
|
||||
$st['pzm'] += 1;
|
||||
}//Бездна
|
||||
if ($rep1['repangelscity'] == 25000) {
|
||||
$st['m10'] += 10;
|
||||
$st['pzm'] += 1;
|
||||
}//Катакомбы
|
||||
if ($rep1['repdemonscity'] == 25000) {
|
||||
$st['m10'] += 10;
|
||||
$st['pzm'] += 1;
|
||||
}//Грибница
|
||||
if ($rep1['repdemonscity'] == 25000) {
|
||||
$st['m10'] += 10;
|
||||
$st['pzm'] += 1;
|
||||
}//Пещера тысячи проклятий
|
||||
if ($rep1['repcapitalcity'] == 25000) {
|
||||
$st['m10'] += 10;
|
||||
$st['pzm'] += 1;
|
||||
}//Санд
|
||||
if ($rep1['repsandcity'] == 25000) {
|
||||
$st['m10'] += 10;
|
||||
$st['pzm'] += 1;
|
||||
}//Гора легиона
|
||||
if ($rep1['repabandonedplain'] == 24999) {
|
||||
$st['m10'] += 10;
|
||||
$st['pzm'] += 1;
|
||||
}//Добавочный подьем для игроков
|
||||
|
||||
//Добавочный подьем для игроков
|
||||
$st['maxves'] += 500;
|
||||
|
||||
if ($u['admin'] > 0) { // ускоренная регенерация и пробег по подземелью
|
||||
$st['speed_dungeon'] = 10000;
|
||||
$st['speedhp'] = 10000;
|
||||
$st['speed_dungeon'] = 1000;
|
||||
$st['speedhp'] = 1000;
|
||||
if ($u['battle']) {
|
||||
Db::sql("update stats set
|
||||
tactic1 = tactic2 = tactic3 = tactic4 = tactic5 = tactic6 = tactic7 = 25,
|
||||
@@ -1501,28 +1199,323 @@ from items_users left join items_main on items_main.id = item_id where inOdet !=
|
||||
$rt = [];
|
||||
if ($i1 == 1) {
|
||||
$rt[0] = $st;
|
||||
$rt[1] = $st2; //родные статы
|
||||
$rt[1] = $baseStats; //родные статы
|
||||
} else {
|
||||
$rt = $st;
|
||||
}
|
||||
if ($u['hpAll'] != $st['hpAll'] || $u['mpAll'] != $st['mpAll']) {
|
||||
mysql_query(
|
||||
'UPDATE `stats` SET `hpAll` = "' . $st['hpAll'] . '",`mpAll` = "' . $st['mpAll'] . '" WHERE `id` = "' . $u['id'] . '" LIMIT 1'
|
||||
);
|
||||
Db::sql('update stats set hpAll = ?, mpAll = ? where id = ?', [$st['hpAll'], $st['mpAll'], $u['id']]);
|
||||
}
|
||||
if ($btl_cache) {
|
||||
$dataca = [
|
||||
'st' => $st,
|
||||
'st2' => $st2,
|
||||
'st2' => $baseStats,
|
||||
];
|
||||
$dataca = json_encode($dataca);
|
||||
mysql_query(
|
||||
'INSERT INTO `battle_cache` (`uid`,`battle`,`data`,`time`) VALUES ("' . $u['id'] . '","' . $u['battle'] . '","' . mysql_real_escape_string(
|
||||
$dataca
|
||||
) . '","' . time() . '")'
|
||||
);
|
||||
Db::sql('insert into battle_cache (battle, uid, time, data) values (?,?,unix_timestamp(),?)', [$u['battle'], $u['id'], $dataca]);
|
||||
}
|
||||
|
||||
return $rt;
|
||||
}
|
||||
|
||||
private function addMedalsBonuses(int $uid, array &$st): array
|
||||
{
|
||||
//Харки от иконок
|
||||
|
||||
$efs = Db::getColumn('select bonus from users_ico where uid = ? and (endTime > unix_timestamp() or endTime = 0)', [$uid]);
|
||||
foreach ($efs as $data) {
|
||||
$sts = Conversion::dataStringToArray($data);
|
||||
foreach ($sts as $paramName => $value) {
|
||||
//todo убедиться, что не могут прилететь параметры, которых нет в словарей бонусов предметов
|
||||
if (!str_contains(implode(',', Bonuses::getBonusSystemNames()), 'add_' . $paramName)) { // есть ли параметр в разрешенных?
|
||||
continue;
|
||||
}
|
||||
if (empty($st['add_' . $paramName])) {
|
||||
$st['add_' . $paramName] = 0;
|
||||
}
|
||||
$st['add_' . $paramName] += (int)$value;
|
||||
}
|
||||
}
|
||||
return $st;
|
||||
}
|
||||
|
||||
private function addStatBonuses(array &$st): void
|
||||
{
|
||||
$this->addStrengthBonuses($st);
|
||||
$this->addDexterityBonuses($st);
|
||||
$this->addIntuitionBonuses($st);
|
||||
$this->addEnduranceBonuses($st);
|
||||
$this->addIntelligenceBonuses($st);
|
||||
$this->addWisdomBonuses($st);
|
||||
}
|
||||
|
||||
private function addStrengthBonuses(array &$st): void
|
||||
{
|
||||
if ($st['s1'] > 24 && $st['s1'] < 50) {
|
||||
$st['m2'] += 15;
|
||||
}
|
||||
if ($st['s1'] > 49 && $st['s1'] < 75) {
|
||||
$st['pa2'] += 2;
|
||||
$st['m2'] += 35;
|
||||
}
|
||||
if ($st['s1'] > 74 && $st['s1'] < 100) {
|
||||
$st['pa2'] += 5;
|
||||
$st['m2'] += 50;
|
||||
}
|
||||
if ($st['s1'] > 99 && $st['s1'] < 125) {
|
||||
$st['pa2'] += 8;
|
||||
$st['m2'] += 80;
|
||||
}
|
||||
if ($st['s1'] > 124 && $st['s1'] < 150) {
|
||||
$st['pa2'] += 12;
|
||||
$st['m2'] += 105;
|
||||
}
|
||||
if ($st['s1'] > 149 && $st['s1'] < 175) {
|
||||
$st['pa2'] += 17;
|
||||
$st['m7'] += 2;
|
||||
}
|
||||
if ($st['s1'] > 174 && $st['s1'] < 200) {
|
||||
$st['pa2'] += 23;
|
||||
$st['m7'] += 5;
|
||||
}
|
||||
if ($st['s1'] > 199) {
|
||||
$st['pa2'] += 30;
|
||||
$st['m7'] += 7;
|
||||
}
|
||||
}
|
||||
|
||||
private function addDexterityBonuses(array &$st): void
|
||||
{
|
||||
if ($st['s2'] > 24 && $st['s2'] < 50) {
|
||||
$st['pa1'] += 2;
|
||||
$st['m4'] += 35;
|
||||
}
|
||||
if ($st['s2'] > 49 && $st['s2'] < 75) {
|
||||
$st['pa1'] += 5;
|
||||
$st['m2'] += 40;
|
||||
$st['m4'] += 75;
|
||||
}
|
||||
if ($st['s2'] > 74 && $st['s2'] < 100) {
|
||||
$st['pa1'] += 8;
|
||||
$st['m2'] += 65;
|
||||
$st['m4'] += 90;
|
||||
}
|
||||
if ($st['s2'] > 99 && $st['s2'] < 125) {
|
||||
$st['pa1'] += 12;
|
||||
$st['m2'] += 75;
|
||||
$st['m4'] += 105;
|
||||
}
|
||||
if ($st['s2'] > 124 && $st['s2'] < 150) {
|
||||
$st['pa1'] += 17;
|
||||
$st['m2'] += 85;
|
||||
$st['m4'] += 105;
|
||||
$st['m15'] += 1;
|
||||
}
|
||||
if ($st['s2'] > 149 && $st['s2'] < 175) {
|
||||
$st['pa1'] += 20;
|
||||
$st['m2'] += 110;
|
||||
$st['m4'] += 115;
|
||||
$st['m15'] += 2;
|
||||
}
|
||||
if ($st['s2'] > 174 && $st['s2'] < 200) {
|
||||
$st['pa1'] += 23;
|
||||
$st['m2'] += 145;
|
||||
$st['m4'] += 145;
|
||||
$st['m15'] += 3;
|
||||
}
|
||||
if ($st['s2'] > 199) {
|
||||
$st['pa1'] += 30;
|
||||
$st['m2'] += 165;
|
||||
$st['m4'] += 165;
|
||||
$st['m15'] += 5;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private function addIntuitionBonuses(array &$st): void
|
||||
{
|
||||
//интуиция
|
||||
if ($st['s3'] > 24 && $st['s3'] < 50) {
|
||||
$st['pa4'] += 2;
|
||||
$st['m3'] += 2;
|
||||
$st['m1'] += 25;
|
||||
}
|
||||
if ($st['s3'] > 49 && $st['s3'] < 75) {
|
||||
$st['pa4'] += 5;
|
||||
$st['m3'] += 5;
|
||||
$st['m1'] += 55;
|
||||
}
|
||||
if ($st['s3'] > 74 && $st['s3'] < 100) {
|
||||
$st['pa4'] += 8;
|
||||
$st['m3'] += 10;
|
||||
$st['m1'] += 75;
|
||||
$st['m5'] += 25;
|
||||
}
|
||||
if ($st['s3'] > 99 && $st['s3'] < 125) {
|
||||
$st['pa4'] += 12;
|
||||
$st['m3'] += 15;
|
||||
$st['m1'] += 105;
|
||||
$st['m5'] += 35;
|
||||
}
|
||||
if ($st['s3'] > 124 && $st['s3'] < 150) {
|
||||
$st['pa4'] += 17;
|
||||
$st['m3'] += 20;
|
||||
$st['m1'] += 125;
|
||||
$st['m5'] += 45;
|
||||
$st['m14'] += 1;
|
||||
}
|
||||
if ($st['s3'] > 149 && $st['s3'] < 175) {
|
||||
$st['pa4'] += 20;
|
||||
$st['m3'] += 30;
|
||||
$st['m1'] += 145;
|
||||
$st['m5'] += 50;
|
||||
$st['m14'] += 2;
|
||||
}
|
||||
if ($st['s3'] > 174 && $st['s3'] < 200) {
|
||||
$st['pa4'] += 23;
|
||||
$st['m3'] += 35;
|
||||
$st['m1'] += 165;
|
||||
$st['m5'] += 55;
|
||||
$st['m14'] += 3;
|
||||
}
|
||||
if ($st['s3'] > 199) {
|
||||
$st['pa4'] += 30;
|
||||
$st['m3'] += 40;
|
||||
$st['m1'] += 185;
|
||||
$st['m5'] += 65;
|
||||
$st['m14'] += 5;
|
||||
}
|
||||
}
|
||||
|
||||
private function addEnduranceBonuses(array &$st): void
|
||||
{
|
||||
//выносливость
|
||||
if ($st['s4'] > 0) {
|
||||
$st['hpAll'] += 30;
|
||||
}
|
||||
if ($st['s4'] > 24 && $st['s4'] < 50) {
|
||||
$st['hpAll'] += 50;
|
||||
}
|
||||
if ($st['s4'] > 49 && $st['s4'] < 75) {
|
||||
$st['hpAll'] += 100;
|
||||
}
|
||||
if ($st['s4'] > 74 && $st['s4'] < 100) {
|
||||
$st['hpAll'] += 175;
|
||||
$st['m19'] += 2;
|
||||
}
|
||||
if ($st['s4'] > 99 && $st['s4'] < 125) {
|
||||
$st['hpAll'] += 250;
|
||||
$st['m19'] += 4;
|
||||
}
|
||||
if ($st['s4'] > 124 && $st['s4'] < 150) {
|
||||
$st['hpAll'] += 400;
|
||||
$st['za'] += 25;
|
||||
$st['zm'] += 25;
|
||||
}
|
||||
if ($st['s4'] > 149 && $st['s4'] < 175) {
|
||||
$st['hpAll'] += 450;
|
||||
$st['za'] += 50;
|
||||
$st['zm'] += 50;
|
||||
}
|
||||
if ($st['s4'] > 174 && $st['s4'] < 200) {
|
||||
$st['hpAll'] += 600;
|
||||
$st['za'] += 100;
|
||||
$st['zm'] += 100;
|
||||
}
|
||||
if ($st['s4'] > 199) {
|
||||
$st['hpAll'] += 850;
|
||||
$st['za'] += 125;
|
||||
$st['zm'] += 125;
|
||||
}
|
||||
}
|
||||
|
||||
private function addIntelligenceBonuses(array &$st): void
|
||||
{
|
||||
//интелект
|
||||
if ($st['s5'] > 24 && $st['s5'] < 50) {
|
||||
$st['m11'] += 10;
|
||||
}
|
||||
if ($st['s5'] > 49 && $st['s5'] < 75) {
|
||||
$st['m11'] += 15;
|
||||
}
|
||||
if ($st['s5'] > 74 && $st['s5'] < 100) {
|
||||
$st['m11'] += 20;
|
||||
}
|
||||
if ($st['s5'] > 99 && $st['s5'] < 125) {
|
||||
$st['m11'] += 25;
|
||||
}
|
||||
if ($st['s5'] > 124 && $st['s5'] < 150) {
|
||||
$st['m11'] += 35;
|
||||
}
|
||||
if ($st['s5'] > 149 && $st['s5'] < 175) {
|
||||
$st['m11'] += 50;
|
||||
}
|
||||
if ($st['s5'] > 174) {
|
||||
$st['m11'] += 65;
|
||||
$st['pzm'] += 2;
|
||||
}
|
||||
if ($st['s5'] > 199) {
|
||||
$st['pzm'] += 5;
|
||||
}
|
||||
}
|
||||
|
||||
private function addWisdomBonuses(array &$st): void
|
||||
{
|
||||
//мудрость
|
||||
if ($st['s6'] > 24 && $st['s6'] < 50) {
|
||||
$st['mpAll'] += 150;
|
||||
$st['speedmp'] += 100;
|
||||
}
|
||||
if ($st['s6'] > 49 && $st['s6'] < 75) {
|
||||
$st['mpAll'] += 200;
|
||||
$st['speedmp'] += 200;
|
||||
}
|
||||
if ($st['s6'] > 74 && $st['s6'] < 100) {
|
||||
$st['mpAll'] += 250;
|
||||
$st['speedmp'] += 350;
|
||||
}
|
||||
if ($st['s6'] > 99 && $st['s6'] < 125) {
|
||||
$st['mpAll'] += 350;
|
||||
$st['speedmp'] += 500;
|
||||
}
|
||||
if ($st['s6'] > 124 && $st['s6'] < 150) {
|
||||
$st['mpAll'] += 500;
|
||||
$st['speedmp'] += 500;
|
||||
$st['pzm'] += 2;
|
||||
}
|
||||
if ($st['s6'] > 149 && $st['s6'] < 175) {
|
||||
$st['mpAll'] += 700;
|
||||
$st['speedmp'] += 600;
|
||||
$st['pzm'] += 3;
|
||||
}
|
||||
if ($st['s6'] > 174 && $st['s6'] < 200) {
|
||||
$st['mpAll'] += 900;
|
||||
$st['speedmp'] += 700;
|
||||
$st['pzm'] += 5;
|
||||
}
|
||||
if ($st['s6'] > 199) {
|
||||
$st['mpAll'] += 900;
|
||||
$st['speedmp'] += 700;
|
||||
$st['pzm'] += 7;
|
||||
}
|
||||
}
|
||||
|
||||
private function addDungeonsBonuses(int $id, array &$st): void
|
||||
{
|
||||
$finishedDungeons = Db::getValue('select
|
||||
if(repcapitalcity > 24999, 1, 0) +
|
||||
if(repdemonscity > 24999, 1, 0) +
|
||||
if(repangelscity > 24999, 1, 0) +
|
||||
if(repdevilscity > 24999, 1, 0) +
|
||||
if(repmooncity > 24999, 1, 0) +
|
||||
if(repsuncity > 24999, 1, 0) +
|
||||
if(repsandcity > 24999, 1, 0) +
|
||||
if(repemeraldscity > 24999, 1, 0) +
|
||||
if(repizlom > 24999, 1, 0) +
|
||||
0 as finished from rep where id = ?', [$id]);
|
||||
|
||||
//Бонус за количество полностью вырытых пещер.
|
||||
$st['m10'] += 10 * $finishedDungeons;
|
||||
$st['pzm'] += $finishedDungeons;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user