Add terrain biomes jumping and extensible gathering professions
This commit is contained in:
@@ -12,7 +12,7 @@ export const signed = (value:number) => `${value>0?'+':''}${numberText(value)}`;
|
||||
export function node<K extends keyof HTMLElementTagNameMap>(tag:K,text='',className='') { const e=document.createElement(tag);e.textContent=text;e.className=className;return e; }
|
||||
export function modifiersView(modifiers:StatModifier[] = []) {
|
||||
const list=node('div','','title-effects');
|
||||
for(const m of modifiers??[]) for(const [value,suffix] of [[m.flat,''],[m.percent,'%']] as const) if(value) list.append(node('span',`${signed(value)}${suffix} ${statLabel(m.stat)}`,value>0?'effect-positive':'effect-negative'));
|
||||
for(const m of modifiers??[]) for(const [value,suffix] of [[m.flat,''],[m.percent,'%']] as const) if(value) list.append(node('span',`${signed(value)}${suffix} ${statLabel(m.stat)}${m.skill?` (${statLabel(m.skill)})`:m.stat.startsWith("gathering")?" (all gathering skills)":""}`,value>0?'effect-positive':'effect-negative'));
|
||||
return list;
|
||||
}
|
||||
export function statsBreakdown(c:Character) {
|
||||
@@ -21,7 +21,11 @@ export function statsBreakdown(c:Character) {
|
||||
for(const label of ['Stat','Base','Flat','%','Final']) { const th=node('th',label);th.scope='col';head.append(th); }
|
||||
const body=table.createTBody();
|
||||
for(const key of [...primaryStats,...derivedStats]) { const v=c.stats?.[key];if(!v)continue;const row=body.insertRow(),heading=node('th',statLabel(key));heading.scope='row';row.append(heading);for(const text of [numberText(v.base),signed(v.flat),`${signed(v.percent)}%`,numberText(v.final)])row.insertCell().textContent=text; }
|
||||
wrapper.append(table);return wrapper;
|
||||
for(const g of Object.values(c.gathering??{})){
|
||||
const row=body.insertRow();const th=node('th',`${g.name}: level ${g.level}, effective ${g.effectiveLevel} · ${g.xp} XP · ${g.xpToNextLevel} to next`);th.colSpan=5;row.append(th);
|
||||
for(const [name,v] of [['Level',g.levelValue],['Yield %',g.yield],['Speed %',g.speed],['XP %',g.experience]] as const){const row=body.insertRow();row.append(node('th',name));for(const text of [numberText(v.base),signed(v.flat),`${signed(v.percent)}%`,numberText(v.final)])row.insertCell().textContent=text;}
|
||||
}
|
||||
wrapper.append(table);for(const effect of c.gatheringEffects??[]){wrapper.append(node('p',`${effect.name} · expires ${new Date(effect.expiresAt*1000).toLocaleTimeString()}`),modifiersView(effect.modifiers));}return wrapper;
|
||||
}
|
||||
export function itemDetails(item:ItemInstance,c:Character) {
|
||||
const card=node('article','','gear-card');
|
||||
|
||||
Reference in New Issue
Block a user