Fix issue with details roller

This commit is contained in:
RussellChamp committed 2021-07-30 00:17:49 -04:00
1 parent ec4617e036
commit e96028b65c
3 files changed
+24 -7

No files matched your search

+1
View File
@@ -1,3 +1,4 @@
Add NPC, and Dungeons roll tables Add NPC, and Dungeons roll tables
Put the rollers in their own accordion slots Put the rollers in their own accordion slots
Make everything look nicer Make everything look nicer
Add a 3d dice rolling visualizer
+4 -7
View File
@@ -24,13 +24,10 @@
rollVisibility, rollVisibility,
} from "./details"; } from "./details";
let rollResults: { category: string; value: string; timestamp: string }[] = []; let rollResults: { type: string; value: string; timestamp: string }[] = [];
function addResult(item: { roll: number; description: string }) { function addResult(item: { type: string; description: string; roll: number }) {
rollResults = [ rollResults = [{ type: item.type, value: item.description, timestamp: formatDate(new Date(), "P kk:mm:ss") }, ...rollResults];
{ category: item.constructor.name, value: item.description, timestamp: formatDate(new Date(), "P kk:mm:ss") },
...rollResults,
];
} }
</script> </script>
@@ -94,7 +91,7 @@
</span> </span>
{#each rollResults as result} {#each rollResults as result}
<h4>{result.timestamp}: ({result.category}): {result.value}</h4> <h4>{result.timestamp}: ({result.type}): {result.value}</h4>
{/each} {/each}
</main> </main>
+19
View File
@@ -1,6 +1,7 @@
import { random, replace, sample, sampleSize } from "lodash"; import { random, replace, sample, sampleSize } from "lodash";
export class Ability { export class Ability {
type: string = "ability";
constructor(public roll: number = 0, public description = "") { }; constructor(public roll: number = 0, public description = "") { };
} }
@@ -26,6 +27,7 @@ export function rollAbility(roll: number = random(1, 12)): Ability {
} }
export class Activity { export class Activity {
type: string = "activity";
constructor(public roll: number = 0, public description: string = "") { }; constructor(public roll: number = 0, public description: string = "") { };
} }
@@ -50,6 +52,7 @@ export function rollActivity(roll: number = random(1, 12)): Activity {
} }
export class Adjective { export class Adjective {
type: string = "adjective";
constructor(public roll: number = 0, public description: string = "") { }; constructor(public roll: number = 0, public description: string = "") { };
} }
@@ -74,6 +77,7 @@ export function rollAdjective(roll: number = random(1, 12)): Adjective {
} }
export class Age { export class Age {
type: string = "age";
constructor(public roll: number = 0, public description: string = "") { }; constructor(public roll: number = 0, public description: string = "") { };
} }
@@ -98,6 +102,7 @@ export function rollAge(roll: number = random(1, 12)): Age {
} }
export class Alignment { export class Alignment {
type: string = "alignment";
constructor(public roll: number = 0, public description: string = "") { }; constructor(public roll: number = 0, public description: string = "") { };
} }
@@ -120,6 +125,7 @@ export function rollAlignment(roll: number = random(1, 12)): Alignment {
} }
export class Aspect { export class Aspect {
type: string = "aspect";
constructor(public roll: number = 0, public description: string = "") { }; constructor(public roll: number = 0, public description: string = "") { };
} }
@@ -145,6 +151,7 @@ export function rollAspect(roll: number = random(1, 12)): Aspect {
} }
export class Condition { export class Condition {
type: string = "condition";
constructor(public roll: number = 0, public description: string = "") { }; constructor(public roll: number = 0, public description: string = "") { };
} }
@@ -171,6 +178,7 @@ export function rollCondition(roll: number = random(1, 12)): Condition {
} }
export class Disposition { export class Disposition {
type: string = "disposition";
constructor(public roll: number = 0, public description: string = "") { }; constructor(public roll: number = 0, public description: string = "") { };
} }
@@ -197,6 +205,7 @@ export function rollDisposition(roll: number = random(1, 12)): Disposition {
} }
export class Element { export class Element {
type: string = "element";
constructor(public roll: number = 0, public description: string = "") { }; constructor(public roll: number = 0, public description: string = "") { };
} }
@@ -221,6 +230,7 @@ export function rollElement(roll: number = random(1, 12)): Element {
} }
export class Feature { export class Feature {
type: string = "feature";
constructor(public roll: number = 0, public description: string = "") { }; constructor(public roll: number = 0, public description: string = "") { };
} }
@@ -255,6 +265,7 @@ export function rollFeature(roll: number = random(1, 12)): Feature {
} }
export class MagicType { export class MagicType {
type: string = "magic type";
constructor(public roll: number = 0, public description: string = "") { }; constructor(public roll: number = 0, public description: string = "") { };
} }
@@ -278,6 +289,7 @@ export function rollMagicType(roll: number = random(1, 12)): MagicType {
} }
export class NumAppearing { export class NumAppearing {
type: string = "num appearing";
constructor(public roll: number = 0, public description: string = "", public count: string = "") { }; constructor(public roll: number = 0, public description: string = "", public count: string = "") { };
} }
@@ -298,6 +310,7 @@ export function rollNumAppearing(roll: number = random(1, 12)): NumAppearing {
} }
export class Oddity { export class Oddity {
type: string = "oddity";
constructor(public roll: number = 0, public description: string = "") { }; constructor(public roll: number = 0, public description: string = "") { };
} }
@@ -323,6 +336,7 @@ export function rollOddity(roll: number = random(1, 12)): Oddity {
} }
export class Orientation { export class Orientation {
type: string = "orientation";
constructor(public roll: number = 0, public description: string = "") { }; constructor(public roll: number = 0, public description: string = "") { };
} }
@@ -355,6 +369,7 @@ export function rollOrientation(roll: number = random(1, 12)): Orientation {
} }
export class Ruination { export class Ruination {
type: string = "ruination";
constructor(public roll: number = 0, public description: string = "") { }; constructor(public roll: number = 0, public description: string = "") { };
} }
@@ -383,6 +398,7 @@ export function rollRuination(roll: number = random(1, 12)): Ruination {
} }
export class Size { export class Size {
type: string = "size";
constructor(public roll: number = 0, public description: string = "") { }; constructor(public roll: number = 0, public description: string = "") { };
} }
@@ -405,6 +421,7 @@ export function rollSize(roll: number = random(1, 12)): Size {
} }
export class Tag { export class Tag {
type: string = "tag";
constructor(public roll: number = 0, public description: string = "") { }; constructor(public roll: number = 0, public description: string = "") { };
} }
@@ -438,6 +455,7 @@ export function rollTag(roll: number = random(1, 12)) {
} }
export class Terrain { export class Terrain {
type: string = "terrain";
constructor(public roll: number = 0, public description: string = "") { }; constructor(public roll: number = 0, public description: string = "") { };
} }
@@ -464,6 +482,7 @@ export function rollTerrain(roll: number = random(1, 12)): Terrain {
} }
export class Visibility { export class Visibility {
type: string = "visibility";
constructor(public roll: number = 0, public description: string = "") { }; constructor(public roll: number = 0, public description: string = "") { };
} }