ロール

This commit is contained in:
2025-12-29 16:25:29 +09:00
parent 8c76fe2733
commit 863bdabf59
6 changed files with 99 additions and 13 deletions

View File

@@ -27,6 +27,89 @@ class Result {
}
}
class Roles {
// 例: if ($user->role & (Roles::STAFF | Roles::NINTENDONDA))
public const int BANNED = 0;
public const int MEMBER = 1 << 0; // 1
public const int NINTENDONDA = 1 << 1; // 2
public const int PLAYSTATIONNDA = 1 << 2; // 4
public const int STAFF = 1 << 3; // 8
public const int ADMIN = 1 << 7; // 128
}
$colorPalette = [
'ultradark' => [
'black' => '#020102',
'white' => '#b3b1b3',
'grey' => '#5c535c',
'yellow' => '#8d8b0d',
'orange' => '#724e0b',
'green' => '#1e6907',
'purple' => '#410a5a',
'lime' => '#198d5b',
'pink' => '#9e0ea3',
'cyan' => '#1e8c9b',
'red' => '#861623',
'blue' => '#164a85',
],
'dark' => [
'black' => '#120f12',
'white' => '#cfcbcf',
'grey' => '#746c75',
'yellow' => '#b8b515',
'orange' => '#ac7718',
'green' => '#2c980c',
'purple' => '#550f75',
'lime' => '#10c074',
'pink' => '#c016c6',
'cyan' => '#1cbcd0',
'red' => '#bc1729',
'blue' => '#1a6ecf',
],
'medium' => [
'black' => '#232023',
'white' => '#f6f6f6',
'grey' => '#988f98',
'yellow' => '#f1ed25',
'orange' => '#f7a717',
'green' => '#2de12c',
'purple' => '#b421f8',
'lime' => '#20f398',
'pink' => '#f545f5',
'cyan' => '#29d3ff',
'red' => '#ee4030',
'blue' => '#2687f7',
],
'light' => [
'black' => '#443b44',
'white' => '#fcfcfc',
'grey' => '#bdb4bd',
'yellow' => '#ecea71',
'orange' => '#f8c56a',
'green' => '#6cf344',
'purple' => '#ae6bdb',
'lime' => '#88ecc1',
'pink' => '#ea79d8',
'cyan' => '#8ae5ff',
'red' => '#f35869',
'blue' => '#6aa6eb',
],
'ultralight' => [
'black' => '#574d57',
'white' => '#ffffff',
'grey' => '#d6cfd6',
'yellow' => '#f5f4cf',
'orange' => '#f3d6a3',
'green' => '#baf3a8',
'purple' => '#d2bae2',
'lime' => '#b6e9d3',
'pink' => '#e6b9de',
'cyan' => '#c2e8f3',
'red' => '#ecb0b7',
'blue' => '#bbd4f0',
],
];
function uuid(): string {
$data = random_bytes(16);
$data[6] = chr(ord($data[6]) & 0x0f | 0x40);
@@ -214,12 +297,12 @@ function namecolor(\stdClass $userData): string {
$ungender = "#7C60B0";
$gender = 'color: '.($userData->gender === 0 ? $male : ($userData->gender === 1 ? $female : $ungender)).';';
$style = $userData->namecolor ?: ($userData->role >= 0 ? $gender : $ban);
$style = $userData->namecolor ?: ($userData->role !== Roles::BANNED ? $gender : 'color: '.$ban.';');
$showname = $userData->displayname ?: $userData->username;
$color = "<span style=\"{$style}\">{$showname}</span>";
if ($userData->role === 1) $color .= "<span style=\"font-size: x-small; background: #10c074; border: 1px solid #fcfcfc; border-radius: 10px; padding: 0 0.5em;\">✓</span>";
if ($userData->role & (Roles::ADMIN | Roles::STAFF)) $color .= "<span style=\"font-size: x-small; background: #10c074; border: 1px solid #fcfcfc; border-radius: 10px; padding: 0 0.5em;\">✓</span>";
$suffix = $userData->gender === 0 ? 'くん' : ($userData->gender === 1 ? 'ちゃん' : 'さん');