aboutsummaryrefslogtreecommitdiff
path: root/internal/admin/static/objecteditor.js
diff options
context:
space:
mode:
Diffstat (limited to 'internal/admin/static/objecteditor.js')
-rw-r--r--internal/admin/static/objecteditor.js28
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:');