meh
This commit is contained in:
@@ -1,17 +1,16 @@
|
|||||||
{
|
{
|
||||||
"id": "testmodule",
|
"id": "rush-character-archive-foundry-module",
|
||||||
"title": "Foundry TS",
|
"title": "Rush Character Archive",
|
||||||
"description": "A simple module using Typescript",
|
"description": "A module for sharing character files across foundry instances.",
|
||||||
"authors": [
|
"version": "0.0.0",
|
||||||
{
|
"authors": [
|
||||||
"name": "Josh Matthews",
|
{
|
||||||
"email": "josh@bringingfire.com"
|
"name": "badgers"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"version": "1.0.0",
|
"compatibility": {
|
||||||
"compatibility": {
|
"minimum": "11",
|
||||||
"minimum": "9",
|
"verified": "11"
|
||||||
"verified": "10"
|
},
|
||||||
},
|
"esmodules": ["scripts/module.js"]
|
||||||
"esmodules": ["scripts/module.js"]
|
|
||||||
}
|
}
|
||||||
|
|||||||
14
src/ts/apps/CharacterArchiver.ts
Normal file
14
src/ts/apps/CharacterArchiver.ts
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
|
||||||
|
export class CharacterArchiver extends Application {
|
||||||
|
|
||||||
|
static override get defaultOptions() {
|
||||||
|
const options = super.defaultOptions;
|
||||||
|
options.id = "character-archiver";
|
||||||
|
options.template = "modules/rush-character-archive-foundry-module/templates/CharacterArchiver.hbs";
|
||||||
|
options.width = 500;
|
||||||
|
options.height = 270;
|
||||||
|
options.tabs = [{ navSelector: ".tabs", contentSelector: ".theatre-config-contents", initial: "main" }];
|
||||||
|
return options;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
0
src/ts/apps/CharacterCatalog.js
Normal file
0
src/ts/apps/CharacterCatalog.js
Normal file
5
src/ts/common.ts
Normal file
5
src/ts/common.ts
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
|
||||||
|
export const MODULE_ID = "rush-character-archive-foundry-module";
|
||||||
|
|
||||||
|
export const URI_SETTING_NAME = "uri_setting";
|
||||||
|
export const API_KEY_NAME = "api_key";
|
||||||
@@ -6,6 +6,9 @@ import { ModuleData } from "@league-of-foundry-developers/foundry-vtt-types/src/
|
|||||||
import { id as moduleId } from "../module.json";
|
import { id as moduleId } from "../module.json";
|
||||||
import DogBrowser from "./apps/NewCharacter";
|
import DogBrowser from "./apps/NewCharacter";
|
||||||
|
|
||||||
|
import { initializeSettings } from "./settings";
|
||||||
|
import { CharacterArchiver } from "./apps/CharacterArchiver"
|
||||||
|
|
||||||
|
|
||||||
interface MyModule extends Game.ModuleData<ModuleData> {
|
interface MyModule extends Game.ModuleData<ModuleData> {
|
||||||
dogBrowser: DogBrowser;
|
dogBrowser: DogBrowser;
|
||||||
@@ -14,6 +17,10 @@ interface MyModule extends Game.ModuleData<ModuleData> {
|
|||||||
let module: MyModule;
|
let module: MyModule;
|
||||||
|
|
||||||
Hooks.once("init", async () => {
|
Hooks.once("init", async () => {
|
||||||
|
|
||||||
|
|
||||||
|
initializeSettings();
|
||||||
|
|
||||||
console.log("hello world!");
|
console.log("hello world!");
|
||||||
|
|
||||||
|
|
||||||
@@ -43,3 +50,51 @@ Hooks.once("init", async () => {
|
|||||||
module.dogBrowser = new DogBrowser();
|
module.dogBrowser = new DogBrowser();
|
||||||
module.dogBrowser.render(true);
|
module.dogBrowser.render(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Add to the character sheet header bar.
|
||||||
|
Hooks.on("getActorSheetHeaderButtons", (app: any, buttons: any) => {
|
||||||
|
|
||||||
|
console.log(app);
|
||||||
|
|
||||||
|
let theatreButtons = [];
|
||||||
|
|
||||||
|
theatreButtons.push({
|
||||||
|
label: "Archive",
|
||||||
|
class: "send-to-archive",
|
||||||
|
icon: "fas fa-save",
|
||||||
|
onclick: (ev: any) => {
|
||||||
|
console.log(ev)
|
||||||
|
new CharacterArchiver().render(true);
|
||||||
|
|
||||||
|
console.log("ARCHIVE ME!");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
buttons.unshift(...theatreButtons);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Add to the character context menu.
|
||||||
|
Hooks.on("getActorDirectoryEntryContext", async (html: any, options: any) => {
|
||||||
|
|
||||||
|
console.log(html)
|
||||||
|
|
||||||
|
const getActorData = (target: any) => {
|
||||||
|
console.log(target)
|
||||||
|
return game.actors.get(target.data("documentId"));
|
||||||
|
};
|
||||||
|
|
||||||
|
console.log(getActorData)
|
||||||
|
|
||||||
|
options.splice(
|
||||||
|
3,
|
||||||
|
0,
|
||||||
|
{
|
||||||
|
name: "Archive",
|
||||||
|
icon: '<i class="fas fa-save"></i>',
|
||||||
|
callback: (target) => {
|
||||||
|
|
||||||
|
new CharacterArchiver().render(true);
|
||||||
|
},
|
||||||
|
},
|
||||||
|
);
|
||||||
|
});
|
||||||
23
src/ts/settings.ts
Normal file
23
src/ts/settings.ts
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
import {MODULE_ID, URI_SETTING_NAME, API_KEY_NAME} from "./common.js"
|
||||||
|
|
||||||
|
export function initializeSettings() {
|
||||||
|
game.settings.register(MODULE_ID, URI_SETTING_NAME, {
|
||||||
|
name: "Archive Server URI",
|
||||||
|
hint: "Address of the character archive server.",
|
||||||
|
scope: "world",
|
||||||
|
config: true,
|
||||||
|
restricted: true,
|
||||||
|
default: "https://chararchive.cyberpunkrush.com",
|
||||||
|
type: String,
|
||||||
|
});
|
||||||
|
|
||||||
|
game.settings.register(MODULE_ID, API_KEY_NAME, {
|
||||||
|
name: "API Key",
|
||||||
|
hint: "API key to use when communicating with the archive server.",
|
||||||
|
scope: "world",
|
||||||
|
config: true,
|
||||||
|
restricted: true,
|
||||||
|
default: "",
|
||||||
|
type: String,
|
||||||
|
});
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user