diff options
| author | historia <[not public]> | 2026-07-13 17:25:14 -0400 |
|---|---|---|
| committer | historia <[not public]> | 2026-07-13 17:25:14 -0400 |
| commit | 8952653be9bfeeb9aadf59f845de507630d65dc4 (patch) | |
| tree | 64babb2c89568734cc5ff59b386845f1707f7ecf /internal/admin/static/objecteditor.js | |
| parent | 709917f657eda63f10ea244546e8bb7fd4d839e8 (diff) | |
| download | thehouseoficarus-8952653be9bfeeb9aadf59f845de507630d65dc4.tar.gz | |
feat(admin): add drop tables to gui showing 1/n drop chances
Diffstat (limited to 'internal/admin/static/objecteditor.js')
| -rw-r--r-- | internal/admin/static/objecteditor.js | 28 |
1 files changed, 28 insertions, 0 deletions
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 += '<button class="btn btn-sm obj-sub-add" style="flex:1;margin-top:0" onclick="addDropRow(\'' + sec.id + '\',\'' + st.key + '\',\'item\')">+ Add Item Drop</button>'; h += '<button class="btn btn-sm obj-sub-add" style="flex:1;margin-top:0" onclick="addDropRow(\'' + sec.id + '\',\'' + st.key + '\',\'table\')">+ Add Table Drop</button>'; h += '</div>'; + h += '<div class="obj-drop-view"></div>'; } else if (!st.single || arr.length === 0) { h += '<button class="btn btn-sm obj-sub-add" onclick="addSubRow(\'' + sec.id + '\',\'' + st.key + '\')">+ Add</button>'; } @@ -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:'); |
