checking in

This commit is contained in:
iamBadgers
2025-08-30 10:45:55 -07:00
parent 96046dfd2a
commit 9a70b5e582
9 changed files with 979 additions and 64 deletions

View File

@@ -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

File diff suppressed because it is too large Load Diff

View File

@@ -10,11 +10,12 @@
"type": "module",
"devDependencies": {
"rollup-plugin-copy": "^3.5.0",
"rollup-plugin-scss": "^4.0.1",
"typescript": "^5.8.3",
"vite": "^7.0.6"
},
"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/plugin": "^2.11.1",
"@types/google-protobuf": "^3.15.12"

View File

@@ -12,5 +12,6 @@
"minimum": "11",
"verified": "11"
},
"esmodules": ["scripts/module.js"]
"esmodules": ["scripts/module.js"],
"styles": ["styles.css"]
}

View File

@@ -0,0 +1 @@
.window-app {}

View File

@@ -1,4 +1,4 @@
<div>
<section>
<div class="details">
<div class="character-name">Character to Archive: {{this.characterName}}</div>
<input class="player-handle" value="{{this.playerHandle}}"/>
@@ -12,23 +12,18 @@
<th>Player</th>
<th>Table</th>
<th>Version</th>
</tr>
<th>Import</th>
</trth>
{{#each this.reads}}
<tr>
<td>{{this.characterName}}</td>
<td>{{this.playerName}}</td>
<td>{{this.sourceTable}}</td>
<td>{{this.version}}</td>
<td><button class="import-button" id="{{@index}}"">i</button></td>
</tr>
{{/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>
</div>
<button class="archive-button">Archive</button>
</div>
</section>

View File

@@ -1,18 +1,22 @@
import { id as moduleId } from "../../module.json";
import {MODULE_ID, TABLE_NAME} from "../common"
import { CharacterManagerClient } from "../../proto/character.client";
import { Character, CreateCharacterRequest } from '../../proto/character'
import { GrpcWebFetchTransport } from '@protobuf-ts/grpcweb-transport'
interface CharacterArchiverData {
potato: string;
reads: Character[];
playerHandle: string;
characterName: string;
characterAlias: string;
potato: string;
reads: Character[];
playerHandle: string;
characterName: string;
characterAlias: string;
tableName: string;
}
export class CharacterArchiver extends Application {
readonly characterId: String;
readonly character: Actor | undefined;
@@ -29,13 +33,15 @@ export class CharacterArchiver extends Application {
playerHandle: "default",
characterName: "",
characterAlias: "",
tableName: "",
}
constructor(characterId: string, tableName: string) {
constructor(characterId: string) {
super()
this.characterId = 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() {
@@ -66,18 +72,20 @@ export class CharacterArchiver extends Application {
html
.find(".character-handle")
.on("input", this.handleChange.bind(this));
html
.find(".import-button")
.on("click", this.unarchiveButton.bind(this));
}
private async archiveButton() {
console.log("Potato");
let characterMsg: Character = Character.fromJson({
playerName: "iamBadgers",
characterName: this.character!.name,
characterAlias: [],
version: "",
sourceTable: "BADGERS",
sourceTable: this.data.tableName,
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;
private async handleChange(e: Event) {

View File

@@ -9,7 +9,7 @@ import { id as moduleId } from "../module.json";
import { initializeSettings } from "./settings";
import { CharacterArchiver } from "./apps/CharacterArchiver"
import "../styles/CharacterArchiver.scss"
// interface MyModule extends Game.ModuleData<ModuleData> {
// dogBrowser: DogBrowser;
// }
@@ -104,4 +104,4 @@ Hooks.on("getActorDirectoryEntryContext", async (html: any, options: any) => {
},
);
});
});

View File

@@ -1,27 +1,33 @@
import copy from "rollup-plugin-copy";
import scss from "rollup-plugin-scss";
import { defineConfig } from "vite";
export default defineConfig({
build: {
sourcemap: true,
rollupOptions: {
input: "src/ts/module.ts",
output: {
// dir: undefined,
// file: "dist/scripts/module.js",
dir: "dist/scripts",
entryFileNames: "module.js",
format: "es",
},
},
},
plugins: [
copy({
targets: [
{ src: "src/module.json", dest: "dist" },
{ src: "src/templates", dest: "dist" },
build: {
sourcemap: true,
rollupOptions: {
input: "src/ts/module.ts",
output: {
// dir: undefined,
// file: "dist/scripts/module.js",
dir: "dist",
entryFileNames: "scripts/module.js",
format: "es",
},
},
},
plugins: [
scss({
fileName: "styles.css",
sourceMap: true,
include: ["src/styles/*.scss"],
}),
copy({
targets: [
{ src: "src/module.json", dest: "dist" },
{ src: "src/templates", dest: "dist" },
],
hook: "writeBundle",
}),
],
hook: "writeBundle",
}),
],
});