Add item actions, targeting, bindings, and encumbrance
This commit is contained in:
@@ -214,13 +214,14 @@ function gatheringForm(kind:string,existing?:NonNullable<Catalog['gathering']>['
|
||||
const fields=form(existing?`Edit ${existing.name} · publish revision ${(existing.revision??1)+1}`:'Create biome',existing?'update-biome':'create-biome',()=>({...existing?{targetId:existing.id}:{},biome:{...values.read(),color:color.value,weight:Number(weight.value),resources:checks.filter(c=>c.input.checked).map(c=>c.id)}}));
|
||||
fields.append(values.node,field('Terrain color',color),field('Relative occurrence weight',weight),resources,node('p','Reuse any existing resource. Published biome revisions affect unexplored chunks; explored layouts remain unchanged. Adding a new resource from the resource editor also versions its selected biomes.','muted'));
|
||||
}else{
|
||||
const seconds=number(120,1,86400),effects=modifiers();
|
||||
const fields=form('Create gathering consumable','create-consumable',()=>{const mods=effects.read();if(!mods.length||mods.some(m=>!m.stat.startsWith('gathering')))throw new Error('Choose gathering level, yield, speed, or XP modifiers.');return{consumable:{...values.read(),seconds:Number(seconds.value),modifiers:mods}}});
|
||||
fields.append(values.node,field('Duration (seconds)',seconds),effects.node,node('p','Grant this item from Characters → Manage items and titles. Players use it from their bag. Reuse refreshes this consumable’s duration; distinct sources combine. Expiry uses real time, including time offline.','muted'));
|
||||
const seconds=number(120,1,86400),effects=modifiers(),kind=select(['gathering-buff','heal','weapon-coating']),amount=number(10,.1,10000);
|
||||
const fields=form('Create consumable','create-consumable',()=>{const mods=kind.value==='gathering-buff'?effects.read():[];if(kind.value==='gathering-buff'&&(!mods.length||mods.some(m=>!m.stat.startsWith('gathering'))))throw new Error('Choose gathering level, yield, speed, or XP modifiers.');return{consumable:{...values.read(),seconds:Number(seconds.value),modifiers:mods,...kind.value==='gathering-buff'?{}:{useEffect:{kind:kind.value,amount:Number(amount.value)}}}}});
|
||||
kind.onchange=()=>{effects.node.hidden=kind.value!=='gathering-buff';amount.parentElement!.hidden=kind.value==='gathering-buff';seconds.parentElement!.hidden=kind.value==='heal'};
|
||||
fields.append(values.node,field('Use effect',kind),field('Duration (seconds)',seconds),field('Healing or extra weapon damage',amount),effects.node,node('p','Healing can target yourself, a nearby player, or a mob. Coatings target a carried damage weapon and add damage to its hits for the duration; a new coating replaces the old one. Timers include time offline. Grant items from Characters → Manage items and titles.','muted'));kind.dispatchEvent(new Event('change'));
|
||||
}
|
||||
}
|
||||
function gatheringList(){
|
||||
const labels:Record<string,string>={gathering:'gathering skill',resources:'resource',biomes:'biome',consumables:'gathering consumable'};
|
||||
const labels:Record<string,string>={gathering:'gathering skill',resources:'resource',biomes:'biome',consumables:'consumable'};
|
||||
list.append(button(`Create ${labels[section]}`,()=>gatheringForm(section)));
|
||||
const g=catalog.gathering;const entries=section==='gathering'?g?.skills:section==='resources'?g?.resources:section==='biomes'?g?.biomes:g?.consumables;
|
||||
for(const v of entries??[]){const d=node('details','','catalog-definition');d.append(node('summary',v.name),node('p',v.description),readableDefinition(v));
|
||||
|
||||
Reference in New Issue
Block a user