Update README and fix linting issues #37
5 changed files with 15 additions and 17 deletions
|
@ -18,9 +18,7 @@ module.exports = {
|
||||||
|
|
||||||
overrides: [
|
overrides: [
|
||||||
{
|
{
|
||||||
files: [
|
files: ["**/__tests__/*.{j,t}s?(x)"],
|
||||||
'**/__tests__/*.{j,t}s?(x)'
|
|
||||||
],
|
|
||||||
env: {
|
env: {
|
||||||
jest: true
|
jest: true
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,7 @@
|
||||||
<img :src="imageURL" />
|
<img :src="imageURL" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped></style>
|
||||||
</style>
|
|
||||||
|
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Component, Vue, Prop } from "vue-property-decorator";
|
import { Component, Vue, Prop } from "vue-property-decorator";
|
||||||
|
|
|
@ -57,7 +57,7 @@ export class Session extends EventEmitter {
|
||||||
|
|
||||||
// Place players in the pod
|
// Place players in the pod
|
||||||
switch (this.options.spacing) {
|
switch (this.options.spacing) {
|
||||||
case "evenly":
|
case "evenly": {
|
||||||
const playerRatio = spots / playerNum;
|
const playerRatio = spots / playerNum;
|
||||||
let i = 0;
|
let i = 0;
|
||||||
for (const player of players) {
|
for (const player of players) {
|
||||||
|
@ -67,16 +67,15 @@ export class Session extends EventEmitter {
|
||||||
i += 1;
|
i += 1;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case "randomly":
|
case "randomly":
|
||||||
for (const player of players) {
|
for (const player of players) {
|
||||||
while (true) {
|
const free = [...Array(spots).keys()].filter(
|
||||||
const idx = Math.floor(Math.random() * spots);
|
i => this.pod[i].name == ""
|
||||||
if (this.pod[idx].name == "") {
|
);
|
||||||
this.pod[idx].name = player;
|
const idx = Math.floor(Math.random() * free.length);
|
||||||
assignFn(name, this.pod[idx]);
|
const chosen = free[idx];
|
||||||
break;
|
assignFn(player, this.pod[chosen]);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -179,10 +178,11 @@ export class Session extends EventEmitter {
|
||||||
const provider = DraftProvider.set(factory, options.packs);
|
const provider = DraftProvider.set(factory, options.packs);
|
||||||
return new Session(options, provider);
|
return new Session(options, provider);
|
||||||
}
|
}
|
||||||
case "i8pcube":
|
case "i8pcube": {
|
||||||
const cube = await I8PCube.fromURL(options.url);
|
const cube = await I8PCube.fromURL(options.url);
|
||||||
const provider = new DraftProvider(cube.schema());
|
const provider = new DraftProvider(cube.schema());
|
||||||
return new Session(options, provider);
|
return new Session(options, provider);
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
throw new Error("Unknown draft source");
|
throw new Error("Unknown draft source");
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,12 +12,13 @@ export async function cardImageURL(cardid: string): Promise<string> {
|
||||||
return remoteImageURL(cardid);
|
return remoteImageURL(cardid);
|
||||||
}
|
}
|
||||||
switch (cardImageSource()) {
|
switch (cardImageSource()) {
|
||||||
case "local":
|
case "local": {
|
||||||
const card = await Database.images.get(`${cardid}.webp`);
|
const card = await Database.images.get(`${cardid}.webp`);
|
||||||
if (!card) {
|
if (!card) {
|
||||||
return remoteImageURL(cardid);
|
return remoteImageURL(cardid);
|
||||||
}
|
}
|
||||||
return URL.createObjectURL(card.image);
|
return URL.createObjectURL(card.image);
|
||||||
|
}
|
||||||
//TODO
|
//TODO
|
||||||
case "remote":
|
case "remote":
|
||||||
return remoteImageURL(cardid);
|
return remoteImageURL(cardid);
|
||||||
|
|
|
@ -2,4 +2,4 @@ module.exports = {
|
||||||
env: {
|
env: {
|
||||||
jest: true
|
jest: true
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
Loading…
Reference in a new issue