mirror of
https://github.com/Foundryborne/daggerheart.git
synced 2026-01-18 07:59:03 +01:00
0 or blank loadoutSize now means unlimited
This commit is contained in:
parent
fb8a1e3ff6
commit
397053dcb3
6 changed files with 44 additions and 13 deletions
|
|
@ -266,9 +266,7 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
const doc = await getDocFromElement(target);
|
||||
const actorLoadout = doc.actor.system.loadoutSlot;
|
||||
if (actorLoadout.available) return doc.update({ 'system.inVault': false });
|
||||
ui.notifications.warn(
|
||||
game.i18n.format('DAGGERHEART.UI.Notifications.loadoutMaxReached', { max: actorLoadout.max })
|
||||
);
|
||||
ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.loadoutMaxReached'));
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
@ -686,6 +684,11 @@ export default class CharacterSheet extends DHBaseActorSheet {
|
|||
*/
|
||||
static async #toggleVault(_event, button) {
|
||||
const doc = await getDocFromElement(button);
|
||||
const { available } = this.document.system.loadoutSlot;
|
||||
if (doc.system.inVault && !available) {
|
||||
return ui.notifications.warn(game.i18n.localize('DAGGERHEART.UI.Notifications.loadoutMaxReached'));
|
||||
}
|
||||
|
||||
await doc?.update({ 'system.inVault': !doc.system.inVault });
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -362,13 +362,12 @@ export default class DhCharacter extends BaseDataActor {
|
|||
|
||||
get loadoutSlot() {
|
||||
const loadoutCount = this.domainCards.loadout?.length ?? 0,
|
||||
max =
|
||||
game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).maxLoadout +
|
||||
this.bonuses.maxLoadout;
|
||||
worldSetting = game.settings.get(CONFIG.DH.id, CONFIG.DH.SETTINGS.gameSettings.Homebrew).maxLoadout,
|
||||
max = !worldSetting ? null : worldSetting + this.bonuses.maxLoadout;
|
||||
|
||||
return {
|
||||
current: loadoutCount,
|
||||
available: Math.max(max - loadoutCount, 0),
|
||||
available: !max ? true : Math.max(max - loadoutCount, 0),
|
||||
max
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -318,8 +318,16 @@ export default class DhpActor extends Actor {
|
|||
|
||||
for (var domainCard of domainCards) {
|
||||
if (levelupAuto) {
|
||||
const item = await foundry.utils.fromUuid(domainCard.data[0]);
|
||||
const embeddedItem = await this.createEmbeddedDocuments('Item', [item.toObject()]);
|
||||
const itemData = (await foundry.utils.fromUuid(domainCard.data[0])).toObject();
|
||||
const embeddedItem = await this.createEmbeddedDocuments('Item', [
|
||||
{
|
||||
...itemData,
|
||||
system: {
|
||||
...itemData.system,
|
||||
inVault: true
|
||||
}
|
||||
}
|
||||
]);
|
||||
selections.push({ ...domainCard, itemUuid: embeddedItem[0].uuid });
|
||||
} else {
|
||||
selections.push({ ...domainCard });
|
||||
|
|
@ -329,8 +337,16 @@ export default class DhpActor extends Actor {
|
|||
const achievementDomainCards = [];
|
||||
if (levelupAuto) {
|
||||
for (var card of Object.values(level.achievements.domainCards)) {
|
||||
const item = await foundry.utils.fromUuid(card.uuid);
|
||||
const embeddedItem = await this.createEmbeddedDocuments('Item', [item.toObject()]);
|
||||
const itemData = (await foundry.utils.fromUuid(card.uuid)).toObject();
|
||||
const embeddedItem = await this.createEmbeddedDocuments('Item', [
|
||||
{
|
||||
...itemData,
|
||||
system: {
|
||||
...itemData.system,
|
||||
inVault: true
|
||||
}
|
||||
}
|
||||
]);
|
||||
card.itemUuid = embeddedItem[0].uuid;
|
||||
achievementDomainCards.push(card);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue