Bereinigen und Entfernen von nicht mehr benötigten TinyMCE-Dateien und -Plugins; Aktualisierung der Internationalisierung für Deutsch und Englisch in den Falukant- und Navigationsmodulen; Verbesserung der Statusleiste und Router-Implementierung.
This commit is contained in:
104
backend/utils/initializeMatch3.js
Normal file
104
backend/utils/initializeMatch3.js
Normal file
@@ -0,0 +1,104 @@
|
||||
import Match3Campaign from '../models/match3/campaign.js';
|
||||
import Match3Level from '../models/match3/level.js';
|
||||
import Match3Objective from '../models/match3/objective.js';
|
||||
|
||||
export const initializeMatch3Data = async () => {
|
||||
try {
|
||||
// Prüfe ob bereits Daten vorhanden sind
|
||||
const existingCampaigns = await Match3Campaign.count();
|
||||
if (existingCampaigns > 0) {
|
||||
console.log('Match3 data already exists, skipping initialization');
|
||||
return;
|
||||
}
|
||||
|
||||
console.log('Initializing Match3 data...');
|
||||
|
||||
// Erstelle erste Kampagne
|
||||
const campaign = await Match3Campaign.create({
|
||||
name: 'Juwelen-Meister',
|
||||
description: 'Meistere die Kunst des Juwelen-Matchings',
|
||||
isActive: true,
|
||||
order: 1
|
||||
});
|
||||
|
||||
// Erstelle erste Level
|
||||
const level1 = await Match3Level.create({
|
||||
campaignId: campaign.id,
|
||||
name: 'Der Anfang',
|
||||
description: 'Lerne die Grundlagen des Spiels',
|
||||
order: 1,
|
||||
boardSize: 6,
|
||||
tileTypes: ['gem', 'star', 'heart'],
|
||||
moveLimit: 15,
|
||||
isActive: true
|
||||
});
|
||||
|
||||
const level2 = await Match3Level.create({
|
||||
campaignId: campaign.id,
|
||||
name: 'Erste Herausforderung',
|
||||
description: 'Erweitere deine Fähigkeiten',
|
||||
order: 2,
|
||||
boardSize: 7,
|
||||
tileTypes: ['gem', 'star', 'heart', 'diamond'],
|
||||
moveLimit: 20,
|
||||
isActive: true
|
||||
});
|
||||
|
||||
// Erstelle Objectives für Level 1
|
||||
await Match3Objective.bulkCreate([
|
||||
{
|
||||
levelId: level1.id,
|
||||
type: 'score',
|
||||
description: 'Sammle 100 Punkte',
|
||||
target: 100,
|
||||
operator: '>=',
|
||||
order: 1,
|
||||
isRequired: true
|
||||
},
|
||||
{
|
||||
levelId: level1.id,
|
||||
type: 'matches',
|
||||
description: 'Mache 3 Matches',
|
||||
target: 3,
|
||||
operator: '>=',
|
||||
order: 2,
|
||||
isRequired: true
|
||||
}
|
||||
]);
|
||||
|
||||
// Erstelle Objectives für Level 2
|
||||
await Match3Objective.bulkCreate([
|
||||
{
|
||||
levelId: level2.id,
|
||||
type: 'score',
|
||||
description: 'Sammle 200 Punkte',
|
||||
target: 200,
|
||||
operator: '>=',
|
||||
order: 1,
|
||||
isRequired: true
|
||||
},
|
||||
{
|
||||
levelId: level2.id,
|
||||
type: 'matches',
|
||||
description: 'Mache 5 Matches',
|
||||
target: 5,
|
||||
operator: '>=',
|
||||
order: 2,
|
||||
isRequired: true
|
||||
},
|
||||
{
|
||||
levelId: level2.id,
|
||||
type: 'moves',
|
||||
description: 'Verwende weniger als 20 Züge',
|
||||
target: 20,
|
||||
operator: '<=',
|
||||
order: 3,
|
||||
isRequired: true
|
||||
}
|
||||
]);
|
||||
|
||||
console.log('Match3 data initialized successfully');
|
||||
} catch (error) {
|
||||
console.error('Error initializing Match3 data:', error);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user