ok
This commit is contained in:
219
EMERGENCY_SYSTEMS_RECOVERY/VIPManager.js
Normal file
219
EMERGENCY_SYSTEMS_RECOVERY/VIPManager.js
Normal file
@@ -0,0 +1,219 @@
|
||||
/**
|
||||
* VIP MANAGER - EARLY SUPPORTER SYSTEM
|
||||
* Handles first 20 buyers exclusive Gronk access
|
||||
*/
|
||||
|
||||
class VIPManager {
|
||||
constructor() {
|
||||
this.vipStatus = null;
|
||||
this.purchaseOrder = null;
|
||||
this.isEarlySupporter = false;
|
||||
this.init();
|
||||
}
|
||||
|
||||
init() {
|
||||
// Check VIP status from localStorage
|
||||
const stored = localStorage.getItem('vip_status');
|
||||
if (stored) {
|
||||
this.vipStatus = JSON.parse(stored);
|
||||
this.isEarlySupporter = this.vipStatus.early_supporter || false;
|
||||
this.purchaseOrder = this.vipStatus.order_number || null;
|
||||
}
|
||||
|
||||
console.log('🏆 VIP Manager initialized');
|
||||
console.log(' Early Supporter:', this.isEarlySupporter);
|
||||
console.log(' Purchase Order:', this.purchaseOrder);
|
||||
}
|
||||
|
||||
/**
|
||||
* CHECK EARLY SUPPORTER STATUS
|
||||
* Called on first game launch
|
||||
*/
|
||||
async checkEarlySupporter() {
|
||||
// TODO: Integrate with actual purchase API
|
||||
// For now, check manual override or demo mode
|
||||
|
||||
const manualVIP = localStorage.getItem('manual_vip');
|
||||
if (manualVIP === 'true') {
|
||||
this.grantEarlySupporter(1); // Manual override
|
||||
return true;
|
||||
}
|
||||
|
||||
// Check Steam API (when available)
|
||||
try {
|
||||
const orderNumber = await this.getSteamPurchaseOrder();
|
||||
if (orderNumber && orderNumber <= 20) {
|
||||
this.grantEarlySupporter(orderNumber);
|
||||
return true;
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('Steam API not available:', e);
|
||||
}
|
||||
|
||||
// Check Itch.io (when available)
|
||||
try {
|
||||
const orderNumber = await this.getItchPurchaseOrder();
|
||||
if (orderNumber && orderNumber <= 20) {
|
||||
this.grantEarlySupporter(orderNumber);
|
||||
return true;
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn('Itch.io API not available:', e);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* GRANT EARLY SUPPORTER STATUS
|
||||
*/
|
||||
grantEarlySupporter(orderNumber) {
|
||||
this.isEarlySupporter = true;
|
||||
this.purchaseOrder = orderNumber;
|
||||
|
||||
this.vipStatus = {
|
||||
early_supporter: true,
|
||||
order_number: orderNumber,
|
||||
granted_date: new Date().toISOString(),
|
||||
founder_badge: true,
|
||||
gronk_unlocked: true
|
||||
};
|
||||
|
||||
localStorage.setItem('vip_status', JSON.stringify(this.vipStatus));
|
||||
|
||||
console.log('🏆 EARLY SUPPORTER GRANTED!');
|
||||
console.log(' Order #' + orderNumber);
|
||||
|
||||
// Trigger celebration effect
|
||||
this.showFounderNotification();
|
||||
}
|
||||
|
||||
/**
|
||||
* SHOW FOUNDER NOTIFICATION
|
||||
*/
|
||||
showFounderNotification() {
|
||||
// Will be implemented in UI
|
||||
const event = new CustomEvent('vip-granted', {
|
||||
detail: {
|
||||
orderNumber: this.purchaseOrder,
|
||||
title: 'FOUNDER STATUS UNLOCKED!',
|
||||
message: 'You are supporter #' + this.purchaseOrder + ' worldwide!',
|
||||
rewards: [
|
||||
'Gronk companion unlocked immediately',
|
||||
'Exclusive Gronk questline',
|
||||
'Founder badge in-game',
|
||||
'Your name in credits'
|
||||
]
|
||||
}
|
||||
});
|
||||
window.dispatchEvent(event);
|
||||
}
|
||||
|
||||
/**
|
||||
* CHECK IF GRONK SHOULD BE UNLOCKED
|
||||
*/
|
||||
isGronkUnlocked() {
|
||||
return this.isEarlySupporter;
|
||||
}
|
||||
|
||||
/**
|
||||
* GET VIP BENEFITS
|
||||
*/
|
||||
getVIPBenefits() {
|
||||
if (!this.isEarlySupporter) return null;
|
||||
|
||||
return {
|
||||
gronk_companion: true,
|
||||
gronk_vape_boost: true, // +20% speed
|
||||
exclusive_quests: true,
|
||||
founder_badge: true,
|
||||
credits_listing: true,
|
||||
vape_cloud_boost: true // Larger vape clouds for Gronk
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* STEAM API INTEGRATION (Placeholder)
|
||||
*/
|
||||
async getSteamPurchaseOrder() {
|
||||
// TODO: Actual Steam API call
|
||||
// This would check Steam purchase timestamp/order
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* ITCH.IO API INTEGRATION (Placeholder)
|
||||
*/
|
||||
async getItchPurchaseOrder() {
|
||||
// TODO: Actual Itch.io API call
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* STREAMER ACCESS KEY SYSTEM
|
||||
*/
|
||||
validateStreamerKey(key) {
|
||||
const validKeys = [
|
||||
'STREAMER_PREVIEW_2026',
|
||||
'CONTENT_CREATOR_EARLY'
|
||||
];
|
||||
|
||||
if (validKeys.includes(key)) {
|
||||
this.grantStreamerAccess();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
grantStreamerAccess() {
|
||||
const streamerStatus = {
|
||||
streamer_mode: true,
|
||||
full_game_access: true,
|
||||
granted_date: new Date().toISOString(),
|
||||
watermark: true // Show "STREAMER PREVIEW" watermark
|
||||
};
|
||||
|
||||
localStorage.setItem('streamer_status', JSON.stringify(streamerStatus));
|
||||
|
||||
console.log('📺 STREAMER ACCESS GRANTED');
|
||||
}
|
||||
|
||||
isStreamerMode() {
|
||||
const stored = localStorage.getItem('streamer_status');
|
||||
if (!stored) return false;
|
||||
|
||||
const status = JSON.parse(stored);
|
||||
return status.streamer_mode || false;
|
||||
}
|
||||
|
||||
/**
|
||||
* RESET VIP STATUS (for testing)
|
||||
*/
|
||||
resetVIPStatus() {
|
||||
localStorage.removeItem('vip_status');
|
||||
localStorage.removeItem('streamer_status');
|
||||
localStorage.removeItem('manual_vip');
|
||||
this.vipStatus = null;
|
||||
this.isEarlySupporter = false;
|
||||
this.purchaseOrder = null;
|
||||
console.log('🔄 VIP status reset');
|
||||
}
|
||||
|
||||
/**
|
||||
* MANUAL VIP TOGGLE (Dev/Testing)
|
||||
*/
|
||||
setManualVIP(enabled) {
|
||||
if (enabled) {
|
||||
localStorage.setItem('manual_vip', 'true');
|
||||
this.grantEarlySupporter(1);
|
||||
} else {
|
||||
localStorage.removeItem('manual_vip');
|
||||
this.resetVIPStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Singleton instance
|
||||
const vipManager = new VIPManager();
|
||||
export default vipManager;
|
||||
Reference in New Issue
Block a user