diff --git a/examples/Mushu.json b/examples/Mushu.json new file mode 100644 index 00000000..4c71811a --- /dev/null +++ b/examples/Mushu.json @@ -0,0 +1 @@ +{"flavor":{"faction":"","environment":"","description":"","nameIsProper":true,"imageUrl":"https://static.wikia.nocookie.net/disney/images/1/17/Profile_-_Mushu.jpeg/revision/latest?cb=20190425004614","descriptionHtml":""},"stats":{"size":"Small","race":"Dragon","alignment":"Unaligned","armorType":"Natural Armor","armorClass":16,"numHitDie":15,"speed":"40 ft.","abilityScores":{"strength":16,"dexterity":12,"constitution":15,"intelligence":8,"wisdom":14,"charisma":8},"proficiencyBonus":0,"damageVulnerabilities":[],"damageResistances":[],"damageImmunities":["Fire"],"conditionImmunities":[],"senses":["darkvision 60ft.","Passive Oerception 12"],"languages":["Draconic"],"challengeRating":2,"experiencePoints":450,"legendaryActionsPerRound":3,"legendaryActionsDescription":"","savingThrows":[{"ability":"dexterity","proficient":false,"value":1,"modifier":1,"modifierStr":"Dex +1","$$hashKey":"object:1076"},{"ability":"wisdom","proficient":false,"value":2,"modifier":2,"modifierStr":"Wis +2","$$hashKey":"object:1077"}],"skills":[],"additionalAbilities":[],"actions":[{"name":"Bite","description":"Melee Weapon Attack: +5 to hit, reach 5 ft., one target. Hit: 4 (1d6) piercing and 2 fire damage.\n","descriptionHtml":{},"$$hashKey":"object:1060"}],"reactions":[{"name":"Infused Strikes.","description":"When another creature within 30 feet of the drake that it can see hits with a weapon attack, the drake infuses the strike with its essence, causing the attack to deal an extra 1d6 [fire] damage","descriptionHtml":{},"$$hashKey":"object:1065"}],"legendaryActions":[],"hitDieSize":10,"armorTypeStr":"(Natural Armor)","abilityScoreModifiers":{"strength":3,"dexterity":1,"constitution":2,"intelligence":-1,"wisdom":2,"charisma":-1},"abilityScoreStrs":{"strength":"16 (+3)","dexterity":"12 (+1)","constitution":"15 (+2)","intelligence":"8 (–1)","wisdom":"14 (+2)","charisma":"8 (–1)"},"extraHealthFromConstitution":30,"hitPoints":112,"hitPointsStr":"112 (15d10 + 30)","passivePerception":12,"challengeRatingStr":"2"},"sharing":{"linkSharingEnabled":true},"_id":"5fd0466f60c2d632c8613e3d","name":"Mushu","__v":0,"publishedBestiaryId":"5fd045c660c2d632c8613e19"} \ No newline at end of file diff --git a/module/characterImporter.js b/module/characterImporter.js index 08f53ff7..ed96c71e 100644 --- a/module/characterImporter.js +++ b/module/characterImporter.js @@ -1295,29 +1295,46 @@ export default class CharacterImporter { newSearch.appendTo(header); let characterImportButton = $("#cs-import-button"); - characterImportButton.click(e => { - let file; - let content = '

Saved Character JSONImport

' + characterImportButton.click(ev => { + console.log("FISH: character import button pressed. 2") + let files = []; + let content = '

Saved Character JSON Import

' + '' + '
' + '
'; let importDialog = new Dialog({ title: "Import Character from SW5e.com", - content: "HTML Content", - buttons: "The buttons which are disapled as action chjoices for teh dialog", - render: "A callback function invoed when teh dialog is rendered", - close: "Common callback operations to perform when the dialog is closed" - } + content: content, + buttons: { + "Import": { + icon: '', + label: "Import Character", + callback: (e) => { + files = document.querySelector('#sw5e-character-json').files; + if (files){ + for (let i = 0; i < files.length; i++){ + console.log("Importing character..."); + console.log(JSON.stringify(files)); + const readerooni = new FileReader(); + readerooni.onload = async (x) => { + const characterData = JSON.parse(x.target.result); + } + readerooni.readAsText(files[i]); + } + } else { + console.log("No files selected..."); + } + } + }, + "Cancel": { + icon: '', + label: "Cancel", + callback: () => {}, + } + } + }) + importDialog.render(true); }); - - - } - - -} - - -/* -var c = new CharacterImporter().import('filename').transform(); -*/ \ No newline at end of file + } +} \ No newline at end of file