-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsettings.js
More file actions
115 lines (109 loc) · 4.81 KB
/
Copy pathsettings.js
File metadata and controls
115 lines (109 loc) · 4.81 KB
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
// Settings panel logic and cheat console
export function setupSettingsPanel({ getState, setState, saveState, updateUI, updateAutoFishUIButton, updateAutoFishCostColor, updateReelSpeedButtons, updateLuckButtons }) {
const settingsBtn = document.getElementById('settings-btn');
const settingsPanel = document.getElementById('settings-panel');
const closeSettingsBtn = document.getElementById('close-settings-btn');
const cheatForm = document.getElementById('cheat-form');
const cheatInput = document.getElementById('cheat-input');
const cheatOutput = document.getElementById('cheat-output');
if (settingsBtn && settingsPanel && closeSettingsBtn) {
settingsBtn.addEventListener('click', () => {
settingsPanel.style.display = 'block';
});
closeSettingsBtn.addEventListener('click', () => {
settingsPanel.style.display = 'none';
});
}
if (cheatForm && cheatInput && cheatOutput) {
cheatForm.addEventListener('submit', (e) => {
e.preventDefault();
const command = cheatInput.value.trim();
const parts = command.split(' ');
if (parts[0] === '/set') {
if (parts[1] === 'coins') {
const amount = parseInt(parts[2]);
if (!isNaN(amount) && amount >= 0) {
setState({ currencyCount: amount });
cheatOutput.textContent = `Set coins to ${formatNumber(amount)}`;
} else {
cheatOutput.textContent = 'Invalid amount';
}
} else if (parts[1] === 'gems') {
const amount = parseInt(parts[2]);
if (!isNaN(amount) && amount >= 0) {
setState({ gemCount: amount });
cheatOutput.textContent = `Set gems to ${formatNumber(amount)}`;
// Add wobble animation to gem counter number
const gemCount = document.querySelector('#gem-count');
if (gemCount) {
gemCount.classList.add('counter-number');
gemCount.style.animation = 'none';
void gemCount.offsetWidth;
gemCount.style.animation = 'wobble 0.5s cubic-bezier(.36,.07,.19,.97) both';
}
} else {
cheatOutput.textContent = 'Invalid amount';
}
} else if (parts[1] === 'fish') {
const amount = parseInt(parts[2]);
if (!isNaN(amount) && amount >= 0) {
setState({ fishCount: amount });
cheatOutput.textContent = `Set fish count to ${formatNumber(amount)}`;
} else {
cheatOutput.textContent = 'Invalid amount';
}
} else if (parts[1] === 'level') {
const amount = parseInt(parts[2]);
if (!isNaN(amount) && amount >= 1 && amount <= 100) {
setState({ level: amount });
cheatOutput.textContent = `Set level to ${amount}`;
} else {
cheatOutput.textContent = 'Invalid level (1-100)';
}
} else if (parts[1] === 'xp') {
const amount = parseInt(parts[2]);
if (!isNaN(amount) && amount >= 0 && amount <= 100) {
setState({ xp: amount });
cheatOutput.textContent = `Set XP to ${amount}`;
} else {
cheatOutput.textContent = 'Invalid XP (0-100)';
}
} else if (parts[1] === 'lifetime') {
const amount = parseInt(parts[2]);
if (!isNaN(amount) && amount >= 0) {
setState({ lifetimeFishCount: amount });
cheatOutput.textContent = `Set lifetime fish to ${formatNumber(amount)}`;
} else {
cheatOutput.textContent = 'Invalid amount';
}
} else {
cheatOutput.textContent = 'Invalid command. Available: coins, gems, fish, level, xp, lifetime';
}
} else if (parts[0] === '/remove') {
if (parts[1] === 'upgrades') {
// Reset all upgrade states
const resetState = {
autoFishUnlocked: false,
reelSpeedLevel: 0,
luckLevel: 0 // Add future upgrades here as they are added to the game
};
setState(resetState);
// Update all UI elements
if (typeof updateUI === 'function') updateUI();
if (typeof updateAutoFishUIButton === 'function') updateAutoFishUIButton();
if (typeof updateAutoFishCostColor === 'function') updateAutoFishCostColor();
if (typeof updateReelSpeedButtons === 'function') updateReelSpeedButtons();
if (typeof updateLuckButtons === 'function') updateLuckButtons();
cheatOutput.textContent = 'All upgrades have been removed';
} else {
cheatOutput.textContent = 'Invalid command. Available: upgrades';
}
} else {
cheatOutput.textContent = 'Invalid command. Available commands: /set, /remove';
}
cheatInput.value = '';
saveState();
updateUI();
});
}
}