checking in
This commit is contained in:
18
module.json
18
module.json
@@ -1,18 +0,0 @@
|
|||||||
{
|
|
||||||
"id": "rush-character-archive-foundry-module",
|
|
||||||
"title": "Rush Character Archive",
|
|
||||||
"description": "A module for sharing character files across foundry instances.",
|
|
||||||
"version": "0.0.0",
|
|
||||||
"authors": [
|
|
||||||
{
|
|
||||||
"name": "badgers"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"compatibility": {
|
|
||||||
"minimum": "11",
|
|
||||||
"verified": "11"
|
|
||||||
},
|
|
||||||
"esmodules": [
|
|
||||||
"scripts/index.js"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
916
package-lock.json
generated
916
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -10,11 +10,12 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"rollup-plugin-copy": "^3.5.0",
|
"rollup-plugin-copy": "^3.5.0",
|
||||||
|
"rollup-plugin-scss": "^4.0.1",
|
||||||
"typescript": "^5.8.3",
|
"typescript": "^5.8.3",
|
||||||
"vite": "^7.0.6"
|
"vite": "^7.0.6"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@league-of-foundry-developers/foundry-vtt-types": "^9.280.0",
|
"@league-of-foundry-developers/foundry-vtt-types": "^9.280.0",
|
||||||
"@protobuf-ts/grpcweb-transport": "^2.11.1",
|
"@protobuf-ts/grpcweb-transport": "^2.11.1",
|
||||||
"@protobuf-ts/plugin": "^2.11.1",
|
"@protobuf-ts/plugin": "^2.11.1",
|
||||||
"@types/google-protobuf": "^3.15.12"
|
"@types/google-protobuf": "^3.15.12"
|
||||||
|
|||||||
@@ -12,5 +12,6 @@
|
|||||||
"minimum": "11",
|
"minimum": "11",
|
||||||
"verified": "11"
|
"verified": "11"
|
||||||
},
|
},
|
||||||
"esmodules": ["scripts/module.js"]
|
"esmodules": ["scripts/module.js"],
|
||||||
|
"styles": ["styles.css"]
|
||||||
}
|
}
|
||||||
|
|||||||
1
src/styles/CharacterArchiver.scss
Normal file
1
src/styles/CharacterArchiver.scss
Normal file
@@ -0,0 +1 @@
|
|||||||
|
.window-app {}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
<div>
|
<section>
|
||||||
<div class="details">
|
<div class="details">
|
||||||
<div class="character-name">Character to Archive: {{this.characterName}}</div>
|
<div class="character-name">Character to Archive: {{this.characterName}}</div>
|
||||||
<input class="player-handle" value="{{this.playerHandle}}"/>
|
<input class="player-handle" value="{{this.playerHandle}}"/>
|
||||||
@@ -12,23 +12,18 @@
|
|||||||
<th>Player</th>
|
<th>Player</th>
|
||||||
<th>Table</th>
|
<th>Table</th>
|
||||||
<th>Version</th>
|
<th>Version</th>
|
||||||
</tr>
|
<th>Import</th>
|
||||||
|
</trth>
|
||||||
{{#each this.reads}}
|
{{#each this.reads}}
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{this.characterName}}</td>
|
<td>{{this.characterName}}</td>
|
||||||
<td>{{this.playerName}}</td>
|
<td>{{this.playerName}}</td>
|
||||||
<td>{{this.sourceTable}}</td>
|
<td>{{this.sourceTable}}</td>
|
||||||
<td>{{this.version}}</td>
|
<td>{{this.version}}</td>
|
||||||
|
<td><button class="import-button" id="{{@index}}"">i</button></td>
|
||||||
</tr>
|
</tr>
|
||||||
{{/each}}
|
{{/each}}
|
||||||
<tr>
|
|
||||||
<td><input class="character-alias" value="{{this.characterAlias}}"/></td>
|
|
||||||
<td><input class="player-handle" value="{{this.playerHandle}}"/>
|
|
||||||
</td>
|
|
||||||
<td></td>
|
|
||||||
<td></td>
|
|
||||||
</tr>
|
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
<button class="archive-button">Archive</button>
|
<button class="archive-button">Archive</button>
|
||||||
</div>
|
</section>
|
||||||
|
|||||||
@@ -1,18 +1,22 @@
|
|||||||
import { id as moduleId } from "../../module.json";
|
import { id as moduleId } from "../../module.json";
|
||||||
|
|
||||||
|
import {MODULE_ID, TABLE_NAME} from "../common"
|
||||||
|
|
||||||
import { CharacterManagerClient } from "../../proto/character.client";
|
import { CharacterManagerClient } from "../../proto/character.client";
|
||||||
import { Character, CreateCharacterRequest } from '../../proto/character'
|
import { Character, CreateCharacterRequest } from '../../proto/character'
|
||||||
import { GrpcWebFetchTransport } from '@protobuf-ts/grpcweb-transport'
|
import { GrpcWebFetchTransport } from '@protobuf-ts/grpcweb-transport'
|
||||||
|
|
||||||
interface CharacterArchiverData {
|
interface CharacterArchiverData {
|
||||||
potato: string;
|
potato: string;
|
||||||
reads: Character[];
|
reads: Character[];
|
||||||
playerHandle: string;
|
playerHandle: string;
|
||||||
characterName: string;
|
characterName: string;
|
||||||
characterAlias: string;
|
characterAlias: string;
|
||||||
|
tableName: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export class CharacterArchiver extends Application {
|
export class CharacterArchiver extends Application {
|
||||||
|
|
||||||
readonly characterId: String;
|
readonly characterId: String;
|
||||||
readonly character: Actor | undefined;
|
readonly character: Actor | undefined;
|
||||||
|
|
||||||
@@ -29,13 +33,15 @@ export class CharacterArchiver extends Application {
|
|||||||
playerHandle: "default",
|
playerHandle: "default",
|
||||||
characterName: "",
|
characterName: "",
|
||||||
characterAlias: "",
|
characterAlias: "",
|
||||||
|
tableName: "",
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(characterId: string, tableName: string) {
|
constructor(characterId: string) {
|
||||||
super()
|
super()
|
||||||
this.characterId = characterId;
|
this.characterId = characterId;
|
||||||
this.character = (game as Game).actors!.get(characterId);
|
this.character = (game as Game).actors!.get(characterId);
|
||||||
this.data.characterName = this.character!.name || "";;
|
this.data.characterName = this.character!.name || "";
|
||||||
|
this.data.tableName = (game as Game).settings!.get(MODULE_ID, TABLE_NAME) as string;
|
||||||
}
|
}
|
||||||
|
|
||||||
static override get defaultOptions() {
|
static override get defaultOptions() {
|
||||||
@@ -66,18 +72,20 @@ export class CharacterArchiver extends Application {
|
|||||||
html
|
html
|
||||||
.find(".character-handle")
|
.find(".character-handle")
|
||||||
.on("input", this.handleChange.bind(this));
|
.on("input", this.handleChange.bind(this));
|
||||||
|
|
||||||
|
html
|
||||||
|
.find(".import-button")
|
||||||
|
.on("click", this.unarchiveButton.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
private async archiveButton() {
|
private async archiveButton() {
|
||||||
|
|
||||||
console.log("Potato");
|
|
||||||
|
|
||||||
let characterMsg: Character = Character.fromJson({
|
let characterMsg: Character = Character.fromJson({
|
||||||
playerName: "iamBadgers",
|
playerName: "iamBadgers",
|
||||||
characterName: this.character!.name,
|
characterName: this.character!.name,
|
||||||
characterAlias: [],
|
characterAlias: [],
|
||||||
version: "",
|
version: "",
|
||||||
sourceTable: "BADGERS",
|
sourceTable: this.data.tableName,
|
||||||
json: JSON.stringify(this.character!.toJSON())
|
json: JSON.stringify(this.character!.toJSON())
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -91,6 +99,11 @@ export class CharacterArchiver extends Application {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async unarchiveButton(i: Event) {
|
||||||
|
console.log((i!.currentTarget! as HTMLElement).id);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
timeout: NodeJS.Timeout | undefined;
|
timeout: NodeJS.Timeout | undefined;
|
||||||
|
|
||||||
private async handleChange(e: Event) {
|
private async handleChange(e: Event) {
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ import { id as moduleId } from "../module.json";
|
|||||||
import { initializeSettings } from "./settings";
|
import { initializeSettings } from "./settings";
|
||||||
import { CharacterArchiver } from "./apps/CharacterArchiver"
|
import { CharacterArchiver } from "./apps/CharacterArchiver"
|
||||||
|
|
||||||
|
import "../styles/CharacterArchiver.scss"
|
||||||
// interface MyModule extends Game.ModuleData<ModuleData> {
|
// interface MyModule extends Game.ModuleData<ModuleData> {
|
||||||
// dogBrowser: DogBrowser;
|
// dogBrowser: DogBrowser;
|
||||||
// }
|
// }
|
||||||
@@ -104,4 +104,4 @@ Hooks.on("getActorDirectoryEntryContext", async (html: any, options: any) => {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,27 +1,33 @@
|
|||||||
import copy from "rollup-plugin-copy";
|
import copy from "rollup-plugin-copy";
|
||||||
|
import scss from "rollup-plugin-scss";
|
||||||
import { defineConfig } from "vite";
|
import { defineConfig } from "vite";
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
build: {
|
build: {
|
||||||
sourcemap: true,
|
sourcemap: true,
|
||||||
rollupOptions: {
|
rollupOptions: {
|
||||||
input: "src/ts/module.ts",
|
input: "src/ts/module.ts",
|
||||||
output: {
|
output: {
|
||||||
// dir: undefined,
|
// dir: undefined,
|
||||||
// file: "dist/scripts/module.js",
|
// file: "dist/scripts/module.js",
|
||||||
dir: "dist/scripts",
|
dir: "dist",
|
||||||
entryFileNames: "module.js",
|
entryFileNames: "scripts/module.js",
|
||||||
format: "es",
|
format: "es",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
copy({
|
scss({
|
||||||
targets: [
|
fileName: "styles.css",
|
||||||
{ src: "src/module.json", dest: "dist" },
|
sourceMap: true,
|
||||||
{ src: "src/templates", dest: "dist" },
|
include: ["src/styles/*.scss"],
|
||||||
|
}),
|
||||||
|
copy({
|
||||||
|
targets: [
|
||||||
|
{ src: "src/module.json", dest: "dist" },
|
||||||
|
{ src: "src/templates", dest: "dist" },
|
||||||
],
|
],
|
||||||
hook: "writeBundle",
|
hook: "writeBundle",
|
||||||
}),
|
}),
|
||||||
],
|
],
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user