* fixed bitshift by negative number issue when evaluating spell MiscValues

* defined upper limit for localeIds and also discard negative localeIds
* fixed eval error when parsing spell descriptions. Calculated numbers sadly can't be localized.
This commit is contained in:
Sarjuuk
2021-10-12 21:44:59 +02:00
parent ea25776225
commit fca627c408
4 changed files with 6 additions and 4 deletions

View File

@@ -324,6 +324,7 @@ define('PROFILER_CU_NEEDS_RESYNC', 0x10);
define('MAX_LEVEL', 80);
define('MAX_SKILL', 450);
define('MAX_LOCALES', 16); // technical limitation, 6 in use here
define('WOW_BUILD', 12340);
// Loot handles

View File

@@ -253,7 +253,8 @@ if (!CLI)
// all strings attached..
if (!empty($AoWoWconf['aowow']))
{
if (isset($_GET['locale']) && (CFG_LOCALES & (1 << (int)$_GET['locale'])))
if (isset($_GET['locale']) && (int)$_GET['locale'] <= MAX_LOCALES && (int)$_GET['locale'] >= 0)
if (CFG_LOCALES & (1 << $_GET['locale']))
User::useLocale($_GET['locale']);
Lang::load(User::$localeString);

View File

@@ -1440,7 +1440,7 @@ class SpellList extends BaseType
// step 3: try to evaluate result
$evaled = $this->resolveEvaluation($str);
$return = is_numeric($evaled) ? Lang::nf($evaled, $precision, true) : $evaled;
$return = is_numeric($evaled) ? round($evaled, $precision) : $evaled;
return [$return, $fSuffix, $fRating];
}

View File

@@ -1906,7 +1906,7 @@ class SpellPage extends GenericPage
case 212: // Mod Ranged Attack Power Of Stat Percent
case 219: // Mod Mana Regeneration from Stat
case 268: // Mod Attack Power Of Stat Percent
$mask = $effMV == -1 ? 0x1F : 1 << $effMV;
$mask = $effMV < 0 ? 0x1F : 1 << $effMV;
$_ = [];
for ($j = 0; $j < 5; $j++)
if ($mask & (1 << $j))