Compare commits
2 Commits
c472093f62
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| ae64ca6aa3 | |||
| ca0e933d95 |
@@ -1,12 +1,3 @@
|
||||
Umsetzung des Spiels:
|
||||
Der Lockee hat eine Stunde Zeit das Spiel zu starten, dies geschieht per Knopfdruck
|
||||
Wenn er dies nicht schafft -> bei Keyholder, benachrichtige Keyholder und lass sie/ihn entscheiden, ansonsten freeze wie bei freeze card
|
||||
Übernimm die Logik des Spiels aus dem BDSM Game.
|
||||
Falls eine Zeitstrafe eine temporäre Öffnung vor oder nach der Aufgabe benötigt, öffne das Lock für 5 Minuten. Überzogene Zeit wird addiert und am Ende des Locks gefreezed
|
||||
Selbiges gilt, falls der finisher eine temporäre Öffnung danach erfoldert
|
||||
Benötigt der Finisher eine Öffnung davor, verwende die Logik der Cum Card, und addiere diese Zeit auf die möglicherweise schon vorhandenen Freeze Zeit am Ende des Locks
|
||||
|
||||
|
||||
|
||||
|
||||
wenn ich dates erfasse kann ich diese auch zu einer Verantstaltung machen,
|
||||
|
||||
2
bin/main/db/migration/V8__lock_game_aufgaben_text.sql
Normal file
2
bin/main/db/migration/V8__lock_game_aufgaben_text.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
ALTER TABLE lock_game
|
||||
MODIFY COLUMN aufgaben TEXT NULL;
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
bin/main/de/oaa/xxx/games/chastity/common/BaseLockHelper.class
Normal file
BIN
bin/main/de/oaa/xxx/games/chastity/common/BaseLockHelper.class
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -263,6 +263,12 @@
|
||||
cursor: pointer; transition: border-color 0.15s, color 0.15s;
|
||||
}
|
||||
.btn-item-edit:hover { border-color: var(--color-text); color: var(--color-text); }
|
||||
.btn-item-copy {
|
||||
background: none; border: 1px solid rgba(100,160,255,0.4); border-radius: 5px;
|
||||
color: var(--color-muted); font-size: 0.75rem; padding: 0.2rem 0.6rem;
|
||||
cursor: pointer; transition: border-color 0.15s, color 0.15s;
|
||||
}
|
||||
.btn-item-copy:hover { border-color: rgba(100,160,255,0.9); color: var(--color-text); }
|
||||
.btn-item-delete {
|
||||
background: none; border: 1px solid rgba(233,69,96,0.4); border-radius: 5px;
|
||||
color: var(--color-primary); font-size: 0.75rem; padding: 0.2rem 0.6rem;
|
||||
@@ -533,17 +539,11 @@
|
||||
</div>
|
||||
</div>
|
||||
<div id="iTempUnlockRow">
|
||||
<label>Temporäre Öffnungen</label>
|
||||
<div style="display:flex; flex-direction:column; gap:0.5rem; margin-top:0.5rem;">
|
||||
<label style="display:flex; align-items:center; gap:0.6rem; font-size:0.85rem; cursor:pointer;">
|
||||
<input type="checkbox" id="iTempUnlockBefore" style="accent-color:var(--color-primary); width:1rem; height:1rem;">
|
||||
Temporäre Öffnung <em>vor</em> der Zeitstrafe erforderlich
|
||||
<label class="toggle-switch" style="display:flex; align-items:center; gap:0.75rem; cursor:pointer; margin-top:0.25rem;">
|
||||
<input type="checkbox" id="iTempUnlockRequired">
|
||||
<span class="toggle-track"></span>
|
||||
<span style="font-size:0.9rem;">Temporäre Öffnung erforderlich</span>
|
||||
</label>
|
||||
<label style="display:flex; align-items:center; gap:0.6rem; font-size:0.85rem; cursor:pointer;">
|
||||
<input type="checkbox" id="iTempUnlockAfter" style="accent-color:var(--color-primary); width:1rem; height:1rem;">
|
||||
Temporäre Öffnung <em>nach</em> der Zeitstrafe erforderlich
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div id="iReleaseTextRow">
|
||||
<label for="iReleaseText">Text bei Aufhebung</label>
|
||||
@@ -765,7 +765,7 @@
|
||||
${g.beschreibung ? `<div class="gruppe-desc">${esc(g.beschreibung)}</div>` : ''}
|
||||
${renderSubSection('Aufgaben', sortByLevelThenName(g.aufgaben || []), 'aufgabe', renderAufgabe, g.gruppenId, type)}
|
||||
${g.availableIn !== 'CHASTITY_ONLY' ? renderSubSection('Strafen', sortByLevelThenName(g.strafen || []), 'strafe', renderStrafe, g.gruppenId, type) : ''}
|
||||
${renderSubSection('Zeitstrafen',sortByName(g.sperren || []), 'zeitstrafe',renderZeitstrafe, g.gruppenId, type)}
|
||||
${renderSubSection('Zeitstrafen',sortByLevelThenName(g.sperren || []), 'zeitstrafe',renderZeitstrafe, g.gruppenId, type)}
|
||||
${renderSubSection('Finisher', sortByGeschlecht(g.finisher || []), 'finisher', renderFinisher, g.gruppenId, type)}
|
||||
</div>
|
||||
</div>`;
|
||||
@@ -814,6 +814,7 @@
|
||||
function renderAufgabe(a, type, gruppenId) {
|
||||
_itemData[a.aufgabeId] = { ...a, _kind: 'aufgabe', _gruppenId: gruppenId };
|
||||
const badges = [];
|
||||
(a.benoetigteToys || []).forEach(t => badges.push(`<span class="item-detail-chip item-detail-chip-toy">${esc(t.name || t)}</span>`));
|
||||
const zeit = formatSek(a.sekundenVon, a.sekundenBis);
|
||||
if (zeit) badges.push(`<span class="badge badge-neutral">${esc(zeit)}</span>`);
|
||||
if (a.level != null) badges.push(`<span class="badge">Level ${esc(String(a.level))}</span>`);
|
||||
@@ -826,6 +827,7 @@
|
||||
const actionBtns = type === 'user' ? `
|
||||
<div class="item-action-btns">
|
||||
<button class="btn-item-edit" onclick="openEditItemModal('${esc(a.aufgabeId)}',event)">✎ Bearbeiten</button>
|
||||
<button class="btn-item-copy" onclick="duplicateItem('aufgabe','${esc(a.aufgabeId)}','${esc(gruppenId)}',event)">⧉ Duplizieren</button>
|
||||
<button class="btn-item-delete" onclick="deleteItem('aufgabe','${esc(a.aufgabeId)}','${esc(gruppenId)}',event)">✕ Löschen</button>
|
||||
</div>` : '';
|
||||
|
||||
@@ -841,6 +843,7 @@
|
||||
function renderStrafe(s, type, gruppenId) {
|
||||
_itemData[s.strafeId] = { ...s, _kind: 'strafe', _gruppenId: gruppenId };
|
||||
const badges = [];
|
||||
(s.benoetigteToys || []).forEach(t => badges.push(`<span class="item-detail-chip item-detail-chip-toy">${esc(t.name || t)}</span>`));
|
||||
const zeit = formatSek(s.sekundenVon, s.sekundenBis);
|
||||
if (zeit) badges.push(`<span class="badge badge-neutral">${esc(zeit)}</span>`);
|
||||
if (s.level != null) badges.push(`<span class="badge">Level ${esc(String(s.level))}</span>`);
|
||||
@@ -853,6 +856,7 @@
|
||||
const actionBtns = type === 'user' ? `
|
||||
<div class="item-action-btns">
|
||||
<button class="btn-item-edit" onclick="openEditItemModal('${esc(s.strafeId)}',event)">✎ Bearbeiten</button>
|
||||
<button class="btn-item-copy" onclick="duplicateItem('strafe','${esc(s.strafeId)}','${esc(gruppenId)}',event)">⧉ Duplizieren</button>
|
||||
<button class="btn-item-delete" onclick="deleteItem('strafe','${esc(s.strafeId)}','${esc(gruppenId)}',event)">✕ Löschen</button>
|
||||
</div>` : '';
|
||||
|
||||
@@ -868,8 +872,10 @@
|
||||
function renderZeitstrafe(z, type, gruppenId) {
|
||||
_itemData[z.sperreId] = { ...z, _kind: 'zeitstrafe', _gruppenId: gruppenId };
|
||||
const badges = [];
|
||||
(z.benoetigteToys || []).forEach(t => badges.push(`<span class="item-detail-chip item-detail-chip-toy">${esc(t.name || t)}</span>`));
|
||||
const zeit = formatMin(z.minutenVon, z.minutenBis);
|
||||
if (zeit) badges.push(`<span class="badge badge-neutral">${esc(zeit)}</span>`);
|
||||
if (z.level != null) badges.push(`<span class="badge">Level ${esc(String(z.level))}</span>`);
|
||||
|
||||
const detailRows = [];
|
||||
if (z.text) detailRows.push(`<div class="item-detail-text">${esc(z.text)}</div>`);
|
||||
@@ -879,6 +885,7 @@
|
||||
const actionBtns = type === 'user' ? `
|
||||
<div class="item-action-btns">
|
||||
<button class="btn-item-edit" onclick="openEditItemModal('${esc(z.sperreId)}',event)">✎ Bearbeiten</button>
|
||||
<button class="btn-item-copy" onclick="duplicateItem('zeitstrafe','${esc(z.sperreId)}','${esc(gruppenId)}',event)">⧉ Duplizieren</button>
|
||||
<button class="btn-item-delete" onclick="deleteItem('zeitstrafe','${esc(z.sperreId)}','${esc(gruppenId)}',event)">✕ Löschen</button>
|
||||
</div>` : '';
|
||||
|
||||
@@ -896,6 +903,7 @@
|
||||
function renderFinisher(f, type, gruppenId) {
|
||||
_itemData[f.finisherId] = { ...f, _kind: 'finisher', _gruppenId: gruppenId };
|
||||
const badges = [];
|
||||
(f.benoetigteToys || []).forEach(t => badges.push(`<span class="item-detail-chip item-detail-chip-toy">${esc(t.name || t)}</span>`));
|
||||
if (f.geschlecht) badges.push(`<span class="badge badge-neutral">${esc(GESCHLECHT_LABEL[f.geschlecht] || f.geschlecht)}</span>`);
|
||||
|
||||
const detailRows = [];
|
||||
@@ -906,6 +914,7 @@
|
||||
const actionBtns = type === 'user' ? `
|
||||
<div class="item-action-btns">
|
||||
<button class="btn-item-edit" onclick="openEditItemModal('${esc(f.finisherId)}',event)">✎ Bearbeiten</button>
|
||||
<button class="btn-item-copy" onclick="duplicateItem('finisher','${esc(f.finisherId)}','${esc(gruppenId)}',event)">⧉ Duplizieren</button>
|
||||
<button class="btn-item-delete" onclick="deleteItem('finisher','${esc(f.finisherId)}','${esc(gruppenId)}',event)">✕ Löschen</button>
|
||||
</div>` : '';
|
||||
|
||||
@@ -944,10 +953,36 @@
|
||||
finisher: apiUrl('/finisher')
|
||||
};
|
||||
const ITEM_DELETE_FIELD = { aufgabe: 'aufgabeId', strafe: 'strafeId', zeitstrafe: 'sperreId', finisher: 'finisherId' };
|
||||
const ITEM_COPY_URL = {
|
||||
aufgabe: apiUrl('/aufgabe/copy'),
|
||||
strafe: '/strafe/copy',
|
||||
zeitstrafe: '/sperre/copy',
|
||||
finisher: apiUrl('/finisher/copy')
|
||||
};
|
||||
|
||||
function duplicateItem(kind, itemId, gruppenId, event) {
|
||||
event.stopPropagation();
|
||||
const copyUrl = ITEM_COPY_URL[kind];
|
||||
if (!copyUrl) return;
|
||||
fetch(`${copyUrl}/${itemId}`, { method: 'POST' }).then(r => {
|
||||
if (r.ok) {
|
||||
pendingExpandId = gruppenId;
|
||||
pendingExpandType = 'user';
|
||||
_notifyOnLoad = true; loadUserGruppen();
|
||||
} else {
|
||||
document.getElementById('userActionError').textContent = 'Fehler beim Duplizieren (HTTP ' + r.status + ').';
|
||||
}
|
||||
}).catch(() => {
|
||||
document.getElementById('userActionError').textContent = 'Verbindungsfehler.';
|
||||
});
|
||||
}
|
||||
|
||||
function deleteItem(kind, itemId, gruppenId, event) {
|
||||
event.stopPropagation();
|
||||
if (!confirm('Eintrag wirklich löschen?')) return;
|
||||
openConfirmModal('Eintrag wirklich löschen?', () => _doDeleteItem(kind, itemId, gruppenId));
|
||||
}
|
||||
|
||||
function _doDeleteItem(kind, itemId, gruppenId) {
|
||||
const deleteUrl = ITEM_DELETE_URL[kind];
|
||||
if (!deleteUrl) return;
|
||||
const body = { [ITEM_DELETE_FIELD[kind]]: itemId };
|
||||
@@ -1430,7 +1465,7 @@
|
||||
const lbl = document.querySelector(`#iSperreFuer input[value="${v}"]`)?.closest('label');
|
||||
if (lbl) lbl.style.display = isChastity ? 'none' : '';
|
||||
});
|
||||
document.getElementById('iTempUnlockRow').style.display = (isZeit && isChastity) ? 'block' : 'none';
|
||||
document.getElementById('iTempUnlockRow').style.display = ((isZeit || isFinisher) && isChastity) ? 'block' : 'none';
|
||||
document.getElementById('iReleaseTextRow').style.display = isZeit ? 'block' : 'none';
|
||||
}
|
||||
|
||||
@@ -1449,8 +1484,7 @@
|
||||
document.querySelectorAll('#iWerkzeugFinisherPassiv input').forEach(cb => cb.checked = false);
|
||||
document.querySelectorAll('#iSperreFuer input').forEach(cb => cb.checked = false);
|
||||
document.querySelectorAll('#iGeschlecht input').forEach(rb => rb.checked = false);
|
||||
document.getElementById('iTempUnlockBefore').checked = false;
|
||||
document.getElementById('iTempUnlockAfter').checked = false;
|
||||
document.getElementById('iTempUnlockRequired').checked = false;
|
||||
_selectedToys = [];
|
||||
renderSelectedToys();
|
||||
document.getElementById('itemModalError').style.display = 'none';
|
||||
@@ -1495,6 +1529,9 @@
|
||||
const rb = document.querySelector(`#iGeschlecht input[value="${d.geschlecht}"]`);
|
||||
if (rb) rb.checked = true;
|
||||
}
|
||||
if (_isChastityMode) {
|
||||
document.getElementById('iTempUnlockRequired').checked = d.tempUnlockRequired === true;
|
||||
}
|
||||
} else {
|
||||
document.getElementById('iMinVon').value = d.minutenVon != null ? d.minutenVon : '';
|
||||
document.getElementById('iMinBis').value = d.minutenBis != null ? d.minutenBis : '';
|
||||
@@ -1502,8 +1539,7 @@
|
||||
(d.sperreFuer || []).forEach(w => { const cb = document.querySelector(`#iSperreFuer input[value="${w}"]`); if (cb) cb.checked = true; });
|
||||
if (_isChastityMode) {
|
||||
document.getElementById('iLevel').value = d.level != null ? d.level : '';
|
||||
document.getElementById('iTempUnlockBefore').checked = d.tempUnlockBeforeRequired === true;
|
||||
document.getElementById('iTempUnlockAfter').checked = d.tempUnlockAfterRequired === true;
|
||||
document.getElementById('iTempUnlockRequired').checked = d.tempUnlockRequired === true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1670,7 +1706,8 @@
|
||||
gruppeId: isEdit ? undefined : currentItemGruppeId,
|
||||
benoetigtAktiv: _isChastityMode ? [] : checkedValues('iWerkzeugFinisherAktiv'),
|
||||
benoetigtPassiv: _isChastityMode ? [] : checkedValues('iWerkzeugFinisherPassiv'),
|
||||
benoetigteToys: _selectedToys.map(t => ({ toyId: t.toyId }))
|
||||
benoetigteToys: _selectedToys.map(t => ({ toyId: t.toyId })),
|
||||
tempUnlockRequired: _isChastityMode ? document.getElementById('iTempUnlockRequired').checked : null
|
||||
};
|
||||
url = isEdit ? apiUrl(`/finisher/${currentItemEditId}`) : apiUrl('/finisher');
|
||||
method = isEdit ? 'PUT' : 'POST';
|
||||
@@ -1698,8 +1735,7 @@
|
||||
releaseText: document.getElementById('iReleaseText').value.trim() || null,
|
||||
sperreFuer,
|
||||
level: zeitLevel,
|
||||
tempUnlockBeforeRequired: _isChastityMode ? document.getElementById('iTempUnlockBefore').checked : null,
|
||||
tempUnlockAfterRequired: _isChastityMode ? document.getElementById('iTempUnlockAfter').checked : null,
|
||||
tempUnlockRequired: _isChastityMode ? document.getElementById('iTempUnlockRequired').checked : null,
|
||||
benoetigteToys: _selectedToys.map(t => ({ toyId: t.toyId }))
|
||||
};
|
||||
url = isEdit ? `/sperre/${currentItemEditId}` : '/sperre'; // BDSM-only
|
||||
|
||||
@@ -679,6 +679,7 @@
|
||||
|
||||
// ── Gruppe lists ──
|
||||
function renderGruppeList(containerId, gruppen) {
|
||||
gruppen = gruppen.filter(g => g.availableIn !== 'CHASTITY_ONLY');
|
||||
const ul = document.getElementById(containerId);
|
||||
const section = ul.closest('[id^="section"]');
|
||||
const selectAllWrap = section?.querySelector('.select-all-label');
|
||||
|
||||
@@ -256,9 +256,14 @@
|
||||
</div>
|
||||
|
||||
<div class="checkbox-row" id="rowTestLock">
|
||||
<input type="checkbox" id="testLock">
|
||||
<input type="checkbox" id="testLock" onchange="onTestLockChange()">
|
||||
<label for="testLock">Test-Lock <span class="form-hint">(kein echter Lock, zum Ausprobieren)</span></label>
|
||||
</div>
|
||||
<div id="rowSpeedFactor" style="display:none; align-items:center; gap:12px; padding:6px 0;">
|
||||
<label for="speedFactor" style="white-space:nowrap;">Geschwindigkeit:</label>
|
||||
<input type="range" id="speedFactor" min="1" max="10" value="1" style="flex:1;" oninput="document.getElementById('speedFactorLabel').textContent = '×' + this.value">
|
||||
<span id="speedFactorLabel" style="min-width:32px; text-align:right;">×1</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="error-msg" id="errorMsg"></div>
|
||||
@@ -515,6 +520,7 @@
|
||||
khInput.readOnly = true;
|
||||
khInput.style.opacity = '0.6';
|
||||
document.getElementById('rowTestLock').style.display = 'none';
|
||||
document.getElementById('rowSpeedFactor').style.display = 'none';
|
||||
document.getElementById('rowDetailsVisible').style.display = '';
|
||||
} else {
|
||||
khInput.readOnly = false;
|
||||
@@ -728,6 +734,15 @@
|
||||
el.scrollIntoView({ behavior: 'smooth', block: 'center' });
|
||||
}
|
||||
|
||||
function onTestLockChange() {
|
||||
const checked = document.getElementById('testLock').checked;
|
||||
document.getElementById('rowSpeedFactor').style.display = checked ? 'flex' : 'none';
|
||||
if (!checked) {
|
||||
document.getElementById('speedFactor').value = 1;
|
||||
document.getElementById('speedFactorLabel').textContent = '×1';
|
||||
}
|
||||
}
|
||||
|
||||
// ── Absenden ──
|
||||
async function createSession() {
|
||||
document.getElementById('errorMsg').style.display = 'none';
|
||||
@@ -756,6 +771,7 @@
|
||||
const isFriendLockee = lockeeVal && lockeeVal !== myUserId;
|
||||
const unlockCodeLen = isFriendLockee ? null : (parseInt(document.getElementById('unlockCodeLines').value) || 5);
|
||||
const isTestLock = isFriendLockee ? false : document.getElementById('testLock').checked;
|
||||
const speedFactor = isTestLock ? parseInt(document.getElementById('speedFactor').value) : 1;
|
||||
|
||||
let endpoint, body;
|
||||
|
||||
@@ -769,6 +785,7 @@
|
||||
testLock: isTestLock,
|
||||
unlockCodeLength: unlockCodeLen,
|
||||
controllType: selectedLockControl,
|
||||
speedFactor: speedFactor,
|
||||
};
|
||||
} else {
|
||||
// CardLock
|
||||
@@ -798,6 +815,7 @@
|
||||
controllType: selectedLockControl,
|
||||
gameSetId: t.gameSetId || null,
|
||||
gameSpieldauerIdx: t.gameSpieldauerIdx ?? null,
|
||||
speedFactor: speedFactor,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
letter-spacing: 0.08em;
|
||||
margin-bottom: 0.5rem;
|
||||
height: 1.2rem;
|
||||
text-align: center;
|
||||
}
|
||||
.game-text {
|
||||
font-size: 1rem;
|
||||
@@ -31,6 +32,7 @@
|
||||
white-space: pre-wrap;
|
||||
height: 14rem;
|
||||
overflow-y: auto;
|
||||
text-align: center;
|
||||
}
|
||||
.game-timer {
|
||||
font-size: 2.2rem;
|
||||
@@ -52,6 +54,9 @@
|
||||
margin-top: 1rem;
|
||||
height: 2.75rem;
|
||||
}
|
||||
#confirmModal { display:none; }
|
||||
#confirmModal.open { display:flex; }
|
||||
|
||||
|
||||
.level-display {
|
||||
display: flex;
|
||||
@@ -64,16 +69,6 @@
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.lock-messages {
|
||||
background: rgba(233,69,96,0.1);
|
||||
border: 1px solid rgba(233,69,96,0.3);
|
||||
border-radius: 10px;
|
||||
padding: 1rem 1.1rem;
|
||||
margin-bottom: 1.25rem;
|
||||
}
|
||||
.lock-messages p { margin: 0 0 0.5rem; font-size: 0.9rem; line-height: 1.5; }
|
||||
.lock-messages p:last-child { margin: 0; }
|
||||
|
||||
.init-box {
|
||||
background: var(--color-card);
|
||||
border: 1px solid var(--color-secondary);
|
||||
@@ -134,15 +129,13 @@
|
||||
margin-top: 0.6rem;
|
||||
}
|
||||
|
||||
#finisherBox {
|
||||
background: linear-gradient(135deg, rgba(233,69,96,0.15), rgba(155,89,182,0.12));
|
||||
border: 1px solid rgba(233,69,96,0.4);
|
||||
border-radius: 14px;
|
||||
padding: 1.5rem;
|
||||
#levelTrophy {
|
||||
font-size: 3.5rem;
|
||||
line-height: 72px;
|
||||
width: 72px;
|
||||
height: 72px;
|
||||
text-align: center;
|
||||
}
|
||||
#finisherBox .trophy { font-size: 2.5rem; margin-bottom: 0.5rem; }
|
||||
#finisherBox h2 { font-size: 1.1rem; margin: 0 0 0.75rem; color: var(--color-primary); }
|
||||
</style>
|
||||
</head>
|
||||
<body class="app">
|
||||
@@ -153,11 +146,9 @@
|
||||
<!-- Level-Anzeige -->
|
||||
<div class="level-display" id="levelDisplay" style="display:none;">
|
||||
<img id="levelImg" src="" alt="Level">
|
||||
<span id="levelTrophy" style="display:none;">🏆</span>
|
||||
</div>
|
||||
|
||||
<!-- Freigegebene Locks (checkLocks-Meldungen) -->
|
||||
<div id="lockMessages" class="lock-messages" style="display:none;"></div>
|
||||
|
||||
<!-- Toy-Auswahl vor Spielstart -->
|
||||
<div id="toyBox" style="display:none;">
|
||||
<div class="game-card">
|
||||
@@ -198,20 +189,51 @@
|
||||
|
||||
<!-- Release-Text (Sperren) -->
|
||||
<div id="lockReleaseBox" class="game-card" style="display:none;">
|
||||
<div class="game-label">🔓 Sperre aufgehoben</div>
|
||||
<div class="game-label">🔓 Zeitstrafe verbüßt</div>
|
||||
<div class="game-text" id="releaseText"></div>
|
||||
<div style="margin-top:1.1rem;">
|
||||
<button class="btn-primary" id="btnReleaseOk">OK</button>
|
||||
<div class="game-timer"></div>
|
||||
<div class="game-btn-row">
|
||||
<button class="btn-primary" id="btnReleaseOk" style="width:100%;height:100%;">OK</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Temporäre Öffnung -->
|
||||
<div id="tempOpeningBox" class="game-card" style="display:none;">
|
||||
<!-- Phase 1: Öffnung aktiv -->
|
||||
<div id="tempPhase1">
|
||||
<div class="game-label" style="text-align:center;">🔓 Entsperrcode</div>
|
||||
<div class="game-text" id="tempOpeningCode"
|
||||
style="display:flex;align-items:center;justify-content:center;
|
||||
font-size:1.8rem;font-weight:700;letter-spacing:0.18em;
|
||||
color:var(--color-primary);white-space:normal;"></div>
|
||||
<div class="game-timer" id="tempOpeningTimer" style="margin-top:0.75rem;"></div>
|
||||
<div class="game-btn-row">
|
||||
<button class="btn-primary" style="width:100%;height:100%;" onclick="doEndTempOpening()">✓ Erledigt</button>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Phase 2: Neuer Code zum Schließen -->
|
||||
<div id="tempPhase2" style="display:none;">
|
||||
<div class="game-label" style="text-align:center;">🔒 Lock schließen</div>
|
||||
<div class="game-text" style="display:flex;flex-direction:column;align-items:center;justify-content:center;gap:0.75rem;white-space:normal;">
|
||||
<span style="font-size:0.9rem;color:var(--color-muted);text-align:center;">Nutze den Entsperrcode um den Schlüssel wieder zu verschließen.</span>
|
||||
<div id="tempNewCode" style="font-size:1.8rem;font-weight:700;letter-spacing:0.18em;color:var(--color-primary);text-align:center;"></div>
|
||||
<div id="tempScrambleCountdown" style="display:none;font-size:0.82rem;color:var(--color-muted);font-family:monospace;text-align:center;"></div>
|
||||
</div>
|
||||
<div class="game-timer"></div>
|
||||
<div class="game-btn-row">
|
||||
<button class="btn-primary" id="tempPhase2Btn" style="width:100%;height:100%;" onclick="startTempScramble()">OK</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Finisher -->
|
||||
<div id="finisherBox" style="display:none;">
|
||||
<div class="trophy">🏆</div>
|
||||
<h2>Level 6 erreicht!</h2>
|
||||
<div class="game-label" id="finisherTitle"></div>
|
||||
<div class="game-text" id="finisherText" style="margin-top:0.5rem;text-align:left;"></div>
|
||||
<button class="btn-primary" id="btnFinisherOk" style="margin-top:1.25rem;">✓ OK</button>
|
||||
<div id="finisherBox" class="game-card" style="display:none;">
|
||||
<div class="game-label" id="finisherLabel"></div>
|
||||
<div class="game-text" id="finisherText"></div>
|
||||
<div class="game-timer" id="finisherTimer"></div>
|
||||
<div class="game-btn-row">
|
||||
<button class="btn-primary" id="finisherBtn" style="width:100%;height:100%;"></button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Debug -->
|
||||
@@ -229,6 +251,17 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="modal-backdrop" id="confirmModal">
|
||||
<div class="modal" style="max-width:420px;">
|
||||
<h2>Bestätigung</h2>
|
||||
<p id="confirmModalText" style="color:var(--color-text);margin-bottom:1.25rem;line-height:1.5;"></p>
|
||||
<div class="modal-actions">
|
||||
<button class="btn-cancel" id="confirmModalCancel">Nein</button>
|
||||
<button class="btn-save" id="confirmModalOk" style="background:var(--color-danger,#e74c3c);">Ja, abbrechen</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="/js/icons.js"></script>
|
||||
<script src="/js/nav.js"></script>
|
||||
<script>
|
||||
@@ -240,6 +273,10 @@
|
||||
let _state = null;
|
||||
let _timerInt = null;
|
||||
let _gameAction = null; // 'queue-start' | 'queue-done' | 'active-running' | 'active-done'
|
||||
let _tempOpeningTimerInt = null;
|
||||
let _tempScrambleTimer = null;
|
||||
let _tempScrambleCd = null;
|
||||
let _tempOpeningFromQueue = false; // true only when opening was triggered from a queued Zeitstrafe (doQueueStart)
|
||||
|
||||
function goBack() {
|
||||
if (lockId) location.href = '/games/chastity/activelock.html?lockId=' + lockId;
|
||||
@@ -340,6 +377,7 @@
|
||||
|
||||
async function startWithExcludedToys(gameSetId, excludedToyIds) {
|
||||
const params = new URLSearchParams({ aufgabenGruppeId: gameSetId });
|
||||
if (lockId) params.append('lockId', lockId);
|
||||
excludedToyIds.forEach(id => params.append('excludedToyIds', id));
|
||||
const r = await fetch('/lock-game/init?' + params.toString(), { method: 'POST' });
|
||||
|
||||
@@ -353,6 +391,13 @@
|
||||
const stateR = await fetch('/lock-game/state');
|
||||
_state = await stateR.json();
|
||||
hide('loadingHint');
|
||||
|
||||
// Remove ?fresh=1 from URL so F5 resumes instead of restarting.
|
||||
const cleanParams = new URLSearchParams(location.search);
|
||||
cleanParams.delete('fresh');
|
||||
const cleanSearch = cleanParams.toString();
|
||||
history.replaceState(null, '', location.pathname + (cleanSearch ? '?' + cleanSearch : ''));
|
||||
|
||||
await runGameLoop();
|
||||
}
|
||||
|
||||
@@ -417,6 +462,8 @@
|
||||
await loadAndShowToys(sel.value);
|
||||
}
|
||||
|
||||
// ── Benötigt-Checkboxen ───────────────────────────────────────────────────
|
||||
|
||||
// ── Game Loop ─────────────────────────────────────────────────────────────
|
||||
|
||||
function setGameCard(label, text, action, btnLabel) {
|
||||
@@ -430,15 +477,27 @@
|
||||
}
|
||||
|
||||
async function runGameLoop() {
|
||||
hide('gameCard');
|
||||
hide('finisherBox');
|
||||
clearTimer();
|
||||
|
||||
if (_state.level >= 6) {
|
||||
await showFinisherFlow();
|
||||
if (_state.tempOpeningTime) {
|
||||
hide('finisherBox');
|
||||
showTempOpeningDialog();
|
||||
return;
|
||||
}
|
||||
|
||||
if (_state.finisher) {
|
||||
hide('tempOpeningBox');
|
||||
showFinisherUI();
|
||||
return;
|
||||
}
|
||||
|
||||
// Normal game states all use gameCard — show it once here so the card
|
||||
// frame stays stable across transitions (queue ↔ active ↔ active-done).
|
||||
show('gameBox');
|
||||
show('gameCard');
|
||||
hide('tempOpeningBox');
|
||||
hide('finisherBox');
|
||||
|
||||
renderLevelBar(_state.level);
|
||||
|
||||
if (_state.activeTask) {
|
||||
@@ -459,21 +518,20 @@
|
||||
if (_state.lockInQueue) {
|
||||
let sperre;
|
||||
try { sperre = JSON.parse(_state.lockInQueue); } catch { sperre = {}; }
|
||||
setGameCard('🔒 Neue Sperre', sperre.text || sperre.kurzText || '', 'queue-start', '▶ Starten');
|
||||
const btnLabel = sperre.tempUnlockRequired ? '⏱ Weiter zur temporären Öffnung' : '✓ Erledigt';
|
||||
setGameCard('🔒 Neue Sperre', sperre.text || sperre.kurzText || '', 'queue-start', btnLabel);
|
||||
|
||||
} else if (_state.taskInQueue) {
|
||||
let aufgabe;
|
||||
try { aufgabe = JSON.parse(_state.taskInQueue); } catch { aufgabe = {}; }
|
||||
const hasDuration = !!(aufgabe.sekundenVon || aufgabe.sekundenBis);
|
||||
setGameCard('🎯 Neue Aufgabe', aufgabe.text || '', hasDuration ? 'queue-start' : 'queue-done',
|
||||
hasDuration ? '▶ Starten' : '✓ Erledigt');
|
||||
|
||||
}
|
||||
show('gameBox');
|
||||
show('gameCard');
|
||||
}
|
||||
|
||||
function showActiveTask(text, endIso) {
|
||||
show('gameBox');
|
||||
show('gameCard');
|
||||
const timerEl = document.getElementById('gameTimer');
|
||||
timerEl.classList.remove('active', 'urgent');
|
||||
timerEl.textContent = '';
|
||||
@@ -497,25 +555,50 @@
|
||||
switch (_gameAction) {
|
||||
case 'queue-start': doQueueStart(); break;
|
||||
case 'queue-done': doQueueDone(); break;
|
||||
case 'active-running': doCancelCountdown(); break;
|
||||
case 'active-running': openConfirmModal('Aufgabe wirklich abbrechen?', () => doCancelCountdown()); break;
|
||||
case 'active-done': doErledigt(); break;
|
||||
}
|
||||
}
|
||||
|
||||
async function doQueueStart() {
|
||||
try {
|
||||
await checkAndShowLocks();
|
||||
const wasLock = !!_state.lockInQueue;
|
||||
let tempUnlockRequired = false;
|
||||
if (wasLock) {
|
||||
try { tempUnlockRequired = JSON.parse(_state.lockInQueue).tempUnlockRequired === true; } catch (_) {}
|
||||
}
|
||||
|
||||
if (wasLock && tempUnlockRequired) {
|
||||
// Erst Öffnung starten, Zeitstrafe wird nach der Öffnung angewendet
|
||||
const r = await fetch('/lock-game/start-temp-opening', { method: 'POST' });
|
||||
if (!r.ok) { showError('Fehler beim Starten der Öffnung'); return; }
|
||||
const stateR = await fetch('/lock-game/state');
|
||||
_state = await stateR.json();
|
||||
_tempOpeningFromQueue = true;
|
||||
showTempOpeningDialog();
|
||||
} else {
|
||||
const r = await fetch('/lock-game/apply-task', { method: 'POST' });
|
||||
if (!r.ok) { showError('Fehler beim Starten'); return; }
|
||||
if (wasLock) {
|
||||
const nextR = await fetch('/lock-game/abandon-task', { method: 'POST' });
|
||||
if (!nextR.ok) { showError('Fehler beim Ziehen'); return; }
|
||||
}
|
||||
const stateR = await fetch('/lock-game/state');
|
||||
_state = await stateR.json();
|
||||
await runGameLoop();
|
||||
}
|
||||
} catch (e) { showError(e.message || 'Fehler (Starten)'); }
|
||||
}
|
||||
|
||||
async function doQueueDone() {
|
||||
try {
|
||||
await checkAndShowLocks();
|
||||
const lockR = await fetch('/lock-game/check-locks', { method: 'POST' });
|
||||
if (lockR.ok) {
|
||||
const sperren = await lockR.json();
|
||||
for (const sperre of (sperren || [])) {
|
||||
if (sperre.releaseText) await waitForReleaseOk(sperre.releaseText);
|
||||
}
|
||||
}
|
||||
const applyR = await fetch('/lock-game/apply-task', { method: 'POST' });
|
||||
if (!applyR.ok) { showError('Fehler beim Anwenden'); return; }
|
||||
const nextR = await fetch('/lock-game/next-task', { method: 'POST' });
|
||||
@@ -526,16 +609,28 @@
|
||||
} catch (e) { showError(e.message || 'Fehler (Erledigt)'); }
|
||||
}
|
||||
|
||||
function doCancelCountdown() {
|
||||
async function doCancelCountdown() {
|
||||
clearTimer();
|
||||
const lockR = await fetch('/lock-game/check-locks', { method: 'POST' });
|
||||
if (lockR.ok) {
|
||||
const sperren = await lockR.json();
|
||||
for (const sperre of (sperren || [])) {
|
||||
if (sperre.releaseText) await waitForReleaseOk(sperre.releaseText);
|
||||
}
|
||||
}
|
||||
_gameAction = 'active-done';
|
||||
document.getElementById('gameBtn').textContent = '✓ Erledigt';
|
||||
}
|
||||
|
||||
async function doErledigt() {
|
||||
try {
|
||||
await checkAndShowLocks();
|
||||
if (_state.level >= 6) { await showFinisherFlow(); return; }
|
||||
const lockR = await fetch('/lock-game/check-locks', { method: 'POST' });
|
||||
if (lockR.ok) {
|
||||
const sperren = await lockR.json();
|
||||
for (const sperre of (sperren || [])) {
|
||||
if (sperre.releaseText) await waitForReleaseOk(sperre.releaseText);
|
||||
}
|
||||
}
|
||||
const r = await fetch('/lock-game/next-task', { method: 'POST' });
|
||||
if (!r.ok) { showError('Fehler beim Ziehen'); return; }
|
||||
const stateR = await fetch('/lock-game/state');
|
||||
@@ -544,64 +639,190 @@
|
||||
} catch (e) { showError(e.message || 'Fehler (Erledigt)'); }
|
||||
}
|
||||
|
||||
async function checkAndShowLocks() {
|
||||
const r = await fetch('/lock-game/check-locks', { method: 'POST' });
|
||||
if (!r.ok) return;
|
||||
const texts = await r.json();
|
||||
const valid = texts ? texts.filter(t => t != null && t !== '') : [];
|
||||
if (valid.length > 0) {
|
||||
const box = document.getElementById('lockMessages');
|
||||
box.innerHTML = valid.map(t => `<p>🔓 ${esc(t)}</p>`).join('');
|
||||
show('lockMessages');
|
||||
await new Promise(res => setTimeout(res, 2000));
|
||||
}
|
||||
}
|
||||
|
||||
async function showFinisherFlow() {
|
||||
function showTempOpeningDialog() {
|
||||
show('gameBox');
|
||||
hide('gameCard');
|
||||
hide('lockReleaseBox');
|
||||
hide('finisherBox');
|
||||
|
||||
// 1. Release-Texte sequenziell anzeigen
|
||||
try {
|
||||
const r = await fetch('/lock-game/release-locks');
|
||||
if (r.ok) {
|
||||
const texts = await r.json();
|
||||
for (const text of texts) {
|
||||
await waitForReleaseOk(text);
|
||||
document.getElementById('tempOpeningCode').textContent = _state.tempOpeningCode || '';
|
||||
|
||||
show('tempPhase1');
|
||||
hide('tempPhase2');
|
||||
|
||||
const timerEl = document.getElementById('tempOpeningTimer');
|
||||
timerEl.textContent = '';
|
||||
timerEl.classList.remove('active', 'urgent');
|
||||
if (_state.tempOpeningTime && _state.tempOpeningDuration) {
|
||||
const endTime = new Date(new Date(_state.tempOpeningTime).getTime() + _state.tempOpeningDuration * 60000);
|
||||
if (endTime > Date.now()) startTempOpeningTimer(endTime, timerEl);
|
||||
}
|
||||
|
||||
show('tempOpeningBox');
|
||||
}
|
||||
} catch (_) { /* ignorieren */ }
|
||||
|
||||
// 2. Finisher laden und Zeit messen
|
||||
const finisherStartTime = Date.now();
|
||||
let finisher = null;
|
||||
function startTempOpeningTimer(endDate, el) {
|
||||
if (_tempOpeningTimerInt) { clearInterval(_tempOpeningTimerInt); _tempOpeningTimerInt = null; }
|
||||
el.classList.add('active');
|
||||
function tick() {
|
||||
const diff = Math.max(0, Math.round((endDate - Date.now()) / 1000));
|
||||
const m = String(Math.floor(diff / 60)).padStart(2, '0');
|
||||
const s = String(diff % 60).padStart(2, '0');
|
||||
el.textContent = m + ':' + s;
|
||||
el.classList.toggle('urgent', diff < 30);
|
||||
if (diff === 0) { clearInterval(_tempOpeningTimerInt); _tempOpeningTimerInt = null; }
|
||||
}
|
||||
tick();
|
||||
_tempOpeningTimerInt = setInterval(tick, 1000);
|
||||
}
|
||||
|
||||
async function doEndTempOpening() {
|
||||
try {
|
||||
const r = await fetch('/lock-game/finisher');
|
||||
if (r.ok) finisher = await r.json();
|
||||
} catch (_) { /* ignorieren */ }
|
||||
if (_tempOpeningTimerInt) { clearInterval(_tempOpeningTimerInt); _tempOpeningTimerInt = null; }
|
||||
|
||||
document.getElementById('finisherTitle').textContent = finisher?.kurzText || '';
|
||||
document.getElementById('finisherText').textContent = finisher?.text || 'Glückwunsch – du hast Level 6 erreicht!';
|
||||
// Only apply the queued Zeitstrafe when the opening was explicitly started from one (Path 1).
|
||||
// When triggered by a background lock expiry via checkLocks() (Path 2), lockInQueue may be set
|
||||
// to the *next* randomly-picked item — applying it would incorrectly create another background
|
||||
// lock with tempUnlockRequired and produce an infinite opening loop.
|
||||
const fromQueue = _tempOpeningFromQueue;
|
||||
_tempOpeningFromQueue = false;
|
||||
const hasLockInQueue = fromQueue && !!_state.lockInQueue;
|
||||
if (hasLockInQueue) {
|
||||
const applyR = await fetch('/lock-game/apply-task', { method: 'POST' });
|
||||
if (!applyR.ok) { showError('Fehler beim Anwenden der Zeitstrafe'); return; }
|
||||
}
|
||||
|
||||
// 3. Warten bis Nutzer OK drückt
|
||||
await new Promise(resolve => {
|
||||
document.getElementById('btnFinisherOk').onclick = resolve;
|
||||
const endR = await fetch('/lock-game/end-temp-opening', { method: 'POST' });
|
||||
if (!endR.ok) { showError('Fehler beim Beenden der Öffnung'); return; }
|
||||
const endData = await endR.json();
|
||||
|
||||
const newCode = endData.newUnlockCode;
|
||||
if (newCode) {
|
||||
document.getElementById('tempNewCode').textContent = newCode;
|
||||
document.getElementById('tempScrambleCountdown').style.display = 'none';
|
||||
document.getElementById('tempPhase2Btn').textContent = 'OK';
|
||||
document.getElementById('tempPhase2Btn').onclick = startTempScramble;
|
||||
hide('tempPhase1');
|
||||
show('tempPhase2');
|
||||
} else {
|
||||
await finishTempOpening();
|
||||
}
|
||||
} catch (e) { showError(e.message || 'Fehler beim Abschluss der temporären Öffnung'); }
|
||||
}
|
||||
|
||||
async function finishTempOpening() {
|
||||
hide('tempOpeningBox');
|
||||
await fetch('/lock-game/abandon-task', { method: 'POST' });
|
||||
const stateR = await fetch('/lock-game/state');
|
||||
_state = await stateR.json();
|
||||
await runGameLoop();
|
||||
}
|
||||
|
||||
function startTempScramble() {
|
||||
const codeEl = document.getElementById('tempNewCode');
|
||||
const cdEl = document.getElementById('tempScrambleCountdown');
|
||||
const btnEl = document.getElementById('tempPhase2Btn');
|
||||
const len = codeEl.textContent.length;
|
||||
const DURATION = 3 * 60;
|
||||
let remaining = DURATION;
|
||||
let stopped = false;
|
||||
|
||||
function randomCode() {
|
||||
return Array.from({ length: len }, () => Math.floor(Math.random() * 10)).join('');
|
||||
}
|
||||
async function finish() {
|
||||
stopped = true;
|
||||
clearInterval(_tempScrambleTimer); _tempScrambleTimer = null;
|
||||
clearInterval(_tempScrambleCd); _tempScrambleCd = null;
|
||||
await finishTempOpening();
|
||||
}
|
||||
|
||||
cdEl.style.display = '';
|
||||
btnEl.textContent = 'Abbrechen';
|
||||
btnEl.onclick = finish;
|
||||
|
||||
function updateCd() {
|
||||
const m = Math.floor(remaining / 60);
|
||||
const s = remaining % 60;
|
||||
cdEl.textContent = `${m}:${String(s).padStart(2, '0')}`;
|
||||
}
|
||||
updateCd();
|
||||
|
||||
_tempScrambleTimer = setInterval(() => { if (!stopped) codeEl.textContent = randomCode(); }, 1000);
|
||||
_tempScrambleCd = setInterval(() => {
|
||||
if (stopped) return;
|
||||
if (--remaining <= 0) finish();
|
||||
else updateCd();
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
function showFinisherUI() {
|
||||
show('gameBox');
|
||||
hide('gameCard');
|
||||
hide('lockReleaseBox');
|
||||
hide('tempOpeningBox');
|
||||
|
||||
renderLevelBar(6);
|
||||
|
||||
let finisher = {};
|
||||
try { finisher = JSON.parse(_state.finisher); } catch (_) {}
|
||||
document.getElementById('finisherLabel').textContent = finisher.kurzText || '';
|
||||
document.getElementById('finisherText').textContent = finisher.text || '';
|
||||
|
||||
const timerEl = document.getElementById('finisherTimer');
|
||||
const btnEl = document.getElementById('finisherBtn');
|
||||
timerEl.classList.remove('active', 'urgent');
|
||||
timerEl.textContent = '';
|
||||
|
||||
if (_state.finisherStartedAt) {
|
||||
timerEl.classList.add('active');
|
||||
startElapsedTimer(new Date(_state.finisherStartedAt));
|
||||
btnEl.textContent = '✓ Erledigt';
|
||||
btnEl.onclick = doEndFinisher;
|
||||
} else {
|
||||
btnEl.textContent = '▶ Starten';
|
||||
btnEl.onclick = doStartFinisher;
|
||||
}
|
||||
show('finisherBox');
|
||||
});
|
||||
}
|
||||
|
||||
// 4. Zeit berechnen und Spiel beenden
|
||||
const timeInMinutes = Math.round((Date.now() - finisherStartTime) / 60000);
|
||||
const params = new URLSearchParams({ timeInMinutes });
|
||||
if (lockId) params.set('lockId', lockId);
|
||||
await fetch('/lock-game/complete?' + params.toString(), { method: 'POST' });
|
||||
async function doStartFinisher() {
|
||||
await fetch('/lock-game/start-finisher', { method: 'POST' });
|
||||
const r = await fetch('/lock-game/state');
|
||||
_state = await r.json();
|
||||
const timerEl = document.getElementById('finisherTimer');
|
||||
timerEl.classList.add('active');
|
||||
startElapsedTimer(new Date(_state.finisherStartedAt));
|
||||
const btnEl = document.getElementById('finisherBtn');
|
||||
btnEl.textContent = '✓ Erledigt';
|
||||
btnEl.onclick = doEndFinisher;
|
||||
}
|
||||
|
||||
async function doEndFinisher() {
|
||||
clearTimer();
|
||||
await fetch('/lock-game/end-finisher', { method: 'POST' });
|
||||
const url = '/lock-game/complete' + (lockId ? '?lockId=' + lockId : '');
|
||||
await fetch(url, { method: 'POST' });
|
||||
goBack();
|
||||
}
|
||||
|
||||
function startElapsedTimer(startDate) {
|
||||
clearTimer();
|
||||
const el = document.getElementById('finisherTimer');
|
||||
function tick() {
|
||||
const diff = Math.floor((Date.now() - startDate) / 1000);
|
||||
const m = String(Math.floor(diff / 60)).padStart(2, '0');
|
||||
const s = String(diff % 60).padStart(2, '0');
|
||||
el.textContent = m + ':' + s;
|
||||
}
|
||||
tick();
|
||||
_timerInt = setInterval(tick, 1000);
|
||||
}
|
||||
|
||||
function waitForReleaseOk(text) {
|
||||
return new Promise(resolve => {
|
||||
document.getElementById('releaseText').textContent = text;
|
||||
hide('gameCard');
|
||||
document.getElementById('releaseText').textContent = text || '';
|
||||
document.getElementById('btnReleaseOk').onclick = () => {
|
||||
hide('lockReleaseBox');
|
||||
resolve();
|
||||
@@ -613,8 +834,12 @@
|
||||
// ── Level-Bar ─────────────────────────────────────────────────────────────
|
||||
|
||||
function renderLevelBar(level) {
|
||||
const lvl = Math.min(Math.max(level, 1), 5);
|
||||
document.getElementById('levelImg').src = `/img/lvl${lvl}.png`;
|
||||
const isFinisher = level >= 6;
|
||||
document.getElementById('levelImg').style.display = isFinisher ? 'none' : '';
|
||||
document.getElementById('levelTrophy').style.display = isFinisher ? '' : 'none';
|
||||
if (!isFinisher) {
|
||||
document.getElementById('levelImg').src = `/img/lvl${Math.min(Math.max(level, 1), 5)}.png`;
|
||||
}
|
||||
show('levelDisplay');
|
||||
}
|
||||
|
||||
@@ -627,7 +852,7 @@
|
||||
function startTimer(endDate, el) {
|
||||
el.classList.add('active');
|
||||
clearTimer();
|
||||
_timerInt = setInterval(() => {
|
||||
function tick() {
|
||||
const diff = Math.max(0, Math.round((endDate - Date.now()) / 1000));
|
||||
const m = String(Math.floor(diff / 60)).padStart(2, '0');
|
||||
const s = String(diff % 60).padStart(2, '0');
|
||||
@@ -639,7 +864,9 @@
|
||||
_gameAction = 'active-done';
|
||||
document.getElementById('gameBtn').textContent = '✓ Erledigt';
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
tick();
|
||||
_timerInt = setInterval(tick, 1000);
|
||||
}
|
||||
|
||||
function clearTimer() {
|
||||
@@ -658,6 +885,25 @@
|
||||
box.style.display = '';
|
||||
}
|
||||
|
||||
// ── Confirm Modal ─────────────────────────────────────────────────────────
|
||||
|
||||
const _confirmModal = document.getElementById('confirmModal');
|
||||
document.getElementById('confirmModalCancel').addEventListener('click', closeConfirmModal);
|
||||
document.getElementById('confirmModalOk').addEventListener('click', closeConfirmModal);
|
||||
_confirmModal.addEventListener('click', e => { if (e.target === _confirmModal) closeConfirmModal(); });
|
||||
document.addEventListener('keydown', e => { if (e.key === 'Escape' && _confirmModal.classList.contains('open')) closeConfirmModal(); });
|
||||
|
||||
function closeConfirmModal() { _confirmModal.classList.remove('open'); }
|
||||
|
||||
function openConfirmModal(text, onConfirm) {
|
||||
document.getElementById('confirmModalText').textContent = text;
|
||||
const okBtn = document.getElementById('confirmModalOk');
|
||||
const newOk = okBtn.cloneNode(true);
|
||||
okBtn.parentNode.replaceChild(newOk, okBtn);
|
||||
newOk.addEventListener('click', () => { closeConfirmModal(); onConfirm(); });
|
||||
_confirmModal.classList.add('open');
|
||||
}
|
||||
|
||||
boot();
|
||||
</script>
|
||||
</body>
|
||||
|
||||
Binary file not shown.
@@ -1,12 +1,3 @@
|
||||
Umsetzung des Spiels:
|
||||
Der Lockee hat eine Stunde Zeit das Spiel zu starten, dies geschieht per Knopfdruck
|
||||
Wenn er dies nicht schafft -> bei Keyholder, benachrichtige Keyholder und lass sie/ihn entscheiden, ansonsten freeze wie bei freeze card
|
||||
Übernimm die Logik des Spiels aus dem BDSM Game.
|
||||
Falls eine Zeitstrafe eine temporäre Öffnung vor oder nach der Aufgabe benötigt, öffne das Lock für 5 Minuten. Überzogene Zeit wird addiert und am Ende des Locks gefreezed
|
||||
Selbiges gilt, falls der finisher eine temporäre Öffnung danach erfoldert
|
||||
Benötigt der Finisher eine Öffnung davor, verwende die Logik der Cum Card, und addiere diese Zeit auf die möglicherweise schon vorhandenen Freeze Zeit am Ende des Locks
|
||||
|
||||
|
||||
|
||||
|
||||
wenn ich dates erfasse kann ich diese auch zu einer Verantstaltung machen,
|
||||
|
||||
@@ -4,12 +4,15 @@ import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import jakarta.persistence.AttributeConverter;
|
||||
import jakarta.persistence.Converter;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Converter
|
||||
public class StringListConverter implements AttributeConverter<List<String>, String> {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(StringListConverter.class);
|
||||
private static final ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
@Override
|
||||
@@ -18,6 +21,7 @@ public class StringListConverter implements AttributeConverter<List<String>, Str
|
||||
try {
|
||||
return mapper.writeValueAsString(list);
|
||||
} catch (Exception e) {
|
||||
LOGGER.warn("Fehler beim Serialisieren der String-Liste in DB-Spalte", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -32,6 +36,7 @@ public class StringListConverter implements AttributeConverter<List<String>, Str
|
||||
}
|
||||
return mapper.readValue(json, new TypeReference<>() {});
|
||||
} catch (Exception e) {
|
||||
LOGGER.warn("Fehler beim Deserialisieren der String-Liste aus DB-Spalte: {}", json, e);
|
||||
return List.of();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package de.oaa.xxx.dating;
|
||||
import de.oaa.xxx.social.SseService;
|
||||
import de.oaa.xxx.subscription.SubscriptionLimitService;
|
||||
import de.oaa.xxx.user.Geschlecht;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import de.oaa.xxx.user.Neigung;
|
||||
import de.oaa.xxx.user.UserEntity;
|
||||
import de.oaa.xxx.user.UserRepository;
|
||||
@@ -24,6 +26,8 @@ import java.util.stream.Collectors;
|
||||
@RequestMapping("/dating")
|
||||
public class DatingController {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DatingController.class);
|
||||
|
||||
private static final Set<VorliebeBewertung> POSITIVE_RATINGS = Set.of(
|
||||
VorliebeBewertung.MAG_ICH, VorliebeBewertung.UNBEDINGT, VorliebeBewertung.WILL_AUSPROBIEREN);
|
||||
|
||||
@@ -254,7 +258,10 @@ public class DatingController {
|
||||
return values.stream()
|
||||
.map(s -> {
|
||||
try { return Enum.valueOf(enumClass, s); }
|
||||
catch (IllegalArgumentException e) { return null; }
|
||||
catch (IllegalArgumentException e) {
|
||||
LOGGER.warn("Ungültiger Enum-Wert in Dating: {}", s);
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.filter(Objects::nonNull)
|
||||
.toList();
|
||||
|
||||
@@ -4,6 +4,8 @@ import de.oaa.xxx.social.SystemMessageService;
|
||||
import de.oaa.xxx.social.entity.MessageCause;
|
||||
import de.oaa.xxx.social.repository.BlockRepository;
|
||||
import de.oaa.xxx.subscription.SubscriptionLimitService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import de.oaa.xxx.user.Geschlecht;
|
||||
import de.oaa.xxx.user.Neigung;
|
||||
import de.oaa.xxx.user.UserEntity;
|
||||
@@ -24,6 +26,8 @@ import java.util.stream.Collectors;
|
||||
@RequestMapping("/dating/dates")
|
||||
public class DatingDateController {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(DatingDateController.class);
|
||||
|
||||
private static final int MAX_DATES_STANDARD = 1;
|
||||
private static final int MAX_DATES_PRO = 5;
|
||||
|
||||
@@ -388,7 +392,10 @@ public class DatingDateController {
|
||||
return values.stream()
|
||||
.map(s -> {
|
||||
try { return Enum.valueOf(enumClass, s); }
|
||||
catch (IllegalArgumentException e) { return null; }
|
||||
catch (IllegalArgumentException e) {
|
||||
LOGGER.warn("Ungültiger Enum-Wert in DatingDate: {}", s);
|
||||
return null;
|
||||
}
|
||||
})
|
||||
.filter(Objects::nonNull)
|
||||
.toList();
|
||||
|
||||
@@ -102,6 +102,7 @@ public class EmailChangeController {
|
||||
try {
|
||||
tokenId = UUID.fromString(token);
|
||||
} catch (IllegalArgumentException e) {
|
||||
LOGGER.warn("Ungültige E-Mail-Adresse beim Ändern: {}", e.getMessage());
|
||||
response.sendRedirect("/login.html");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -147,6 +147,7 @@ public class FeedController extends BaseController {
|
||||
try {
|
||||
typ = BeitragTyp.valueOf(req.beitragTyp());
|
||||
} catch (Exception e) {
|
||||
LOGGER.warn("Ungültiger BeitragTyp: {}", req.beitragTyp());
|
||||
return ResponseEntity.badRequest().build();
|
||||
}
|
||||
|
||||
@@ -202,6 +203,7 @@ public class FeedController extends BaseController {
|
||||
try {
|
||||
typ = BeitragTyp.valueOf(req.beitragTyp());
|
||||
} catch (Exception e) {
|
||||
LOGGER.warn("Ungültiger BeitragTyp: {}", req.beitragTyp());
|
||||
return ResponseEntity.badRequest().build();
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@ import de.oaa.xxx.mail.Email;
|
||||
import de.oaa.xxx.mail.MailService;
|
||||
import de.oaa.xxx.support.SupportUserService;
|
||||
import de.oaa.xxx.user.UserRepository;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
@@ -20,6 +22,8 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
@RequestMapping("/api/feedback")
|
||||
public class FeedbackController {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(FeedbackController.class);
|
||||
|
||||
private final MailService mailService;
|
||||
private final FeedbackRepository feedbackRepository;
|
||||
private final UserRepository userRepository;
|
||||
@@ -104,7 +108,7 @@ public class FeedbackController {
|
||||
);
|
||||
mailService.send(email);
|
||||
} catch (Exception e) {
|
||||
// Mail-Server nicht erreichbar – Eintrag ist bereits gespeichert
|
||||
LOGGER.warn("Mail-Server nicht erreichbar – Feedback-Eintrag gespeichert, E-Mail nicht versandt", e);
|
||||
}
|
||||
|
||||
return ResponseEntity.ok().build();
|
||||
|
||||
@@ -127,12 +127,12 @@ public class BdsmGameService {
|
||||
newLock.setLockee(lockeeUserId);
|
||||
newLock.setKeyholder(keyholderUserId);
|
||||
newLock.setInitialCards(template.getInitialCards());
|
||||
newLock.setPickEveryMinute(template.getPickEveryMinute());
|
||||
newLock.setPickEverySeconds(template.getPickEverySeconds());
|
||||
newLock.setAccumulatePicks(template.isAccumulatePicks());
|
||||
newLock.setShowRemainingCards(template.isShowRemainingCards());
|
||||
newLock.setLatestOpeningtime(template.getLatestOpeningtime());
|
||||
newLock.setHygineOpeningDurationMinutes(template.getHygineOpeningDurationMinutes());
|
||||
newLock.setHygineOpeningEveryMinites(template.getHygineOpeningEveryMinites());
|
||||
newLock.setHygineOpeningDurationSeconds(template.getHygineOpeningDurationSeconds());
|
||||
newLock.setHygineOpeningEverySeconds(template.getHygineOpeningEverySeconds());
|
||||
newLock.setTasks(template.getTasks());
|
||||
newLock.setRequiresVerification(template.isRequiresVerification());
|
||||
newLock.setTestLock(false);
|
||||
@@ -149,10 +149,10 @@ public class BdsmGameService {
|
||||
newLock.setAvailableCards(template.getInitialCards() != null
|
||||
? new ArrayList<>(template.getInitialCards()) : new ArrayList<>());
|
||||
newLock.setOpenPicks(0);
|
||||
if (template.getPickEveryMinute() != null) {
|
||||
newLock.setNextCardIn(now.plusMinutes(template.getPickEveryMinute()));
|
||||
if (template.getPickEverySeconds() != null) {
|
||||
newLock.setNextCardIn(now.plusSeconds(template.getPickEverySeconds()));
|
||||
}
|
||||
if (template.getHygineOpeningEveryMinites() != null) {
|
||||
if (template.getHygineOpeningEverySeconds() != null) {
|
||||
newLock.setLastHygineOpening(now);
|
||||
}
|
||||
cardlockRepository.save(newLock);
|
||||
|
||||
@@ -103,6 +103,28 @@ public class AufgabeController {
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@PostMapping("/copy/{aufgabeId}")
|
||||
public ResponseEntity<Void> copy(@PathVariable("aufgabeId") UUID aufgabeId, Principal principal) {
|
||||
AufgabeEntity source = aufgabeRepository.findById(aufgabeId).orElse(null);
|
||||
if (source == null) return ResponseEntity.notFound().build();
|
||||
AufgabenGruppeEntity gruppe = source.getAufgabenGruppe();
|
||||
int limit = limitService.maxTasksPerGroup(userService.requireUser(principal).getUserId());
|
||||
if (gruppe.getAufgaben().size() >= limit) return ResponseEntity.status(409).build();
|
||||
AufgabeEntity copy = new AufgabeEntity();
|
||||
copy.setAufgabeId(UUID.randomUUID());
|
||||
copy.setAufgabenGruppe(gruppe);
|
||||
copy.setKurzText(source.getKurzText() + " (Kopie)");
|
||||
copy.setText(source.getText());
|
||||
copy.setLevel(source.getLevel());
|
||||
copy.setSekundenVon(source.getSekundenVon());
|
||||
copy.setSekundenBis(source.getSekundenBis());
|
||||
copy.setBenoetigtAktiv(source.getBenoetigtAktiv());
|
||||
copy.setBenoetigtPassiv(source.getBenoetigtPassiv());
|
||||
copy.setBenoetigteToys(new ArrayList<>(source.getBenoetigteToys() != null ? source.getBenoetigteToys() : List.of()));
|
||||
aufgabeRepository.save(copy);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@DeleteMapping
|
||||
public ResponseEntity<Void> delete(@RequestBody Aufgabe aufgabe) {
|
||||
try {
|
||||
|
||||
@@ -199,8 +199,10 @@ public class AufgabenGruppeController {
|
||||
aufgabenGruppeService.copyGruppe(gruppeId, user.getUserId());
|
||||
return ResponseEntity.status(201).build();
|
||||
} catch (IllegalStateException e) {
|
||||
LOGGER.warn("Konflikt beim Speichern der AufgabenGruppe: {}", e.getMessage());
|
||||
return ResponseEntity.status(409).build();
|
||||
} catch (IllegalArgumentException e) {
|
||||
LOGGER.warn("Ungültiger Wert in AufgabenGruppe: {}", e.getMessage());
|
||||
String msg = e.getMessage();
|
||||
if (msg != null && msg.contains("nicht gefunden")) return ResponseEntity.notFound().build();
|
||||
return ResponseEntity.status(403).build();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user