More updates

This commit is contained in:
ellimist25 2020-11-14 00:56:23 -05:00
parent 3d7a13941d
commit 435c9e295f
2 changed files with 22 additions and 1 deletions

View file

@ -1,4 +1,4 @@
export default class CharacterImporter{
export default class CharacterImporter {
// import JSON from sw5e.com
import(){
@ -1281,6 +1281,22 @@ export default class CharacterImporter{
Actor.create(targetCharacter);
}
static addImportButton(){
console.log("Starting to add Import Character button...");
const header = $("#actors").find("header.directory-header");
const search = $("#actors").children().find("div.header-search");
const newImportButtonDiv = $("#actors").children().find("div.header-actions").clone();
const newSearch = search.clone();
search.remove();
newImportButtonDiv.attr('id', 'character-sheet-import');
header.append(newImportButtonDiv);
newImportButtonDiv.children("button").remove();
newImportButtonDiv.append("<button class='create-entity'><i class='fas fa-upload'></i> Import Character</button>");
newSearch.appendTo(header);
console.log("Finished adding new button!");
}
}

View file

@ -14,9 +14,11 @@ import { preloadHandlebarsTemplates } from "./module/templates.js";
import { _getInitiativeFormula } from "./module/combat.js";
import { measureDistances, getBarAttribute } from "./module/canvas.js";
// Import Entities
import Actor5e from "./module/actor/entity.js";
import Item5e from "./module/item/entity.js";
import CharacterImporter from "./module/characterImporter.js";
// Import Applications
import AbilityTemplate from "./module/pixi/ability-template.js";
@ -40,6 +42,8 @@ import * as migrations from "./module/migration.js";
/* -------------------------------------------- */
Hooks.once("init", function() {
console.log("Enabling Hooks debug");
CONFIG.debug.hooks = true;
console.log(`SW5e | Initializing Star Wars 5th Edition System\n${SW5E.ASCII}`);
// Create a SW5E namespace within the game global
@ -213,6 +217,7 @@ Hooks.on("getChatLogEntryContext", chat.addChatMessageContextOptions);
Hooks.on("renderChatLog", (app, html, data) => Item5e.chatListeners(html));
Hooks.on("renderChatPopout", (app, html, data) => Item5e.chatListeners(html));
Hooks.on('getActorDirectoryEntryContext', Actor5e.addDirectoryContextOptions);
Hooks.on("renderActorDirectory", CharacterImporter.addImportButton());
// TODO I should remove this
Handlebars.registerHelper('getProperty', function (data, property) {