feat: Initial commit Plants vs Zombies Web Edition v2.4

- 5 Biomes: Day, Night, Pool, Fog, Roof (25 Campaign levels)
- Minigames: Wall-nut Bowling, I Zombie, Roguelike, Boss Rush & Dr. Zomboss
- Systems: Zen Garden, Workshop Crafting, Almanac, Tree of Wisdom, Achievements
- Backend: REST API + SQLite Accounts & Save Synchronization
- Infrastructure: Nginx HTTPS & Docker deployment
This commit is contained in:
2026-09-17 09:30:52 +00:00
commit 6457a8904e
50 changed files with 14486 additions and 0 deletions
+102
View File
@@ -0,0 +1,102 @@
// Leaderboard & High Score Registry System
window.LeaderboardSystem = class LeaderboardSystem {
constructor() {
this.selectedMode = 'survival'; // default tab
// High score records per mode
this.records = {
adventure: [
{ name: 'Безумный Дэйв', score: 10, detail: 'Уровень 10 (Пройдено)', date: '2026-09-01' },
{ name: 'Сосед Боб', score: 8, detail: 'Уровень 8', date: '2026-09-10' },
{ name: 'Пенни', score: 5, detail: 'Уровень 5', date: '2026-09-12' }
],
survival: [
{ name: 'Безумный Дэйв', score: 32, detail: '32 Флага', date: '2026-09-02' },
{ name: 'Зомби Йети', score: 18, detail: '18 Флагов', date: '2026-09-05' },
{ name: 'Пенни', score: 12, detail: '12 Флагов', date: '2026-09-11' }
],
roguelike: [
{ name: 'Безумный Дэйв', score: 14, detail: '14 Этажей (6 Реликвий)', date: '2026-09-03' },
{ name: 'Сосед Боб', score: 9, detail: '9 Этажей', date: '2026-09-08' },
{ name: 'Пенни', score: 6, detail: '6 Этажей', date: '2026-09-14' }
],
izombie: [
{ name: 'Доктор Зомбосс', score: 50, detail: '50 Мозгов съедено', date: '2026-09-04' },
{ name: 'Футболист Зомби', score: 25, detail: '25 Мозгов', date: '2026-09-09' },
{ name: 'Обычный Зомби', score: 15, detail: '15 Мозгов', date: '2026-09-13' }
],
bowling: [
{ name: 'Безумный Дэйв', score: 6800, detail: '6800 очков (Страйк x8)', date: '2026-09-06' },
{ name: 'Пенни', score: 4500, detail: '4500 очков', date: '2026-09-07' },
{ name: 'Сосед Боб', score: 3200, detail: '3200 очков', date: '2026-09-15' }
],
boss: [
{ name: 'Безумный Дэйв', score: 1, detail: 'Побежден за 2 мин 15 сек', date: '2026-09-15' }
],
bossrush: [
{ name: 'Безумный Дэйв', score: 3, detail: 'Boss Rush завершен! (3 волны)', date: '2026-09-16' },
{ name: 'Сосед Боб', score: 2, detail: '2 волны', date: '2026-09-16' }
]
};
this.loadFromAuth();
}
loadFromAuth() {
if (window.PvZAuth) {
const uData = window.PvZAuth.getUserData();
if (uData.leaderboards) {
this.records = { ...this.records, ...uData.leaderboards };
}
}
}
saveToAuth() {
if (window.PvZAuth && !window.PvZAuth.isGuest()) {
window.PvZAuth.saveUserData({
leaderboards: this.records
});
}
}
submitScore(mode, score, detail = '') {
if (!this.records[mode]) {
this.records[mode] = [];
}
let playerName = 'Игрок';
if (window.PvZAuth) {
playerName = window.PvZAuth.getCurrentUser();
if (window.PvZAuth.isGuest()) playerName = 'Гость';
}
const today = new Date().toISOString().slice(0, 10);
// Check if player already on this board
const existing = this.records[mode].find(r => r.name === playerName);
if (existing) {
if (score > existing.score) {
existing.score = score;
existing.detail = detail || `${score} очков`;
existing.date = today;
}
} else {
this.records[mode].push({
name: playerName,
score,
detail: detail || `${score} очков`,
date: today
});
}
// Sort descending
this.records[mode].sort((a, b) => b.score - a.score);
// Keep top 10
this.records[mode] = this.records[mode].slice(0, 10);
this.saveToAuth();
}
getEntries(mode) {
return this.records[mode] || [];
}
};