Misc/Cleanup

* could have sworn there were more blobs to be indexed..
This commit is contained in:
Sarjuuk 2025-12-26 18:58:43 +01:00
parent 9bbe95d5e8
commit 69b8fdcc27
3 changed files with 14 additions and 13 deletions

View file

@ -743,14 +743,7 @@ class Profiler
DB::Aowow()->query('DELETE FROM ?_profiler_completion_titles WHERE `id` = ?d', $profileId);
$tBlocks = explode(' ', $char['knownTitles']);
$indizes = [];
for ($i = 0; $i < 6; $i++)
for ($j = 0; $j < 32; $j++)
if ($tBlocks[$i] & (1 << $j))
$indizes[] = $j + ($i * 32);
if ($indizes)
if ($indizes = Util::indexBitBlob($char['knownTitles']))
DB::Aowow()->query('INSERT INTO ?_profiler_completion_titles SELECT ?d, `id` FROM ?_titles WHERE `bitIdx` IN (?a)', $profileId, $indizes);
CLI::write(' ..titles');

View file

@ -29,11 +29,7 @@ class SkillList extends DBTypeList
if (!$_)
$_ = [0, 0, 0, 0, 0];
else
{
$_ = explode(' ', $_);
while (count($_) < 5)
$_[] = 0;
}
$_ = array_pad(explode(' ', $_), 5, 0);
if (!$_curTpl['iconId'])
$_curTpl['iconString'] = DEFAULT_ICON;

View file

@ -1051,6 +1051,18 @@ abstract class Util
return $bits;
}
public static function indexBitBlob(string $bitBlob, int $blobSize = 32) : array
{
$indizes = [];
$blocks = explode(' ', $bitBlob);
for ($i = 0; $i < count($blocks); $i++)
for ($j = 0; $j < $blobSize; $j++)
if ($blocks[$i] & (1 << $j))
$indizes[] = $j + ($i * $blobSize);
return $indizes;
}
public static function toString(mixed $var) : string
{
if (is_array($var))