From 8952653be9bfeeb9aadf59f845de507630d65dc4 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Mon, 13 Jul 2026 17:25:14 -0400 Subject: feat(admin): add drop tables to gui showing 1/n drop chances --- internal/admin/static/objecteditor.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'internal/admin/static/objecteditor.js') diff --git a/internal/admin/static/objecteditor.js b/internal/admin/static/objecteditor.js index b4d8282..6ae1dba 100644 --- a/internal/admin/static/objecteditor.js +++ b/internal/admin/static/objecteditor.js @@ -174,6 +174,7 @@ function renderObjectEditor(id, data) { $('#editorMain').innerHTML = html; setupSearchFields(); + setupObjectDropViews(); setTimeout(function() { document.querySelectorAll('.color-field').forEach(function(el) { bindColorField(el); }); }, 50); @@ -640,6 +641,7 @@ function renderSubtable(sec, st, data) { h += ''; h += ''; h += ''; + h += '
'; } else if (!st.single || arr.length === 0) { h += ''; } @@ -1200,6 +1202,32 @@ function deleteObject() { }).catch(function(e) { notify('Delete failed: ' + e.message, 'error'); }); } +function setupObjectDropViews() { + var gatherCard = document.querySelector('.obj-card[data-card="gather"]'); + if (gatherCard) { + var body = gatherCard.querySelector('.obj-card-body'); + if (body && body.querySelector('.obj-drop-view')) { + DropView.mount(body, function() { + ced_syncDOMToData(objectData); + var drops = (objectData.gather && objectData.gather.drops) || []; + return drops.filter(function(e) { return e.item_id || e.table; }); + }); + } + } + var stealCard = document.querySelector('.obj-card[data-card="steal"]'); + if (stealCard) { + var body = stealCard.querySelector('.obj-card-body'); + if (body && body.querySelector('.obj-drop-view')) { + DropView.mount(body, function() { + ced_syncDOMToData(objectData); + var drops = (objectData.steal && objectData.steal.drops) || []; + return drops.filter(function(e) { return e.item_id || e.table; }); + }); + } + } + DropView.setupAllInter(); +} + function loadItem(id) { loadObject(id); } function createNew() { var name = prompt('Object ID:'); -- cgit v1.2.3