File size: 4,277 Bytes
c703ea3
a46ce65
565e57b
 
 
 
 
b66ef35
d9c705e
b66ef35
565e57b
b66ef35
 
565e57b
c703ea3
565e57b
 
b66ef35
a46ce65
565e57b
 
 
 
 
 
6b45861
 
 
 
 
565e57b
 
 
 
 
 
 
 
b66ef35
 
565e57b
 
 
c703ea3
565e57b
9a3c041
 
 
 
 
b66ef35
 
565e57b
 
b66ef35
565e57b
b66ef35
565e57b
 
b66ef35
 
 
565e57b
 
6b45861
 
565e57b
 
b66ef35
 
 
 
565e57b
b66ef35
 
565e57b
b66ef35
565e57b
b66ef35
565e57b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b66ef35
 
6b45861
 
 
 
 
 
 
 
 
 
 
7428b13
5435413
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
import type { PicletType } from '../types/picletTypes';

// Discovery Status
export enum DiscoveryStatus {
  NEW = 'new',
  VARIATION = 'variation',
  EXISTING = 'existing'
}


// PicletInstance - Individual monster instances discovered by players
export interface PicletInstance {
  id?: number;

  // Basic Info
  typeId: string; // Unique identifier for this specific Piclet
  objectName: string; // Canonical object name (e.g., "pillow", "pyramid")
  nickname?: string;
  primaryType: PicletType;
  tier: string; // 'common' | 'uncommon' | 'rare' | 'epic' | 'legendary'

  // Discovery Metadata
  isCanonical: boolean; // True if this is the canonical version
  canonicalId?: string; // Reference to canonical Piclet if this is a variation
  variationAttributes?: string[]; // e.g., ["velvet", "blue"] for variations
  discoveredBy?: string; // DEPRECATED: Legacy username field (use discovererUsername)
  discovererSub?: string; // HF user ID (stable primary key)
  discovererUsername?: string; // HF username (cached for display)
  discovererName?: string; // Display name (cached)
  discovererPicture?: string; // Avatar URL (cached)
  discoveredAt: Date; // When first discovered
  scanCount: number; // Total times this Piclet has been scanned

  // Collection Management
  isInCollection: boolean; // Whether player has discovered this
  collectedAt?: Date; // When player discovered it

  // Visual Data
  imageUrl: string;
  imageData?: string; // Base64 encoded image with transparency
  imageCaption: string; // Original caption from image
  visualDetails?: string; // Extra visual details for monster generation
  concept: string; // Generated monster concept
  description: string; // Generated monster description
  imagePrompt: string; // Prompt used for image generation

  // Physical Characteristics
  height?: string; // e.g., "1.2m", "3'5\""
  weight?: string; // e.g., "15kg", "33 lbs"
  personality?: string; // e.g., "Playful and curious", "Shy but loyal"
}

// ActivityEntry - Recent discoveries and leaderboard
export interface ActivityEntry {
  id?: number;

  // Type
  type: 'discovery' | 'variation' | 'milestone';

  // Details
  title: string;
  description: string;
  picletTypeId: string;
  discovererName: string;
  discovererPicture?: string; // Avatar URL
  discovererSub?: string; // For linking to user profiles
  rarity: 'common' | 'uncommon' | 'rare' | 'epic' | 'legendary';

  // Timing
  createdAt: Date;
}

// GameState - Discovery progress and stats
export interface GameState {
  id?: number;

  // Timing
  lastActivityRefresh: Date;
  lastPlayed: Date;

  // Discovery Stats
  totalDiscoveries: number;
  uniqueDiscoveries: number; // Canonical Piclets found
  variationsFound: number;
  rarityScore: number; // Sum of rarity points
  currentStreak: number; // Days in a row with discoveries

  // Cached server data
  lastServerSync?: Date;
  cachedLeaderboard?: LeaderboardEntry[];
}

// LeaderboardEntry - For activity feed
export interface LeaderboardEntry {
  username: string;
  totalDiscoveries: number;
  uniqueDiscoveries: number;
  rarityScore: number;
  rank: number;
}

// UserProfile - HuggingFace user profile data
export interface UserProfile {
  sub: string; // HF user ID (primary key)
  preferred_username: string; // Current username
  name?: string; // Display name
  picture?: string; // Avatar URL
  lastSeen: Date; // Last OAuth login
  totalDiscoveries: number; // Cached stat
  uniqueDiscoveries: number; // Cached stat
  visibility: 'public' | 'private'; // Privacy setting (default: public)
}

// Trainer Scanning Progress - Track automated trainer piclet generation
export interface TrainerScanProgress {
  id?: number;
  
  // Image Info
  imagePath: string; // e.g., "trainer_images/001_Willow_Snap/image_001.jpg"
  trainerName: string; // e.g., "001_Willow_Snap"
  imageIndex: number; // e.g., 1, 2, 3 for multiple images per trainer
  
  // Processing Status
  status: 'pending' | 'processing' | 'completed' | 'failed';
  
  // Results
  picletInstanceId?: number; // ID of generated piclet if successful
  errorMessage?: string; // Error details if failed
  
  // Timing
  startedAt?: Date;
  completedAt?: Date;
  
  // Remote URL for reference
  remoteUrl: string; // Full HuggingFace URL
}