Skip to content

Commit

Permalink
fix: Fixes issue where switching a party in the tracker wouldn't allo…
Browse files Browse the repository at this point in the history
…w parties to be loaded from encounters
  • Loading branch information
valentine195 committed Mar 3, 2022
1 parent 9567f16 commit 9940382
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/encounter/ui/Encounter.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
.flat();
view?.newEncounter({
party,
name,
players,
creatures,
Expand Down
1 change: 0 additions & 1 deletion src/svelte/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@
}}
on:save={(evt) => {
const creature = evt.detail;
console.log(creature.display);
const newCreature = new Creature(
{
name: creature.name,
Expand Down
6 changes: 6 additions & 0 deletions src/view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -259,17 +259,22 @@ export default class TrackerView extends ItemView {

async newEncounter({
name,
party = this.party,
players = true,
creatures = [],
roll = true,
xp = null
}: {
party?: string;
name?: string;
players?: boolean | string[];
creatures?: Creature[];
roll?: boolean;
xp?: number;
} = {}) {
if (party && party != this.party) {
this.party = party;
}
if (players instanceof Array && players.length) {
this.creatures = [
...this.players.filter((p) => players.includes(p.name))
Expand All @@ -284,6 +289,7 @@ export default class TrackerView extends ItemView {
this.name = name;
this.round = 1;
this.setAppState({
party: this.party,
name: this.name,
round: this.round,
xp
Expand Down

0 comments on commit 9940382

Please sign in to comment.