aboutsummaryrefslogtreecommitdiff
path: root/internal
diff options
context:
space:
mode:
authorhistoria <[not public]>2026-07-12 19:23:19 -0400
committerhistoria <[not public]>2026-07-12 19:23:19 -0400
commitbeb0b73a9e56fdc717d55bbf1a1c7c5b49d4c6a4 (patch)
treefa5fb802937f631c45c46851328b4839a4b35949 /internal
parent2bacbb08d1ac67c4f63ee535728cd4e8760e3211 (diff)
downloadthehouseoficarus-beb0b73a9e56fdc717d55bbf1a1c7c5b49d4c6a4.tar.gz
feat: remains drop is optional
Diffstat (limited to 'internal')
-rw-r--r--internal/admin/static/editor.js1
-rw-r--r--internal/admin/static/mobeditor.js25
-rw-r--r--internal/admin/templates/layout.html4
3 files changed, 26 insertions, 4 deletions
diff --git a/internal/admin/static/editor.js b/internal/admin/static/editor.js
index fe0ef10..593bf7f 100644
--- a/internal/admin/static/editor.js
+++ b/internal/admin/static/editor.js
@@ -178,7 +178,6 @@ function saveItem(id) {
}
function deleteItem(id) {
- if (!confirm('Delete ' + editorType + ' "' + id + '"?')) return;
API.del('/api/' + editorType + '/' + encodeURIComponent(id)).then(function() {
notify(editorType + ' ' + id + ' deleted', 'success');
updateUndoBar();
diff --git a/internal/admin/static/mobeditor.js b/internal/admin/static/mobeditor.js
index 29664dc..2c8db21 100644
--- a/internal/admin/static/mobeditor.js
+++ b/internal/admin/static/mobeditor.js
@@ -248,6 +248,8 @@ function renderMobCard(sec, data) {
h += renderMobCoreCard(data);
} else if (sec.id === 'combat') {
h += renderMobCombatCard(data);
+ } else if (sec.id === 'drops') {
+ h += renderMobDropsCard(data);
} else if (sec.isArray) {
h += renderMobArraySection(sec, data);
} else if (sec.subtables) {
@@ -579,6 +581,27 @@ function renderMobSubtable(sec, st, data) {
return h;
}
+function renderMobDropsCard(data) {
+ var h = '';
+ var drops = data.drops || {};
+ var hasRemains = drops.remains !== undefined && drops.remains !== null;
+
+ if (hasRemains) {
+ h += '<div class="obj-sub-row" style="margin-bottom:8px">';
+ h += '<label class="obj-field obj-search"><span>Remains</span><div style="position:relative;width:100%"><input id="f_drops_remains" value="' + escAttr(String(drops.remains || '')) + '" class="search-input" data-search-type="items" data-field-path="drops.remains" placeholder="Search items..."><div class="search-results" style="display:none"></div></div></label>';
+ h += '<button class="btn btn-sm btn-danger obj-sub-remove" onclick="ced_syncDOMToData(mobData);delete mobData.drops.remains;renderMobEditor(mobID,mobData)" style="margin-bottom:0">X</button>';
+ h += '</div>';
+ } else {
+ h += '<button class="btn btn-sm obj-sub-add" onclick="ced_syncDOMToData(mobData);mobData.drops.remains=\'\';renderMobEditor(mobID,mobData)">+ Add Remains</button>';
+ }
+
+ var lootSec = MOB_SECTIONS.find(function(s) { return s.id === 'drops'; });
+ var lootSt = lootSec.subtables[0];
+ h += renderMobLootSubtable(lootSec, lootSt, drops.loot || []);
+
+ return h;
+}
+
function renderMobLootSubtable(sec, st, arr) {
var byKey = {};
st.fields.forEach(function(f) { byKey[f[0]] = f; });
@@ -713,7 +736,7 @@ function mobAddSection() {
size: 'small'
};
} else if (id === 'drops') {
- mobData[sec.path] = {remains:'bones', loot:[]};
+ mobData[sec.path] = {loot:[]};
} else if (id === 'talk') {
mobData[sec.path] = {nodes:{start:{messages:[],options:[]}}};
} else if (id === 'shop') {
diff --git a/internal/admin/templates/layout.html b/internal/admin/templates/layout.html
index f6bd405..2a1ef36 100644
--- a/internal/admin/templates/layout.html
+++ b/internal/admin/templates/layout.html
@@ -19,10 +19,10 @@
<a href="/editor/hazards" class="{{if eq .Page "hazards"}}active{{end}}">Hazards</a>
<a href="/editor/techs" class="{{if eq .Page "techs"}}active{{end}}">Techs</a>
<a href="/editor/modules" class="{{if eq .Page "modules"}}active{{end}}">Modules</a>
+ <a href="/editor/triggers" class="{{if eq .Page "triggers"}}active{{end}}">Triggers</a>
<a href="/editor/players" class="{{if eq .Page "players"}}active{{end}}">Players</a>
<a href="/editor/dashboard" class="{{if eq .Page "dashboard"}}active{{end}}">Dashboard</a>
<a href="/editor/files" class="{{if eq .Page "files"}}active{{end}}">Files</a>
- <a href="/editor/triggers" class="{{if eq .Page "triggers"}}active{{end}}">Triggers</a>
<div class="undo-bar">
<span class="undo-label"></span>
<button class="undo-btn" onclick="doUndo()" title="">⟲ Undo</button>
@@ -39,10 +39,10 @@
{{else if eq .Page "hazards"}}{{template "body-hazards" .}}
{{else if eq .Page "techs"}}{{template "body-techs" .}}
{{else if eq .Page "modules"}}{{template "body-modules" .}}
+{{else if eq .Page "triggers"}}{{template "body-triggers" .}}
{{else if eq .Page "players"}}{{template "body-players" .}}
{{else if eq .Page "dashboard"}}{{template "body-dashboard" .}}
{{else if eq .Page "files"}}{{template "body-files" .}}
-{{else if eq .Page "triggers"}}{{template "body-triggers" .}}
{{else if eq .Page "duplicate-rooms"}}{{template "body-duplicate-rooms" .}}
{{else}}<p style="color:#888;text-align:center;margin-top:60px">Unknown page: {{.Page}}</p>{{end}}
</body>