Claude Code 最近更新了一个 /buddy 功能,可以领养一只专属小宠物。
想换一只但是官方没给重置入口。那就只能自己动手了。
完整代码如下,参考 linux.do/t/topic/187…
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>重生之宠物归来</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
<style>
:root {
--bg-primary: #0f0f1a;
--bg-secondary: #1a1a2e;
--bg-card: #16162a;
--bg-card-hover: #1f1f3a;
--border: #2a2a4a;
--border-hover: #3a3a5a;
--text-primary: #f0f0f5;
--text-secondary: #a0a0b0;
--text-muted: #6a6a8a;
--accent: #7c3aed;
--accent-hover: #8b5cf6;
--accent-glow: rgba(124, 58, 237, 0.3);
--common: #94a3b8;
--uncommon: #4ade80;
--rare: #60a5fa;
--epic: #c084fc;
--legendary: #fbbf24;
--success: #4ade80;
--error: #f87171;
--gradient-1: linear-gradient(135deg, #7c3aed 0%, #ec4899 50%, #f59e0b 100%);
--gradient-2: linear-gradient(135deg, #1a1a2e 0%, #16162a 100%);
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
background: var(--bg-primary);
background-image:
radial-gradient(ellipse at top, rgba(124, 58, 237, 0.15) 0%, transparent 50%),
radial-gradient(ellipse at bottom, rgba(236, 72, 153, 0.1) 0%, transparent 50%);
color: var(--text-primary);
min-height: 100vh;
line-height: 1.6;
}
.app {
max-width: 1200px;
margin: 0 auto;
padding: 2rem;
}
header {
text-align: center;
margin-bottom: 3rem;
padding-top: 2rem;
position: relative;
}
header::before {
content: '';
position: absolute;
top: -50%;
left: 50%;
transform: translateX(-50%);
width: 200px;
height: 200px;
background: var(--accent);
filter: blur(150px);
opacity: 0.3;
pointer-events: none;
}
h1 {
font-size: 2.75rem;
font-weight: 800;
background: var(--gradient-1);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
margin-bottom: 0.75rem;
letter-spacing: -0.02em;
text-shadow: 0 0 80px rgba(124, 58, 237, 0.5);
}
.subtitle {
color: var(--text-secondary);
font-size: 1rem;
font-weight: 400;
background: linear-gradient(90deg, var(--text-secondary) 0%, var(--text-muted) 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}
.main-grid {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 2rem;
align-items: start;
}
@media (max-width: 900px) {
.main-grid {
grid-template-columns: 1fr;
}
}
@media (max-width: 600px) {
.app {
padding: 1rem;
}
h1 {
font-size: 1.5rem;
}
.subtitle {
font-size: 0.9rem;
}
.species-grid {
grid-template-columns: repeat(auto-fill, minmax(65px, 1fr));
}
.species-btn {
padding: 0.625rem 0.25rem;
font-size: 0.75rem;
}
.species-btn .emoji {
font-size: 1.25rem;
}
.rarity-row {
justify-content: center;
}
.rarity-pill {
padding: 0.5rem 0.75rem;
font-size: 0.75rem;
}
.hat-grid {
grid-template-columns: repeat(auto-fill, minmax(65px, 1fr));
}
.hat-btn {
padding: 0.625rem 0.25rem;
font-size: 0.7rem;
}
.hat-btn .emoji {
font-size: 1.25rem;
}
.mode-cards {
grid-template-columns: 1fr;
}
.result-body {
grid-template-columns: 1fr;
}
.result-item[style*="grid-column: span 2"] {
grid-column: 1;
}
.stats-grid {
grid-template-columns: repeat(2, 1fr) !important;
}
.stat-item {
padding: 0.35rem 0.25rem;
}
.stat-name {
font-size: 0.55rem;
}
.stat-value {
font-size: 0.85rem;
}
}
.panel {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 20px;
padding: 1.5rem;
box-shadow:
0 4px 24px rgba(0, 0, 0, 0.3),
inset 0 1px 0 rgba(255, 255, 255, 0.05);
backdrop-filter: blur(10px);
transition: all 0.3s ease;
}
.panel:hover {
border-color: var(--border-hover);
box-shadow:
0 8px 32px rgba(0, 0, 0, 0.4),
inset 0 1px 0 rgba(255, 255, 255, 0.05),
0 0 20px var(--accent-glow);
}
.panel-header {
display: flex;
align-items: center;
gap: 0.75rem;
margin-bottom: 1.5rem;
padding-bottom: 1rem;
border-bottom: 1px solid var(--border);
position: relative;
}
.panel-header::after {
content: '';
position: absolute;
bottom: -1px;
left: 0;
width: 60px;
height: 2px;
background: var(--gradient-1);
}
.panel-icon {
width: 40px;
height: 40px;
background: var(--gradient-1);
border-radius: 12px;
display: flex;
align-items: center;
justify-content: center;
font-size: 1.25rem;
box-shadow: 0 4px 12px var(--accent-glow);
}
.panel-title {
font-size: 1.2rem;
font-weight: 700;
color: var(--text-primary);
letter-spacing: -0.01em;
}
.config-section {
margin-bottom: 1rem;
}
.config-section:last-child {
margin-bottom: 0;
}
.section-label {
font-size: 0.75rem;
font-weight: 700;
text-transform: uppercase;
letter-spacing: 0.08em;
color: var(--text-muted);
margin-bottom: 1rem;
display: flex;
align-items: center;
gap: 0.5rem;
}
.section-label::before {
content: '';
width: 3px;
height: 12px;
background: var(--gradient-1);
border-radius: 2px;
}
/* Species Grid */
.species-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
gap: 0.5rem;
}
.species-btn {
background: var(--bg-secondary);
border: 1px solid var(--border);
border-radius: 12px;
padding: 0.875rem 0.5rem;
color: var(--text-secondary);
font-size: 0.85rem;
cursor: pointer;
transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
text-align: center;
position: relative;
overflow: hidden;
}
.species-btn::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: var(--gradient-2);
opacity: 0;
transition: opacity 0.25s ease;
}
.species-btn:hover {
background: var(--bg-card-hover);
border-color: var(--accent);
color: var(--text-primary);
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.species-btn:hover::before {
opacity: 0.5;
}
.species-btn.selected {
background: var(--accent);
border-color: var(--accent);
color: white;
box-shadow: 0 4px 16px var(--accent-glow);
transform: translateY(-2px);
}
.species-btn .emoji {
display: block;
font-size: 1.75rem;
margin-bottom: 0.25rem;
filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}
/* Rarity Pills */
.rarity-row {
display: flex;
gap: 0.5rem;
flex-wrap: wrap;
}
.rarity-pill {
padding: 0.625rem 1.25rem;
border-radius: 20px;
border: 2px solid;
font-size: 0.875rem;
font-weight: 600;
cursor: pointer;
transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
background: transparent;
position: relative;
overflow: hidden;
}
.rarity-pill::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
opacity: 0;
transition: opacity 0.25s ease;
}
.rarity-pill[data-rarity="common"] {
border-color: var(--common);
color: var(--common);
}
.rarity-pill[data-rarity="uncommon"] {
border-color: var(--uncommon);
color: var(--uncommon);
}
.rarity-pill[data-rarity="rare"] {
border-color: var(--rare);
color: var(--rare);
}
.rarity-pill[data-rarity="epic"] {
border-color: var(--epic);
color: var(--epic);
}
.rarity-pill[data-rarity="legendary"] {
border-color: var(--legendary);
color: var(--legendary);
}
.rarity-pill:hover {
transform: scale(1.05);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.rarity-pill.selected::before {
opacity: 0.2;
}
.rarity-pill.selected[data-rarity="common"] {
background: var(--common);
color: #0f0f1a;
box-shadow: 0 4px 16px rgba(148, 163, 184, 0.5);
}
.rarity-pill.selected[data-rarity="uncommon"] {
background: var(--uncommon);
color: #0f0f1a;
box-shadow: 0 4px 16px rgba(74, 222, 128, 0.5);
}
.rarity-pill.selected[data-rarity="rare"] {
background: var(--rare);
color: #0f0f1a;
box-shadow: 0 4px 16px rgba(96, 165, 250, 0.5);
}
.rarity-pill.selected[data-rarity="epic"] {
background: var(--epic);
color: #0f0f1a;
box-shadow: 0 4px 16px rgba(192, 132, 252, 0.5);
}
.rarity-pill.selected[data-rarity="legendary"] {
background: var(--legendary);
color: #0f0f1a;
box-shadow: 0 4px 16px rgba(251, 191, 36, 0.5);
}
/* Eye Selection */
.icon-grid {
display: flex;
gap: 0.5rem;
flex-wrap: wrap;
}
.icon-btn {
width: 52px;
height: 52px;
background: var(--bg-secondary);
border: 2px solid var(--border);
border-radius: 14px;
color: var(--text-primary);
font-size: 1.5rem;
cursor: pointer;
transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.icon-btn:hover {
background: var(--bg-card-hover);
border-color: var(--accent);
transform: scale(1.1) rotate(5deg);
box-shadow: 0 6px 20px var(--accent-glow);
}
.icon-btn.selected {
background: var(--accent);
border-color: var(--accent);
color: white;
box-shadow: 0 4px 16px var(--accent-glow);
transform: scale(1.05);
}
/* Hat Grid */
.hat-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
gap: 0.5rem;
}
.hat-btn {
background: var(--bg-secondary);
border: 1px solid var(--border);
border-radius: 12px;
padding: 0.875rem 0.5rem;
color: var(--text-secondary);
font-size: 0.8rem;
cursor: pointer;
transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
text-align: center;
position: relative;
overflow: hidden;
}
.hat-btn:hover {
background: var(--bg-card-hover);
border-color: var(--accent);
color: var(--text-primary);
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.hat-btn.selected {
background: var(--accent);
border-color: var(--accent);
color: white;
box-shadow: 0 4px 16px var(--accent-glow);
transform: translateY(-2px);
}
.hat-btn .emoji {
display: block;
font-size: 1.75rem;
margin-bottom: 0.25rem;
filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}
/* Toggle */
.toggle-group {
display: flex;
gap: 0.5rem;
}
.toggle-btn {
flex: 1;
padding: 0.875rem 1rem;
background: var(--bg-secondary);
border: 2px solid var(--border);
border-radius: 12px;
color: var(--text-secondary);
font-size: 0.9rem;
font-weight: 600;
cursor: pointer;
transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.toggle-btn:hover {
background: var(--bg-card-hover);
border-color: var(--accent);
transform: translateY(-1px);
}
.toggle-btn.selected {
background: var(--accent);
border-color: var(--accent);
color: white;
box-shadow: 0 4px 16px var(--accent-glow);
}
/* Mode Selection */
.mode-cards {
display: grid;
grid-template-columns: 1fr 1fr;
gap: 0.75rem;
}
.mode-card {
background: var(--bg-secondary);
border: 2px solid var(--border);
border-radius: 14px;
padding: 1rem;
cursor: pointer;
transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
text-align: center;
position: relative;
overflow: hidden;
}
.mode-card::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
height: 3px;
background: var(--gradient-1);
opacity: 0;
transition: opacity 0.25s ease;
}
.mode-card:hover {
border-color: var(--accent);
transform: translateY(-4px);
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.mode-card:hover::before {
opacity: 1;
}
.mode-card.selected {
border-color: var(--accent);
background: rgba(99, 102, 241, 0.12);
box-shadow: 0 4px 20px var(--accent-glow);
}
.mode-card.selected::before {
opacity: 1;
}
.mode-card .icon {
font-size: 1.5rem;
margin-bottom: 0.375rem;
filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}
.mode-card .label {
font-weight: 700;
font-size: 0.95rem;
margin-bottom: 0.25rem;
color: var(--text-primary);
}
.mode-card .desc {
font-size: 0.75rem;
color: var(--text-muted);
}
/* Number Input */
.number-input {
display: flex;
align-items: center;
gap: 0.75rem;
}
.number-input input {
flex: 1;
background: var(--bg-secondary);
border: 2px solid var(--border);
border-radius: 12px;
padding: 0.875rem 1rem;
color: var(--text-primary);
font-family: 'JetBrains Mono', monospace;
font-size: 0.9rem;
outline: none;
transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.number-input input:focus {
border-color: var(--accent);
box-shadow: 0 0 0 4px var(--accent-glow);
transform: translateY(-1px);
}
.number-input label {
font-size: 0.85rem;
color: var(--text-secondary);
min-width: 80px;
font-weight: 500;
}
/* Run Panel */
.run-panel {
margin-top: 1rem;
}
.run-btn {
width: 100%;
padding: 1.25rem 2rem;
background: var(--gradient-1);
background-size: 200% 200%;
border: none;
border-radius: 14px;
color: white;
font-size: 1.15rem;
font-weight: 700;
cursor: pointer;
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
display: flex;
align-items: center;
justify-content: center;
gap: 0.75rem;
position: relative;
overflow: hidden;
animation: gradient-shift 3s ease infinite;
}
.run-btn::before {
content: '';
position: absolute;
top: 0;
left: -100%;
width: 100%;
height: 100%;
background: linear-gradient(
90deg,
transparent,
rgba(255, 255, 255, 0.2),
transparent
);
transition: left 0.5s ease;
}
.run-btn:hover {
transform: translateY(-4px);
box-shadow: 0 8px 32px var(--accent-glow);
background-position: 100% 100%;
}
.run-btn:hover::before {
left: 100%;
}
.run-btn:disabled {
opacity: 0.5;
cursor: not-allowed;
transform: none;
}
/* Output */
.output-area {
background: var(--bg-secondary);
border: 2px solid var(--border);
border-radius: 14px;
padding: 1.25rem;
min-height: 280px;
max-height: 400px;
overflow: auto;
font-family: 'JetBrains Mono', monospace;
font-size: 0.85rem;
box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.2);
}
.output-area::-webkit-scrollbar {
width: 8px;
}
.output-area::-webkit-scrollbar-track {
background: var(--bg-card);
border-radius: 4px;
}
.output-area::-webkit-scrollbar-thumb {
background: var(--accent);
border-radius: 4px;
}
.output-area:empty::before {
content: '等待结果中...';
color: var(--text-muted);
font-style: italic;
}
.output-line {
padding: 0.5rem 0;
border-bottom: 1px solid var(--border);
color: var(--text-secondary);
}
.output-line:last-child {
border-bottom: none;
}
.output-line code {
background: var(--bg-card);
padding: 0.25rem 0.5rem;
border-radius: 6px;
color: var(--accent);
font-size: 0.85rem;
}
.output-line strong {
color: var(--text-primary);
}
.output-success {
color: var(--success);
font-weight: 600;
}
.output-error {
color: var(--error);
font-weight: 600;
}
.attempts-badge {
display: inline-block;
background: var(--gradient-1);
color: white;
padding: 0.375rem 0.875rem;
border-radius: 16px;
font-size: 0.8rem;
font-weight: 600;
box-shadow: 0 2px 8px rgba(124, 58, 237, 0.4);
}
.copy-btn {
background: var(--bg-secondary);
border: 1px solid var(--border);
border-radius: 8px;
padding: 0.375rem 0.75rem;
color: var(--text-secondary);
font-size: 0.8rem;
font-weight: 500;
cursor: pointer;
transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.copy-btn:hover {
background: var(--accent);
border-color: var(--accent);
color: white;
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(124, 58, 237, 0.4);
}
.copy-btn.copied {
background: var(--success);
border-color: var(--success);
color: white;
}
/* Spinning animation */
.spinner {
width: 20px;
height: 20px;
border: 2px solid rgba(255,255,255,0.3);
border-top-color: white;
border-radius: 50%;
animation: spin 0.8s linear infinite;
}
@keyframes spin {
to { transform: rotate(360deg); }
}
@keyframes gradient-shift {
0% { background-position: 0% 50%; }
50% { background-position: 100% 50%; }
100% { background-position: 0% 50%; }
}
/* Clear button */
.clear-btn {
background: var(--bg-secondary);
border: 1px solid var(--border);
border-radius: 10px;
padding: 0.625rem 1.25rem;
color: var(--text-secondary);
font-size: 0.85rem;
font-weight: 500;
cursor: pointer;
transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}
.clear-btn:hover {
background: var(--bg-card-hover);
border-color: var(--accent);
color: var(--text-primary);
transform: translateY(-1px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}
.panel-header-actions {
margin-left: auto;
}
/* Result card styling */
.result-card {
background: var(--bg-card);
border: 1px solid var(--border);
border-radius: 12px;
padding: 1rem;
margin-bottom: 1rem;
transition: all 0.2s ease;
}
.result-card:last-child {
margin-bottom: 0;
}
.result-card:hover {
border-color: var(--accent);
box-shadow: 0 4px 20px rgba(124, 58, 237, 0.2);
}
.result-header {
display: flex;
align-items: center;
gap: 0.75rem;
margin-bottom: 0.75rem;
flex-wrap: wrap;
}
.result-index {
background: var(--gradient-1);
color: white;
width: 28px;
height: 28px;
border-radius: 8px;
display: flex;
align-items: center;
justify-content: center;
font-weight: 700;
font-size: 0.9rem;
flex-shrink: 0;
}
.result-info {
display: flex;
align-items: center;
gap: 0.5rem;
flex-wrap: wrap;
flex: 1;
}
.result-body {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
gap: 0.5rem;
margin-bottom: 0.75rem;
}
.result-item {
display: flex;
flex-direction: column;
gap: 0.25rem;
padding: 0.5rem;
background: var(--bg-secondary);
border-radius: 8px;
border: 1px solid var(--border);
}
.result-label {
font-size: 0.7rem;
color: var(--text-muted);
text-transform: uppercase;
letter-spacing: 0.05em;
font-weight: 600;
}
.result-value {
font-size: 0.9rem;
color: var(--text-primary);
font-weight: 500;
display: flex;
align-items: center;
gap: 0.375rem;
word-break: break-all;
}
.result-value code {
background: var(--bg-primary);
padding: 0.25rem 0.5rem;
border-radius: 6px;
color: var(--accent);
font-family: 'JetBrains Mono', monospace;
font-size: 0.85rem;
word-break: break-all;
}
.rarity-badge {
display: inline-block;
padding: 0.2rem 0.6rem;
border-radius: 12px;
font-size: 0.75rem;
font-weight: 600;
text-transform: capitalize;
}
.rarity-badge.common { background: rgba(148, 163, 184, 0.3); color: var(--common); }
.rarity-badge.uncommon { background: rgba(74, 222, 128, 0.2); color: var(--uncommon); }
.rarity-badge.rare { background: rgba(96, 165, 250, 0.2); color: var(--rare); }
.rarity-badge.epic { background: rgba(192, 132, 252, 0.2); color: var(--epic); }
.rarity-badge.legendary { background: rgba(251, 191, 36, 0.2); color: var(--legendary); }
.shiny-badge {
display: inline-block;
padding: 0.2rem 0.6rem;
border-radius: 12px;
font-size: 0.75rem;
font-weight: 600;
background: rgba(251, 191, 36, 0.2);
color: var(--legendary);
}
/* Stats grid */
.stats-grid {
display: grid;
grid-template-columns: repeat(5, 1fr);
gap: 0.5rem;
margin-top: 0.75rem;
}
.stat-item {
text-align: center;
padding: 0.5rem;
background: var(--bg-primary);
border-radius: 8px;
border: 1px solid var(--border);
}
.stat-name {
font-size: 0.65rem;
color: var(--text-muted);
text-transform: uppercase;
letter-spacing: 0.03em;
margin-bottom: 0.25rem;
}
.stat-value {
font-size: 1rem;
font-weight: 700;
color: var(--text-primary);
}
.stat-item.highlight .stat-value {
color: var(--accent);
}
details {
margin-top: 0.75rem;
border-top: 1px solid var(--border);
padding-top: 0.75rem;
}
details[open] summary {
margin-bottom: 0.75rem;
}
summary {
cursor: pointer;
font-weight: 600;
color: var(--accent);
user-select: none;
list-style: none;
display: flex;
align-items: center;
gap: 0.5rem;
transition: color 0.2s ease;
}
summary::-webkit-details-marker {
display: none;
}
summary::before {
content: '📊';
font-size: 1rem;
transition: transform 0.2s ease;
}
details[open] summary::before {
transform: rotate(90deg);
}
summary:hover {
color: var(--accent-hover);
}
pre {
background: var(--bg-primary) !important;
border: 1px solid var(--border);
border-radius: 8px;
padding: 0.75rem !important;
overflow-x: auto;
margin-top: 0.75rem !important;
}
/* Scrollbar styling */
::-webkit-scrollbar {
width: 10px;
height: 10px;
}
::-webkit-scrollbar-track {
background: var(--bg-card);
}
::-webkit-scrollbar-thumb {
background: var(--border-hover);
border-radius: 5px;
}
::-webkit-scrollbar-thumb:hover {
background: var(--accent);
}
/* 苹果风样式覆盖:仅改视觉,不改业务逻辑 */
:root {
--bg-primary: #f5f5f7;
--bg-secondary: #ffffff;
--bg-card: #ffffff;
--bg-card-hover: #fafafc;
--border: #e5e5ea;
--border-hover: #d1d1d6;
--text-primary: #1d1d1f;
--text-secondary: #424245;
--text-muted: #6e6e73;
--accent: #0071e3;
--accent-hover: #005bb5;
--accent-glow: rgba(0, 113, 227, 0.18);
--gradient-1: linear-gradient(135deg, #0071e3 0%, #2997ff 100%);
--gradient-2: linear-gradient(180deg, #ffffff 0%, #f7f8fa 100%);
--success: #1f8f4d;
--error: #d83933;
--common: #8e8e93;
--uncommon: #34c759;
--rare: #0a84ff;
--epic: #af52de;
--legendary: #ff9f0a;
}
body {
background: radial-gradient(1200px 700px at 10% -10%, #ffffff 0%, #f5f5f7 55%, #f2f2f5 100%);
color: var(--text-primary);
line-height: 1.55;
letter-spacing: -0.01em;
}
.app {
max-width: 1280px;
padding: 2rem 1.5rem 2.5rem;
}
header {
margin-bottom: 1.75rem;
padding-top: 0.5rem;
text-align: left;
}
header::before {
display: none;
}
h1 {
margin-bottom: 0.45rem;
font-size: clamp(1.75rem, 1.6rem + 1vw, 2.35rem);
font-weight: 700;
color: var(--text-primary);
background: none;
-webkit-text-fill-color: initial;
text-shadow: none;
letter-spacing: -0.02em;
}
.subtitle {
color: var(--text-muted);
background: none;
-webkit-text-fill-color: initial;
font-size: 0.96rem;
}
.main-grid {
gap: 1.25rem;
align-items: stretch;
}
.panel {
border: 1px solid rgba(0, 0, 0, 0.08);
background: rgba(255, 255, 255, 0.82);
backdrop-filter: blur(20px) saturate(160%);
-webkit-backdrop-filter: blur(20px) saturate(160%);
border-radius: 22px;
padding: 1.25rem;
box-shadow: 0 8px 30px rgba(0, 0, 0, 0.07);
}
.panel:hover {
border-color: rgba(0, 0, 0, 0.12);
box-shadow: 0 10px 36px rgba(0, 0, 0, 0.09);
}
.panel-header {
margin-bottom: 1.1rem;
padding-bottom: 0.85rem;
border-bottom: 1px solid var(--border);
}
.panel-header::after {
width: 46px;
height: 2px;
background: var(--accent);
opacity: 0.35;
}
.panel-icon {
width: 34px;
height: 34px;
border-radius: 10px;
background: #eef5ff;
color: #0a66c2;
box-shadow: none;
font-size: 1.05rem;
}
.panel-title {
font-size: 1.05rem;
font-weight: 650;
}
.section-label {
margin-bottom: 0.72rem;
color: #7b7b80;
letter-spacing: 0.06em;
font-size: 0.72rem;
}
.section-label::before {
width: 2px;
height: 11px;
background: #c7c7cc;
}
.species-grid,
.hat-grid {
gap: 0.45rem;
}
.species-btn,
.hat-btn {
border: 1px solid var(--border);
background: #fff;
color: var(--text-secondary);
border-radius: 12px;
transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}
.species-btn::before {
display: none;
}
.species-btn:hover,
.hat-btn:hover {
border-color: #b8d8fb;
color: var(--text-primary);
transform: translateY(-1px);
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.06);
background: #fff;
}
.species-btn.selected,
.hat-btn.selected {
background: #eaf3ff;
border-color: #8fc1f8;
color: #0f4f95;
box-shadow: 0 4px 12px rgba(10, 132, 255, 0.16);
transform: none;
}
.species-btn .emoji,
.hat-btn .emoji,
.mode-card .icon {
filter: none;
}
.rarity-pill {
border-width: 1px;
background: #fff;
font-weight: 600;
padding: 0.56rem 1.08rem;
}
.rarity-pill::before {
display: none;
}
.rarity-pill:hover {
transform: translateY(-1px);
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
}
.rarity-pill.selected[data-rarity="common"] { background: rgba(142, 142, 147, 0.12); color: #5f5f66; }
.rarity-pill.selected[data-rarity="uncommon"] { background: rgba(52, 199, 89, 0.14); color: #1f8f4d; }
.rarity-pill.selected[data-rarity="rare"] { background: rgba(10, 132, 255, 0.12); color: #0a66c2; }
.rarity-pill.selected[data-rarity="epic"] { background: rgba(175, 82, 222, 0.14); color: #9145bd; }
.rarity-pill.selected[data-rarity="legendary"] { background: rgba(255, 159, 10, 0.14); color: #ba6b00; }
.icon-btn,
.toggle-btn,
.mode-card,
.number-input input,
.clear-btn,
.copy-btn,
.result-item,
.stat-item {
border: 1px solid var(--border);
background: #fff;
box-shadow: none;
}
.icon-btn {
width: 48px;
height: 48px;
border-radius: 12px;
font-size: 1.35rem;
}
.icon-btn:hover {
border-color: #b8d8fb;
transform: translateY(-1px);
background: #f7fbff;
}
.icon-btn.selected {
background: #eaf3ff;
border-color: #8fc1f8;
color: #0f4f95;
transform: none;
}
.toggle-group {
gap: 0.45rem;
}
.toggle-btn {
border-radius: 12px;
color: #4e4e52;
padding: 0.78rem 0.9rem;
}
.toggle-btn:hover {
border-color: #b8d8fb;
background: #f7fbff;
transform: none;
}
.toggle-btn.selected {
border-color: #8fc1f8;
background: #eaf3ff;
color: #0f4f95;
box-shadow: none;
}
.mode-cards {
gap: 0.6rem;
}
.mode-card {
border-radius: 12px;
padding: 0.9rem 0.8rem;
}
.mode-card::before {
display: none;
}
.mode-card:hover {
border-color: #b8d8fb;
transform: translateY(-1px);
box-shadow: 0 3px 10px rgba(0, 0, 0, 0.06);
}
.mode-card.selected {
border-color: #8fc1f8;
background: #eef6ff;
box-shadow: none;
}
.mode-card .desc {
color: #7d7d82;
}
.number-input input {
border-radius: 12px;
color: #222;
background: #fff;
font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}
.number-input input:focus {
border-color: #7eb8f7;
box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.14);
transform: none;
}
.run-btn {
border-radius: 14px;
background: linear-gradient(180deg, #0a84ff 0%, #0071e3 100%);
animation: none;
box-shadow: 0 6px 18px rgba(0, 113, 227, 0.26);
font-size: 1.05rem;
font-weight: 650;
letter-spacing: 0.01em;
}
.run-btn::before {
display: none;
}
.run-btn:hover {
transform: translateY(-1px);
background: linear-gradient(180deg, #2997ff 0%, #0a84ff 100%);
box-shadow: 0 8px 22px rgba(0, 113, 227, 0.3);
}
.run-btn:disabled {
opacity: 0.65;
box-shadow: none;
}
.output-area {
background: #fcfcfd;
border: 1px solid var(--border);
border-radius: 14px;
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
min-height: 260px;
}
.output-line {
border-bottom: 1px dashed #e8e8ec;
color: #3a3a3e;
}
.output-line code {
background: #f2f5f8;
color: #005bb5;
border-radius: 6px;
}
.attempts-badge {
background: #eef6ff;
color: #0f4f95;
box-shadow: none;
}
.copy-btn {
border-radius: 9px;
color: #4e4e52;
}
.copy-btn:hover {
background: #eef6ff;
border-color: #8fc1f8;
color: #0f4f95;
transform: none;
box-shadow: none;
}
.copy-btn.copied {
background: #e7f6ed;
border-color: #8bd7ab;
color: #1f8f4d;
}
.result-card {
background: #fff;
border: 1px solid var(--border);
border-radius: 14px;
box-shadow: none;
}
.result-card:hover {
border-color: #d8d8dd;
box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}
.result-index {
background: #eef6ff;
color: #0f4f95;
border-radius: 9px;
}
.result-item {
background: #fdfdfe;
border-radius: 10px;
}
.result-value code {
background: #f2f5f8;
color: #005bb5;
}
.stats-grid {
gap: 0.45rem;
}
.stat-item {
border-radius: 10px;
background: #fcfcfd;
}
.stat-item.highlight .stat-value {
color: #0071e3;
}
summary {
color: #2563a9;
}
summary:hover {
color: #0f4f95;
}
pre {
background: #f8f9fb !important;
border: 1px solid #e5e5ea;
border-radius: 10px;
}
::-webkit-scrollbar-track {
background: #f1f1f4;
}
::-webkit-scrollbar-thumb {
background: #c7c7cc;
border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
background: #a0a0a8;
}
.usage-guide {
margin-top: 0.9rem;
background: #f9fbff;
border: 1px solid #dfe9f8;
border-radius: 14px;
padding: 0.9rem 1rem;
}
.usage-guide-title {
font-size: 0.86rem;
font-weight: 650;
color: #0f4f95;
margin-bottom: 0.55rem;
letter-spacing: 0.02em;
}
.usage-guide ol {
margin: 0;
padding-left: 1.2rem;
color: #3f4146;
font-size: 0.84rem;
line-height: 1.6;
}
.usage-guide li + li {
margin-top: 0.3rem;
}
.usage-guide code {
background: #eef3fb;
border: 1px solid #dce6f5;
color: #154b84;
border-radius: 6px;
padding: 0.1rem 0.38rem;
font-size: 0.8rem;
}
.usage-guide pre {
margin-top: 0.45rem !important;
margin-bottom: 0.2rem !important;
padding: 0.6rem 0.7rem !important;
background: #f4f7fc !important;
border: 1px solid #dce6f5;
border-radius: 8px;
color: #3a3d45;
font-size: 0.78rem;
line-height: 1.45;
white-space: pre-wrap;
word-break: break-word;
}
@media (max-width: 900px) {
.app {
padding: 1.25rem 1rem 1.75rem;
}
header {
margin-bottom: 1.2rem;
}
.panel {
border-radius: 18px;
padding: 1rem;
}
}
</style>
</head>
<body>
<div class="app">
<header>
<h1>重生之宠物归来</h1>
<p class="subtitle">claude Code 宠物生成 id</p>
</header>
<div class="main-grid">
<!-- Left Panel: Filters -->
<div class="panel">
<div class="panel-header">
<div class="panel-icon">🎯</div>
<h2 class="panel-title">筛选条件</h2>
</div>
<!-- Species -->
<div class="config-section">
<div class="section-label">物种 (Species)</div>
<div class="species-grid" id="speciesGrid"></div>
</div>
<!-- Rarity -->
<div class="config-section">
<div class="section-label">稀有度 (Rarity)</div>
<div class="rarity-row" id="rarityRow"></div>
</div>
<!-- Eye -->
<div class="config-section">
<div class="section-label">眼睛 (Eye)</div>
<div class="icon-grid" id="eyeGrid"></div>
</div>
<!-- Hat -->
<div class="config-section">
<div class="section-label">帽子 (Hat)</div>
<div class="hat-grid" id="hatGrid"></div>
</div>
<!-- Shiny -->
<div class="config-section">
<div class="section-label">闪光 (Shiny)</div>
<div class="toggle-group" id="shinyGroup">
<button class="toggle-btn" data-value="any">任意</button>
<button class="toggle-btn" data-value="true">是 ✨</button>
<button class="toggle-btn" data-value="false">否</button>
</div>
</div>
</div>
<!-- Right Panel: Settings -->
<div class="panel">
<div class="panel-header">
<div class="panel-icon">⚙️</div>
<h2 class="panel-title">运行设置</h2>
<div class="panel-header-actions">
<button class="clear-btn" onclick="clearOutput()">清空</button>
</div>
</div>
<!-- Mode -->
<div class="config-section">
<div class="section-label">模式 (Mode)</div>
<div class="mode-cards" id="modeCards">
<div class="mode-card selected" data-mode="random">
<div class="icon">🎲</div>
<div class="label">随机</div>
<div class="desc">随机生成用户ID</div>
</div>
<div class="mode-card" data-mode="sequential">
<div class="icon">🔢</div>
<div class="label">顺序</div>
<div class="desc">按前缀+索引生成</div>
</div>
</div>
</div>
<!-- Sequential Settings -->
<div id="sequentialSettings" style="display: none;">
<div class="config-section">
<div class="section-label">前缀 (Prefix)</div>
<div class="number-input">
<input type="text" id="prefixInput" placeholder="user-" value="user-">
</div>
</div>
<div class="config-section">
<div class="section-label">起始索引 (Start)</div>
<div class="number-input">
<input type="number" id="startInput" value="0" min="0">
</div>
</div>
</div>
<!-- Bytes -->
<div class="config-section">
<div class="section-label">随机字节长度 (Bytes)</div>
<div class="number-input">
<input type="number" id="bytesInput" value="32" min="1" max="64">
<label>bytes</label>
</div>
</div>
<!-- Limit -->
<div class="config-section">
<div class="section-label">最大尝试次数 (Limit)</div>
<div class="number-input">
<input type="number" id="limitInput" value="5000000" min="1">
<label>次</label>
</div>
</div>
<!-- Count -->
<div class="config-section">
<div class="section-label">返回数量 (Count)</div>
<div class="number-input">
<input type="number" id="countInput" value="1" min="1" max="100">
<label>个</label>
</div>
</div>
<!-- Run Button -->
<div class="config-section run-panel">
<button class="run-btn" id="runBtn" onclick="runSearch()">
<span>🚀</span>
<span>开始搜索</span>
</button>
</div>
<!-- Output -->
<div class="config-section">
<div class="section-label">结果 (Results)</div>
<div class="output-area" id="outputArea"></div>
</div>
<div class="usage-guide">
<div class="usage-guide-title">使用方式说明</div>
<ol>
<li>完全退出 Claude。</li>
<li>
编辑 <code>~/.claude.json</code>,删掉两个字段:
<pre>"userID": "ab54093b...",
"companion": {
"name": "Pricklebait",
"personality": "...",
"hatchedAt": 1775006380441
}</pre>
</li>
<li>复制页面结果中生成的 <code>UserId</code>,写入 <code>~/.claude.json</code> 中的 <code>userId</code> 字段。</li>
<li>重启 Claude Code,输入 <code>/buddy</code> 领取新的宠物。</li>
</ol>
</div>
</div>
</div>
</div>
<script>
// Constants from buddy2.js
const SPECIES = ['duck', 'goose', 'blob', 'cat', 'dragon', 'octopus', 'owl', 'penguin', 'turtle', 'snail', 'ghost', 'axolotl', 'capybara', 'cactus', 'robot', 'rabbit', 'mushroom', 'chonk'];
const SPECIES_EMOJI = { duck: '🦆', goose: '🪿', blob: '🫧', cat: '🐱', dragon: '🐉', octopus: '🐙', owl: '🦉', penguin: '🐧', turtle: '🐢', snail: '🐌', ghost: '👻', axolotl: '🦎', capybara: '🦫', cactus: '🌵', robot: '🤖', rabbit: '🐰', mushroom: '🍄', chonk: '😸' };
const RARITIES = ['common', 'uncommon', 'rare', 'epic', 'legendary'];
const RARITY_WEIGHTS = { common: 60, uncommon: 25, rare: 10, epic: 4, legendary: 1 };
const EYES = ['·', '✦', '×', '◉', '@', '°'];
const HATS = ['none', 'crown', 'tophat', 'propeller', 'halo', 'wizard', 'beanie', 'tinyduck'];
const STAT_NAMES = ['DEBUGGING', 'PATIENCE', 'CHAOS', 'WISDOM', 'SNARK'];
// State
const state = {
species: null,
rarity: 'legendary',
eye: null,
hat: null,
shiny: 'any',
mode: 'random'
};
// Initialize UI
function initUI() {
// Species grid
const speciesGrid = document.getElementById('speciesGrid');
SPECIES.forEach(species => {
const btn = document.createElement('button');
btn.className = 'species-btn';
btn.dataset.species = species;
btn.innerHTML = `<span class="emoji">${SPECIES_EMOJI[species]}</span>${species}`;
btn.onclick = () => toggleSelection('species', species, btn);
speciesGrid.appendChild(btn);
});
// Rarity row - default to legendary
const rarityRow = document.getElementById('rarityRow');
RARITIES.forEach(rarity => {
const pill = document.createElement('button');
pill.className = 'rarity-pill';
pill.dataset.rarity = rarity;
pill.textContent = rarity.charAt(0).toUpperCase() + rarity.slice(1);
pill.onclick = () => toggleSelection('rarity', rarity, pill);
if (rarity === 'legendary') {
pill.classList.add('selected');
}
rarityRow.appendChild(pill);
});
// Eye grid
const eyeGrid = document.getElementById('eyeGrid');
EYES.forEach(eye => {
const btn = document.createElement('button');
btn.className = 'icon-btn';
btn.dataset.eye = eye;
btn.textContent = eye;
btn.onclick = () => toggleSelection('eye', eye, btn);
eyeGrid.appendChild(btn);
});
// Hat grid
const HAT_EMOJI = {
none: '🚫',
crown: '👑',
tophat: '🎩',
propeller: '🌀',
halo: '😇',
wizard: '🧙',
beanie: '🎿',
tinyduck: '🦆'
};
const hatGrid = document.getElementById('hatGrid');
HATS.forEach(hat => {
const btn = document.createElement('button');
btn.className = 'hat-btn';
btn.dataset.hat = hat;
btn.innerHTML = `<span class="emoji">${HAT_EMOJI[hat]}</span>${hat}`;
btn.onclick = () => toggleSelection('hat', hat, btn);
hatGrid.appendChild(btn);
});
// Shiny toggle
document.querySelectorAll('#shinyGroup .toggle-btn').forEach(btn => {
btn.onclick = () => {
document.querySelectorAll('#shinyGroup .toggle-btn').forEach(b => b.classList.remove('selected'));
btn.classList.add('selected');
state.shiny = btn.dataset.value;
};
});
document.querySelector('#shinyGroup .toggle-btn').classList.add('selected');
// Mode cards
document.querySelectorAll('.mode-card').forEach(card => {
card.onclick = () => {
document.querySelectorAll('.mode-card').forEach(c => c.classList.remove('selected'));
card.classList.add('selected');
state.mode = card.dataset.mode;
document.getElementById('sequentialSettings').style.display = state.mode === 'sequential' ? 'block' : 'none';
};
});
}
function toggleSelection(type, value, element) {
if (state[type] === value) {
// Toggle off - click same item to deselect
state[type] = null;
element.classList.remove('selected');
} else {
// Select new value
document.querySelectorAll(`[data-${type}]`).forEach(el => el.classList.remove('selected'));
element.classList.add('selected');
state[type] = value;
}
}
// Validation
function validateOptions() {
const errors = [];
if (!state.species && !state.rarity && !state.eye && !state.hat && state.shiny === 'any') {
errors.push('请至少选择一个筛选条件(物种/稀有度/眼睛/帽子/闪光)');
}
return errors;
}
// Run search
async function runSearch() {
const errors = validateOptions();
if (errors.length > 0) {
alert(errors.join('\n'));
return;
}
const runBtn = document.getElementById('runBtn');
const outputArea = document.getElementById('outputArea');
const limit = parseInt(document.getElementById('limitInput').value) || 5000000;
const count = parseInt(document.getElementById('countInput').value) || 1;
const bytes = parseInt(document.getElementById('bytesInput').value) || 32;
const mode = state.mode;
const prefix = document.getElementById('prefixInput').value || 'user-';
const start = parseInt(document.getElementById('startInput').value) || 0;
// Debug: log current state
console.log('Current state:', JSON.stringify(state));
runBtn.disabled = true;
runBtn.innerHTML = '<div class="spinner"></div><span>搜索中...</span>';
outputArea.innerHTML = '<div class="output-line">开始搜索匹配条件...</div>';
const found = [];
const startTime = Date.now();
// Use setTimeout to prevent blocking UI
await new Promise(resolve => {
setTimeout(() => {
for (let i = 0; i < limit; i++) {
const userId = mode === 'sequential'
? `${prefix}${start + i}`
: generateRandomId(bytes);
const bones = rollUserId(userId);
if (!matches(bones)) continue;
found.push({ userId, bones, attempts: i + 1 });
if (found.length >= count) break;
// Update progress every 10000 iterations
if (i % 10000 === 0) {
outputArea.innerHTML = `<div class="output-line">🔄 已尝试 ${i.toLocaleString()} 次...</div>`;
}
}
const elapsed = ((Date.now() - startTime) / 1000).toFixed(2);
if (found.length === 0) {
outputArea.innerHTML = `<div class="output-line output-error">❌ 未找到匹配结果 (已尝试 ${limit.toLocaleString()} 次,耗时 ${elapsed}s)</div>`;
} else {
let html = `<div class="output-line output-success">✅ 找到 ${found.length} 个匹配结果 (耗时 ${elapsed}s)</div>`;
found.forEach((match, idx) => {
const stats = match.bones.stats;
// Sort stats by value (descending)
const sortedStats = Object.entries(stats).sort((a, b) => b[1] - a[1]);
const maxStat = sortedStats[0][1];
html += `
<div class="result-card">
<div class="result-header">
<div class="result-index">${idx + 1}</div>
<div class="result-info">
<span class="attempts-badge">🔍 ${match.attempts.toLocaleString()} 次尝试</span>
<button class="copy-btn" onclick="copyUserId('${match.userId}')">📋 复制 ID</button>
</div>
</div>
<div class="result-body">
<div class="result-item" style="grid-column: span 2;">
<span class="result-label">User ID</span>
<span class="result-value"><code>${match.userId}</code></span>
</div>
<div class="result-item">
<span class="result-label">物种</span>
<span class="result-value">${SPECIES_EMOJI[match.bones.species]} ${match.bones.species}</span>
</div>
<div class="result-item">
<span class="result-label">稀有度</span>
<span class="result-value"><span class="rarity-badge ${match.bones.rarity}">${match.bones.rarity}</span></span>
</div>
<div class="result-item">
<span class="result-label">眼睛</span>
<span class="result-value">${match.bones.eye}</span>
</div>
<div class="result-item">
<span class="result-label">帽子</span>
<span class="result-value">${match.bones.hat === 'none' ? '🚫 无' : match.bones.hat}</span>
</div>
<div class="result-item">
<span class="result-label">闪光</span>
<span class="result-value">${match.bones.shiny ? '<span class="shiny-badge">✨ 是</span>' : '否'}</span>
</div>
</div>
<details>
<summary>属性详情 <span style="color: var(--text-muted); font-size: 0.85rem; font-weight: 400;">(按数值排序)</span></summary>
<div class="stats-grid">
${sortedStats.map(([name, value]) => `
<div class="stat-item ${value === maxStat ? 'highlight' : ''}">
<div class="stat-name">${name}</div>
<div class="stat-value">${value}</div>
</div>
`).join('')}
</div>
</details>
</div>
`;
});
outputArea.innerHTML = html;
}
runBtn.disabled = false;
runBtn.innerHTML = '<span>🚀</span><span>开始搜索</span>';
resolve();
}, 50);
});
}
function generateRandomId(bytes) {
const chars = '0123456789abcdef';
let result = '';
for (let i = 0; i < bytes * 2; i++) {
result += chars[Math.floor(Math.random() * chars.length)];
}
return result;
}
// Copy from buddy2.js - simplified versions
function mulberry32(seed) {
let a = seed >>> 0;
return function () {
a |= 0;
a = (a + 0x6d2b79f5) | 0;
let t = Math.imul(a ^ (a >>> 15), 1 | a);
t = (t + Math.imul(t ^ (t >>> 7), 61 | t)) ^ t;
return ((t ^ (t >>> 14)) >>> 0) / 4294967296;
};
}
function hashString(s) {
let h = 2166136261;
for (let i = 0; i < s.length; i++) {
h ^= s.charCodeAt(i);
h = Math.imul(h, 16777619);
}
return h >>> 0;
}
function pick(rng, arr) {
return arr[Math.floor(rng() * arr.length)];
}
function rollRarity(rng) {
const total = Object.values(RARITY_WEIGHTS).reduce((a, b) => a + b, 0);
let roll = rng() * total;
for (const rarity of RARITIES) {
roll -= RARITY_WEIGHTS[rarity];
if (roll < 0) return rarity;
}
return 'common';
}
function rollStats(rng, rarity) {
const floor = { common: 5, uncommon: 15, rare: 25, epic: 35, legendary: 50 }[rarity];
let peak = pick(rng, STAT_NAMES);
let dump = pick(rng, STAT_NAMES);
while (dump === peak) dump = pick(rng, STAT_NAMES);
const stats = {};
for (const name of STAT_NAMES) {
if (name === peak) {
stats[name] = Math.min(100, floor + 50 + Math.floor(rng() * 30));
} else if (name === dump) {
stats[name] = Math.max(1, floor - 10 + Math.floor(rng() * 15));
} else {
stats[name] = floor + Math.floor(rng() * 40);
}
}
return stats;
}
function rollFrom(rng) {
const rarity = rollRarity(rng);
return {
rarity,
species: pick(rng, SPECIES),
eye: pick(rng, EYES),
hat: rarity === 'common' ? 'none' : pick(rng, HATS),
shiny: rng() < 0.01,
stats: rollStats(rng, rarity),
};
}
function rollUserId(userId) {
return rollFrom(mulberry32(hashString(userId + 'friend-2026-401')));
}
function matches(bones) {
// Check species filter
if (state.species != null && bones.species !== state.species) {
return false;
}
// Check rarity filter - THIS IS THE KEY CHECK
if (state.rarity != null && bones.rarity !== state.rarity) {
return false;
}
// Check eye filter
if (state.eye != null && bones.eye !== state.eye) {
return false;
}
// Check hat filter
if (state.hat != null && bones.hat !== state.hat) {
return false;
}
// Check shiny filter
if (state.shiny !== 'any' && bones.shiny !== (state.shiny === 'true')) {
return false;
}
return true;
}
function clearOutput() {
document.getElementById('outputArea').innerHTML = '';
}
function copyUserId(userId) {
navigator.clipboard.writeText(userId).then(() => {
// Find the button that was clicked and show "已复制" feedback
const buttons = document.querySelectorAll('.copy-btn');
buttons.forEach(btn => {
if (btn.onclick.toString().includes(userId)) {
const originalText = btn.textContent;
btn.textContent = '✅ 已复制';
btn.classList.add('copied');
setTimeout(() => {
btn.textContent = originalText;
btn.classList.remove('copied');
}, 1500);
}
});
});
}
// Initialize
initUI();
</script>
</body>
</html>