From b3d4c616f59ad2519f3a0b77e3b47d6571cd2486 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Thu, 9 Jul 2026 19:29:17 -0400 Subject: feat: message actions are now sequences of messages with settable delays --- internal/admin/static/admin.css | 4 + internal/admin/static/intereditor.js | 168 +++++++++++++++++++++++------------ 2 files changed, 114 insertions(+), 58 deletions(-) (limited to 'internal/admin') diff --git a/internal/admin/static/admin.css b/internal/admin/static/admin.css index 393fafd..b35d5e2 100644 --- a/internal/admin/static/admin.css +++ b/internal/admin/static/admin.css @@ -400,6 +400,7 @@ g.ud-hover:hover text{font-weight:bold} .ie-cond-leaf input[type="number"], .ie-cond-val{font-size:11px;padding:3px 6px;background:var(--bg);color:var(--text);border:1px solid var(--border);border-radius:3px;font-family:monospace;flex:1;min-width:80px} .ie-cond-subval{font-size:11px;padding:3px 6px;background:var(--bg);color:var(--text);border:1px solid var(--border);border-radius:3px;font-family:monospace;width:100px} +.ie-cond-eq{font-size:11px;color:#888;font-weight:bold;white-space:nowrap;flex-shrink:0} .ie-cond-rm{flex-shrink:0} .ie-cond-grp-rm{margin-left:auto} .ie-cond-addbar{display:flex;gap:3px;flex-wrap:wrap;margin-top:4px} @@ -419,6 +420,9 @@ g.ud-hover:hover text{font-weight:bold} .ie-kv-row{display:flex;gap:4px;align-items:center} .ie-kv-key,.ie-kv-val{font-size:11px;padding:2px 4px;background:var(--bg);color:var(--text);border:1px solid var(--border);border-radius:3px;font-family:monospace;width:120px} .ie-kv-val{width:80px} +.ie-act-msg-delay,.ie-act-msg{font-size:11px;padding:3px 6px;background:var(--input-bg);color:var(--text);border:1px solid var(--input-border);border-radius:3px;font-family:monospace} +.ie-act-msg-delay{width:60px} +.ie-act-msg{flex:1} /* Interaction row layout: column. The single flex header row holds the +Add Required Item / +Add Condition / +Add Action buttons alongside the diff --git a/internal/admin/static/intereditor.js b/internal/admin/static/intereditor.js index b46c456..5cf39a1 100644 --- a/internal/admin/static/intereditor.js +++ b/internal/admin/static/intereditor.js @@ -5,7 +5,7 @@ // ── Condition leaf types ── var IE_COND_TYPES = [ - {type: 'global_flag', label: 'Global Flag', hint: 'world flag name'}, + {type: 'global_flag', label: 'Global Flag', hint: 'global flag name'}, {type: 'player_flag', label: 'Player Flag', hint: 'player flag name'}, {type: 'has_item', label: 'Has Item', hint: 'item ID'}, {type: 'min_credits', label: 'Min Credits', hint: 'amount'}, @@ -218,11 +218,18 @@ function ie_collectAct(rootEl) { if (!rootEl) return null; var r = {}; - // Message (rolled into action) - var msgEl = rootEl.querySelector('.ie-act-msg'); - if (msgEl) { - var msg = msgEl.value.trim(); - r.message = msg; + // Messages — collected from the extendable delay+message rows. + var msgsKv = rootEl.querySelector('.ie-act-kv[data-ie-act-key="messages"]'); + if (msgsKv) { + var list = []; + msgsKv.querySelectorAll('.ie-kv-row').forEach(function(row) { + var delayEl = row.querySelector('.ie-act-msg-delay'); + var msgEl = row.querySelector('.ie-act-msg'); + var d = delayEl ? parseInt(delayEl.value) || 0 : 0; + var m = msgEl ? msgEl.value.trim() : ''; + list.push({ message: m, delay: d }); + }); + r.messages = list; } // KV-type effects — include the map even when empty (as long as the @@ -233,6 +240,7 @@ function ie_collectAct(rootEl) { rootEl.querySelectorAll('.ie-act-kv').forEach(function(kvEl) { var key = kvEl.getAttribute('data-ie-act-key'); if (!key) return; + if (key === 'messages') return; var map = {}; kvEl.querySelectorAll('.ie-kv-row').forEach(function(row) { var kEl = row.querySelector('.ie-kv-key'); @@ -291,8 +299,6 @@ function ie_syncAllInteractions(data, secs) { var act = ie_collectAct(actRoot); if (act) data[p][idx].action = act; else delete data[p][idx].action; - // Clear any legacy top-level message on sync. - delete data[p][idx].message; } }); }); @@ -410,7 +416,7 @@ function _ie_renderLeaf(leafType, leafVal, leafSub, not, secId, secPath, idx, gp var h = '