This commit is contained in:
@@ -34,6 +34,13 @@ $themes: (
|
||||
green: #98c379,
|
||||
gray: #cccccc,
|
||||
|
||||
// The rarity of an item colours its row in the sidebar (Syndria98/dragonroll#63).
|
||||
rarity-common: #ffffff,
|
||||
rarity-uncommon: #1eff00,
|
||||
rarity-rare: #2f81f7,
|
||||
rarity-very-rare: #a855f7,
|
||||
rarity-legendary: #ff8000,
|
||||
|
||||
icon-invert: 100%,
|
||||
|
||||
search-background: #20202077,
|
||||
@@ -72,6 +79,13 @@ $themes: (
|
||||
green: #98c379,
|
||||
gray: #cccccc,
|
||||
|
||||
// Same rarities as the dark map, darkened to stay readable on a light background.
|
||||
rarity-common: #1e1e1e,
|
||||
rarity-uncommon: #157f2b,
|
||||
rarity-rare: #1d4ed8,
|
||||
rarity-very-rare: #7e22ce,
|
||||
rarity-legendary: #c05621,
|
||||
|
||||
icon-invert: 0%,
|
||||
|
||||
search-background: #f0f0f0aa,
|
||||
|
||||
@@ -279,8 +279,13 @@ function entrySummary(actor) {
|
||||
return bits.join(' · ');
|
||||
}
|
||||
|
||||
function itemSummary(item) {
|
||||
return `${t(`campaigns.item.categories.${item.category}`)} · ${t(`campaigns.item.rarities.${item.rarity}`)} · ${t('campaigns.item.quantity-short')} ${item.quantity}`;
|
||||
// The rarity of an item colours the text of its row instead of listing category, rarity and
|
||||
// quantity (Syndria98/dragonroll#63): common white, uncommon green, rare blue, very rare purple,
|
||||
// legendary orange. Anything else (artifact) keeps the default text colour.
|
||||
function rarityClass(item) {
|
||||
return ['common', 'uncommon', 'rare', 'very-rare', 'legendary'].includes(item.rarity)
|
||||
? `rarity-${item.rarity}`
|
||||
: '';
|
||||
}
|
||||
|
||||
// An item's icon in the sidebar: an uploaded filename served from /api/public, or a full URL
|
||||
@@ -681,9 +686,8 @@ onBeforeUnmount(() => {
|
||||
<span v-if="row.item.image" class="entity-entry-image" aria-hidden="true">
|
||||
<img :src="itemImageUrl(row.item.image)" alt="">
|
||||
</span>
|
||||
<span class="entity-entry-name">{{ row.item.name }}</span>
|
||||
<span class="entity-entry-name" :class="rarityClass(row.item)">{{ row.item.name }}</span>
|
||||
</span>
|
||||
<span class="entity-entry-meta">{{ itemSummary(row.item) }}</span>
|
||||
</div>
|
||||
</template>
|
||||
</template>
|
||||
@@ -877,6 +881,13 @@ onBeforeUnmount(() => {
|
||||
/* An item row leads with the item's own icon on the left of its name, standing in for the
|
||||
"SYNCED" text it used to show (Syndria98/dragonroll#53). */
|
||||
.entity-entry-title { display: flex; align-items: center; gap: 9px; min-width: 0; }
|
||||
/* The rarity of an item colours the text of its row (Syndria98/dragonroll#63): common white,
|
||||
uncommon green, rare blue, very rare purple, legendary orange. */
|
||||
.entity-entry-name.rarity-common { color: var(--color-rarity-common); }
|
||||
.entity-entry-name.rarity-uncommon { color: var(--color-rarity-uncommon); }
|
||||
.entity-entry-name.rarity-rare { color: var(--color-rarity-rare); }
|
||||
.entity-entry-name.rarity-very-rare { color: var(--color-rarity-very-rare); }
|
||||
.entity-entry-name.rarity-legendary { color: var(--color-rarity-legendary); }
|
||||
.entity-entry-image {
|
||||
flex: 0 0 30px; width: 30px; height: 30px; box-sizing: border-box;
|
||||
display: grid; place-items: center; overflow: hidden;
|
||||
|
||||
@@ -20,13 +20,13 @@ function initialForm() {
|
||||
if (!editing) {
|
||||
return {
|
||||
name: '', type: 'character', species: '', className: '', level: '', background: '', challengeRating: '',
|
||||
category: 'adventuring-gear', rarity: 'common', quantity: 1, weight: '', properties: '', description: ''
|
||||
category: 'adventuring-gear', rarity: 'common', weight: '', properties: '', description: ''
|
||||
};
|
||||
}
|
||||
return {
|
||||
name: editing.name ?? '', type: 'character', species: '', className: '', level: '', background: '', challengeRating: '',
|
||||
category: editing.category ?? 'adventuring-gear', rarity: editing.rarity ?? 'common',
|
||||
quantity: editing.quantity ?? 1, weight: editing.weight ?? '', properties: editing.properties ?? '',
|
||||
weight: editing.weight ?? '', properties: editing.properties ?? '',
|
||||
description: editing.description ?? ''
|
||||
};
|
||||
}
|
||||
@@ -49,7 +49,7 @@ async function saveEntry() {
|
||||
? { name: form.value.name.trim(), campaign: data.campaign }
|
||||
: { name: form.value.name.trim(), ...(editing ? { id: editing._id } : { campaign: data.campaign }) };
|
||||
if (!isActor) {
|
||||
for (const field of ['category', 'rarity', 'quantity', 'weight', 'properties', 'description']) {
|
||||
for (const field of ['category', 'rarity', 'weight', 'properties', 'description']) {
|
||||
payload[field] = form.value[field];
|
||||
}
|
||||
}
|
||||
@@ -105,10 +105,6 @@ async function saveEntry() {
|
||||
<option value="artifact">{{ $t('campaigns.item.rarities.artifact') }}</option>
|
||||
</select>
|
||||
</label>
|
||||
<label class="form-field">
|
||||
<span>{{ $t('campaigns.item.quantity') }}</span>
|
||||
<input v-model.number="form.quantity" type="number" min="1" required>
|
||||
</label>
|
||||
<label class="form-field">
|
||||
<span>{{ $t('campaigns.item.weight') }}</span>
|
||||
<input v-model="form.weight" type="number" min="0" step="0.1">
|
||||
|
||||
@@ -22,7 +22,6 @@ function normalizeItem(item) {
|
||||
name: item?.name ?? '',
|
||||
category: item?.category ?? 'adventuring-gear',
|
||||
rarity: item?.rarity ?? 'common',
|
||||
quantity: Number(item?.quantity ?? 1),
|
||||
weight: item?.weight ?? '',
|
||||
properties: item?.properties ?? '',
|
||||
description: item?.description ?? '',
|
||||
@@ -161,11 +160,9 @@ async function removeIcon() {
|
||||
<input ref="photoInput" class="photo-input" type="file" accept="image/*" @change="onIconSelected">
|
||||
</div>
|
||||
|
||||
<!-- Quantity is the actor inventory's business (Syndria98/dragonroll#63); the item
|
||||
sheet only states what the item itself is. -->
|
||||
<dl class="item-facts">
|
||||
<div class="item-fact">
|
||||
<dt>{{ $t('campaigns.item.quantity') }}</dt>
|
||||
<dd>{{ form.quantity }}</dd>
|
||||
</div>
|
||||
<div v-if="form.weight !== '' && form.weight !== undefined" class="item-fact">
|
||||
<dt>{{ $t('campaigns.item.weight') }}</dt>
|
||||
<dd>{{ Number(form.weight).toFixed(1) }} lb</dd>
|
||||
|
||||
Reference in New Issue
Block a user