From 1bedf06969b8ab8e51dd4301a0831200df5c8f59 Mon Sep 17 00:00:00 2001 From: historia <[not public]> Date: Mon, 13 Jul 2026 18:36:29 -0400 Subject: feat(admin): tooltips added for confusing fields, hide more optional fields with buttons --- internal/admin/static/mobeditor.js | 44 +++++++++++++++++++++++++++++++++----- 1 file changed, 39 insertions(+), 5 deletions(-) (limited to 'internal/admin/static/mobeditor.js') diff --git a/internal/admin/static/mobeditor.js b/internal/admin/static/mobeditor.js index 5e2b9cc..05d33da 100644 --- a/internal/admin/static/mobeditor.js +++ b/internal/admin/static/mobeditor.js @@ -11,8 +11,8 @@ var MOB_SECTIONS = [ fields: [ ['name', 'Name', 'text', 'spaceport attendant'], ['description', 'Description', 'textarea', 'A lanky man in a wrinkled grey uniform.'], - ['unique', 'Unique', 'checkbox'], - ['protected', 'Protected', 'checkbox'], + ['unique', 'Unique', 'checkbox', '', '', null, null, 'Mob name is displayed without an article (e.g. "John Smith" instead of "a John Smith")'], + ['protected', 'Protected', 'checkbox', '', '', null, null, 'Cannot be attacked.'], ], inline: [ {label:'Idle Descriptions', key:'idle_descriptions', type:'tags'}, @@ -53,7 +53,6 @@ var MOB_SECTIONS = [ ['size', 'Size', 'text', 'small'], ], inline: [ - {label:'Combat Descriptions', key:'combat_descriptions', type:'tags'}, ] }, { @@ -437,9 +436,23 @@ function renderMobCombatCard(data) { h += renderMobField(sec, byKey['damage_without'], data, -1); h += ''; - sec.inline.forEach(function(il) { - h += ced_renderTags(sec, il, data); + var combat = data.combat || {}; + var combatDescs = Array.isArray(combat.combat_descriptions) ? combat.combat_descriptions : []; + var cdgid = 'cdg_combat'; + var hasCD = combatDescs.length > 0; + h += ''; + h += ''; return h; } @@ -834,6 +847,16 @@ function addMobLootRow(cardID, subKey, kind) { renderCurrent(); } +function addCombatDescRow(cdgid) { + var list = document.querySelector('#' + cdgid + ' .obj-combat-desc-list'); + if (!list) return; + var row = document.createElement('div'); + row.className = 'obj-combat-desc-row'; + row.style.cssText = 'display:flex;align-items:center;gap:4px;margin-bottom:4px'; + row.innerHTML = ''; + list.appendChild(row); +} + // ---- Save ---- function saveMob() { @@ -901,6 +924,17 @@ function saveMob() { 'stats.bonuses.science_percent_bonus','stats.bonuses.ranged_bonus','stats.bonuses.ranged_strength_bonus']; taskStrip.forEach(function(k) { delete sectionObj[k]; }); } + var descRows = document.querySelectorAll('.obj-combat-desc'); + if (descRows.length > 0) { + var descs = []; + descRows.forEach(function(inp) { + var v = inp.value.trim(); + if (v) descs.push(v); + }); + if (descs.length > 0) { + sectionObj['combat_descriptions'] = descs; + } + } } if (sec.subtables) { -- cgit v1.2.3