2024-10-11 22:35:06 +00:00
|
|
|
import { FetchData, InitData } from "./data";
|
2024-09-27 10:23:36 +00:00
|
|
|
|
2024-10-01 12:57:53 +00:00
|
|
|
// Entrypoint
|
2024-10-11 22:35:06 +00:00
|
|
|
let Api;
|
|
|
|
|
|
|
|
function Main(api){
|
|
|
|
Api = api
|
|
|
|
|
2024-09-26 22:54:26 +00:00
|
|
|
console.log("Hello World!");
|
2024-09-27 13:02:19 +00:00
|
|
|
|
2024-10-05 23:36:18 +00:00
|
|
|
let dndModule = Api.createModule('dnd-5e');
|
2024-09-27 13:02:19 +00:00
|
|
|
|
2024-10-05 23:36:18 +00:00
|
|
|
dndModule.title = "Dungeons & Dragons 5e";
|
|
|
|
dndModule.description = "Dungeons & Dragons Fifth edition game system support";
|
|
|
|
dndModule.version = "0.1";
|
|
|
|
dndModule.color = "#e92026";
|
2024-10-10 13:06:45 +00:00
|
|
|
dndModule.icon = "icon.png";
|
2024-10-05 23:36:18 +00:00
|
|
|
|
2024-10-11 12:09:02 +00:00
|
|
|
let databaseWindow = Api.registerWindow('database', Api.createView('Database'));
|
|
|
|
let actorsWindow = Api.registerWindow('actors', Api.createView('Actors'));
|
|
|
|
|
|
|
|
let characterSheetWindow = Api.registerWindow('character_sheet', Api.createView('CharacterSheet'));
|
|
|
|
let itemSheetWindow = Api.registerWindow('item_sheet', Api.createView('ItemSheet'));
|
|
|
|
let createItemPromptWindow = Api.registerWindow('create_item_prompt', Api.createView('CreateItemPrompt'));
|
2024-10-11 17:33:28 +00:00
|
|
|
|
|
|
|
/*
|
2024-10-10 13:06:45 +00:00
|
|
|
dndModule.setCharacterSheet(Api.createView('CharacterSheet'));
|
|
|
|
dndModule.setItemSheet(Api.createView('ItemSheet'));
|
|
|
|
dndModule.setItemPrompt(Api.createView('CreateItemPrompt'));
|
2024-10-11 12:09:02 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
dndModule.setButtons({
|
|
|
|
right: [
|
|
|
|
{
|
|
|
|
id: 'database-button',
|
|
|
|
icon: '/icons/iconoir/regular/bookmark-book.svg',
|
|
|
|
action: () => {
|
|
|
|
Api.createWindow(databaseWindow, {
|
|
|
|
title: "Database",
|
|
|
|
id: databaseWindow,
|
|
|
|
close: () => Api.clearWindow(databaseWindow)
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}, {
|
|
|
|
id: 'group-button',
|
|
|
|
icon: '/icons/iconoir/regular/group.svg',
|
|
|
|
action: () => {
|
|
|
|
Api.createWindow(actorsWindow, {
|
|
|
|
title: "Actors",
|
|
|
|
id: actorsWindow,
|
|
|
|
close: () => Api.clearWindow(actorsWindow)
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
});
|
2024-10-10 13:06:45 +00:00
|
|
|
|
|
|
|
// Api.windows.registerWindow('character_sheet', Api.createView('CharacterSheet'));
|
|
|
|
// Api.windows.registerWindow('item_sheet', Api.createView('ItemSheet'));
|
|
|
|
// Api.windows.registerWindow('create_item_prompt', Api.createView('CreateItemPrompt'));
|
2024-10-05 23:36:18 +00:00
|
|
|
|
2024-10-11 22:35:06 +00:00
|
|
|
dndModule.init = () => {
|
|
|
|
console.log("INIT")
|
|
|
|
InitData();
|
|
|
|
FetchData();
|
|
|
|
}
|
|
|
|
|
2024-10-05 23:36:18 +00:00
|
|
|
Api.registerModule(dndModule);
|
2024-09-26 22:54:26 +00:00
|
|
|
}
|
|
|
|
|
2024-10-11 22:35:06 +00:00
|
|
|
export { Main, Api };
|