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/mobeditor.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/mobeditor.js')
| -rw-r--r-- | internal/admin/static/mobeditor.js | 23 |
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); } |
