From bf7c27c2cbf3eb56a0a4c5141e39b152c51614b5 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Wed, 1 Jul 2026 04:53:56 -0400 Subject: feat: admin gui map, item, and objects mostly complete --- internal/admin/static/objecteditor.js | 47 ++++++++++++++++++++++++++++++----- 1 file changed, 41 insertions(+), 6 deletions(-) (limited to 'internal/admin/static/objecteditor.js') diff --git a/internal/admin/static/objecteditor.js b/internal/admin/static/objecteditor.js index 13a983e..56894d2 100644 --- a/internal/admin/static/objecteditor.js +++ b/internal/admin/static/objecteditor.js @@ -103,7 +103,7 @@ var SECTIONS = [ }, { id: 'use_interactions', label: 'Use Interactions', path: 'use_interactions', isArray: true, - detect: function(d) { return d.use_interactions && d.use_interactions.length; }, + detect: function(d) { return d.use_interactions && Array.isArray(d.use_interactions); }, fields: [ ['item_id', 'Item ID', 'text'], ['message', 'Message', 'text'], @@ -150,6 +150,7 @@ window.onTalkTreeChange = function(data) { function loadObject(id) { objectID = id; + currentID = id; window.location.hash = id; renderList(''); API.get('/api/objects/' + encodeURIComponent(id)).then(function(data) { @@ -577,6 +578,12 @@ function addSection() { } else { objectData[sec.path] = {}; } + } else if (id === 'steal') { + objectData.steal_table = ''; + objectData.steal_level = 0; + objectData.steal_xp = 0; + objectData.steal_speed = 0; + objectData.guard_mob = ''; } expandedCards[id] = true; renderCurrent(); @@ -683,7 +690,7 @@ function setupSearchFields() { input.addEventListener('input', function() { var val = input.value.trim(); - if (!val) { results.style.display = 'none'; results.innerHTML = ''; return; } + if (!val) { results.style.display = 'none'; results.innerHTML = ''; results._selectedIndex = -1; return; } API.get('/api/search?q=' + encodeURIComponent(val)).then(function(data) { var items = []; if (entityType === 'items' && data.items) items = data.items; @@ -700,6 +707,7 @@ function setupSearchFields() { return '
Deleted
'; loadList(); }).catch(function(e) { notify('Delete failed: ' + e.message, 'error'); }); } -// Re-exports for editor.js compatibility -var currentID = null; -Object.defineProperty(window, 'currentID', { get: function() { return objectID; }, set: function(v) { objectID = v; } }); - function loadItem(id) { loadObject(id); } function createNew() { var name = prompt('Object ID:'); -- cgit v1.2.3