aboutsummaryrefslogtreecommitdiff
path: root/internal/admin/static/mobeditor.js
diff options
context:
space:
mode:
Diffstat (limited to 'internal/admin/static/mobeditor.js')
-rw-r--r--internal/admin/static/mobeditor.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/internal/admin/static/mobeditor.js b/internal/admin/static/mobeditor.js
index 4b136a3..5e2b9cc 100644
--- a/internal/admin/static/mobeditor.js
+++ b/internal/admin/static/mobeditor.js
@@ -217,6 +217,8 @@ function renderMobEditor(id, data) {
renderTalkTree(data);
}
});
+
+ setupMobDropViews();
}
function renderCurrent() {
@@ -674,6 +676,7 @@ function renderMobLootSubtable(sec, st, arr) {
h += '<button class="btn btn-sm obj-sub-add" onclick="addMobLootRow(\'' + sec.id + '\',\'' + st.key + '\',\'item\')">+ Add Item</button>';
h += '<button class="btn btn-sm obj-sub-add" onclick="addMobLootRow(\'' + sec.id + '\',\'' + st.key + '\',\'table\')">+ Add Table</button>';
h += '</div>';
+ h += '<div class="obj-drop-view"></div>';
h += '</div>';
return h;
}
@@ -1001,6 +1004,26 @@ function deleteMob() {
}).catch(function(e) { notify('Delete failed: ' + e.message, 'error'); });
}
+function setupMobDropViews() {
+ var dropsCard = document.querySelector('.obj-card[data-card="drops"]');
+ if (dropsCard) {
+ DropView.mount(dropsCard.querySelector('.obj-card-body'), function() {
+ ced_syncDOMToData(mobData);
+ var loot = (mobData.drops && mobData.drops.loot) || [];
+ return loot.filter(function(e) { return e.item_id || e.table; });
+ });
+ }
+ var stealCard = document.querySelector('.obj-card[data-card="steal"]');
+ if (stealCard) {
+ DropView.mount(stealCard.querySelector('.obj-card-body'), function() {
+ ced_syncDOMToData(mobData);
+ var drops = (mobData.steal && mobData.steal.drops) || [];
+ return drops.filter(function(e) { return e.item_id || e.table; });
+ });
+ }
+ DropView.setupAllInter();
+}
+
// ---- editor.js compatibility ----
function loadItem(id) { loadMob(id); }