aboutsummaryrefslogtreecommitdiff
path: root/internal/admin/static
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-07-09 05:27:10 -0400
committerhistoria <[not public]>2026-07-09 05:27:10 -0400
commitc705ae942573984784ef501bf8198f61f5206ddd (patch)
treec964066f3a244002bf75cb50a877630f46496f81 /internal/admin/static
parent74153c7814fc4cef988066ef04e38731a943bc12 (diff)
downloadthehouseoficarus-c705ae942573984784ef501bf8198f61f5206ddd.tar.gz
refactor: simplify yaml, remove support for old scalar fields
Diffstat (limited to 'internal/admin/static')
-rw-r--r--internal/admin/static/intereditor.js19
-rw-r--r--internal/admin/static/map.js25
2 files changed, 3 insertions, 41 deletions
diff --git a/internal/admin/static/intereditor.js b/internal/admin/static/intereditor.js
index 4e48df1..b46c456 100644
--- a/internal/admin/static/intereditor.js
+++ b/internal/admin/static/intereditor.js
@@ -944,23 +944,6 @@ function ie_syncActEntry(ed, secId, secPath, idx) {
delete ed[secPath][idx].message;
}
-// ── Upgrade: migrate legacy message/condition/action on load ──
-
-function ie_upgradeItem(item) {
- if (!item) return;
- if (item.message && typeof item.message === 'string' && item.message.trim()) {
- if (!item.action || typeof item.action !== 'object') item.action = {};
- if (!item.action.message) item.action.message = item.message;
- delete item.message;
- }
- if (item.condition && typeof item.condition === 'string') {
- try { item.condition = JSON.parse(item.condition); } catch(e) { delete item.condition; }
- }
- if (item.action && typeof item.action === 'string') {
- try { item.action = JSON.parse(item.action); } catch(e) { delete item.action; }
- }
-}
-
// ── Shared interaction-style array-section renderer ──
//
// Replaces the duplicated `renderArraySection` (objecteditor.js) and
@@ -984,8 +967,6 @@ function ie_renderArraySection(ctx) {
var h = '';
arr.forEach(function(item, idx) {
- ie_upgradeItem(item);
-
visMap[idx] = visMap[idx] || {};
var vis = visMap[idx];
var showItem = vis.item_id || (item.item_id && item.item_id !== '');
diff --git a/internal/admin/static/map.js b/internal/admin/static/map.js
index 3507e2d..aeb2d57 100644
--- a/internal/admin/static/map.js
+++ b/internal/admin/static/map.js
@@ -1433,11 +1433,9 @@ function renderExitsSection(r) {
var target = typeof exit === 'object' ? exit.room : exit;
var cond = (typeof exit === 'object' && exit.condition) ? exit.condition : null;
var bmsg = (typeof exit === 'object' && exit.blocked_message) ? exit.blocked_message : '';
- var setFlags = (typeof exit === 'object' && exit.set_flags) ? exit.set_flags : null;
- var setPlayerFlags = (typeof exit === 'object' && exit.set_player_flags) ? exit.set_player_flags : null;
var hidden = (typeof exit === 'object' && exit.hidden) ? exit.hidden : false;
var alwaysBlocked = (typeof exit === 'object' && exit.always_blocked) ? exit.always_blocked : false;
- var isConditional = !!(cond || bmsg || setFlags || setPlayerFlags || hidden || alwaysBlocked);
+ var isConditional = !!(cond || bmsg || hidden || alwaysBlocked);
var isBidi = mapData && mapData.links && mapData.links.some(function(l) {
return l.bidirectional && ((l.from === r.id && l.to === target) || (l.from === target && l.to === r.id));
});
@@ -1475,16 +1473,9 @@ function editExitCondition(dir) {
if (typeof exit !== 'object') { exit = {room: exit}; }
var cond = exit.condition || null;
var bmsg = exit.blocked_message || '';
- var setFlags = exit.set_flags || null;
- var setPlayerFlags = exit.set_player_flags || null;
var hidden = exit.hidden || false;
var alwaysBlocked = exit.always_blocked || false;
- var flagsStr = '';
- if (setFlags) flagsStr = Object.keys(setFlags).map(function(k) { return k + '=' + setFlags[k]; }).join(', ');
- var pflagsStr = '';
- if (setPlayerFlags) pflagsStr = Object.keys(setPlayerFlags).map(function(k) { return k + '=' + setPlayerFlags[k]; }).join(', ');
-
var parsed = parseCondition(cond);
var overlay = document.createElement('div');
@@ -1494,8 +1485,6 @@ function editExitCondition(dir) {
menu.style.cssText = 'position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);min-width:520px;max-width:90vw;max-height:85vh;overflow-y:auto;overflow-x:hidden;padding:14px;z-index:201';
var h = '<h3 style="margin-bottom:8px;font-size:13px">Exit: ' + esc(dir) + ' &rarr; #' + exit.room + '</h3>';
- h += '<div class="form-group"><label>Set Flags (key=value, comma separated)</label><input id="exitFlags" value="' + escAttr(flagsStr) + '"></div>';
- h += '<div class="form-group"><label>Set Player Flags (key=value, comma separated)</label><input id="exitPFlags" value="' + escAttr(pflagsStr) + '"></div>';
h += '<div class="form-group"><label>Blocked Message</label><textarea id="exitBmsg" rows="2">' + esc(bmsg) + '</textarea></div>';
h += '<div class="form-group"><label><input type="checkbox" id="exitHidden"' + (hidden ? ' checked' : '') + '> Hidden</label></div>';
h += '<div class="form-group"><label><input type="checkbox" id="exitAlwaysBlocked"' + (alwaysBlocked ? ' checked' : '') + '> Always Blocked (blocked, shown on map)</label></div>';
@@ -1540,7 +1529,7 @@ function parseCondition(cond) {
function extractClause(c) {
var not = c.not === true;
if (c.player_flag && c.player_flag !== '') return {type: 'player_flag', value: c.player_flag, not: not};
- if (c.flag && c.flag !== '') return {type: 'flag', value: c.flag, not: not};
+ if (c.global_flag && c.global_flag !== '') return {type: 'global_flag', value: c.global_flag, not: not};
if (c.has_item && c.has_item !== '') return {type: 'has_item', value: c.has_item, not: not};
if (c.min_credits && c.min_credits !== 0) return {type: 'min_credits', value: String(c.min_credits), not: not};
if (c.value && typeof c.value === 'object' && c.value.key) return {type: 'value', value: c.value.key + '=' + (c.value.value || ''), not: not};
@@ -1555,7 +1544,7 @@ function renderConditionClauses(menu) {
clauses.forEach(function(clause, i) {
h += '<div class="cond-clause" data-idx="' + i + '" style="display:flex;gap:4px;align-items:center;margin-bottom:4px">';
h += '<select class="cond-type" onchange="var c=this.parentElement;var m=this.closest(\'.exit-modal\');var idx=parseInt(c.getAttribute(\'data-idx\'));m._condClauses[idx].type=this.value;renderConditionClauses(m)">';
- ['player_flag','flag','value','has_item','min_credits'].forEach(function(t) {
+ ['player_flag','global_flag','value','has_item','min_credits'].forEach(function(t) {
h += '<option value="' + t + '"' + (clause.type === t ? ' selected' : '') + '>' + t + '</option>';
});
h += '</select>';
@@ -1640,10 +1629,6 @@ function saveExitCondition() {
exit.hidden = hiddenEl ? hiddenEl.checked : false;
var alwaysBlockedEl = document.getElementById('exitAlwaysBlocked');
exit.always_blocked = alwaysBlockedEl ? alwaysBlockedEl.checked : false;
- var flagsStr = document.getElementById('exitFlags');
- var pflagsStr = document.getElementById('exitPFlags');
- exit.set_flags = parseFlagInput(flagsStr ? flagsStr.value : '');
- exit.set_player_flags = parseFlagInput(pflagsStr ? pflagsStr.value : '');
var clauseEls = menu.querySelectorAll('.cond-clause');
clauseEls.forEach(function(el) { updateClauseData(el); });
@@ -1682,10 +1667,6 @@ function clearExitCondition() {
renderConditionClauses(menu);
var bmsg = document.getElementById('exitBmsg');
if (bmsg) bmsg.value = '';
- var ef = document.getElementById('exitFlags');
- if (ef) ef.value = '';
- var pf = document.getElementById('exitPFlags');
- if (pf) pf.value = '';
var hx = document.getElementById('exitHidden');
if (hx) hx.checked = false;
var ab = document.getElementById('exitAlwaysBlocked');