foundry-sw5e/module/characterImporter.js

1323 lines
41 KiB
JavaScript
Raw Normal View History

2020-11-14 00:56:23 -05:00
export default class CharacterImporter {
// import JSON from sw5e.com
import(){
this.sourceCharacter = {
"schema_version": 2,
"name": "Strom Klovrah",
"avatar": "",
"bio": "",
"exportedBy": "www.sw5e.com",
"gmnotes": "",
"defaulttoken": "",
"tags": "[]",
"controlledby": "",
"inplayerjournals": "",
"attribs": [
{
"name": "version",
"current": "2.4",
"max": "",
"id": ""
},
{
"name": "options-class-selection",
"current": "0",
"max": "",
"id": ""
},
{
"name": "class",
"current": "Scout",
"max": "",
"id": ""
},
{
"name": "subclass",
"current": "",
"max": "",
"id": ""
},
{
"name": "class_display",
"current": " Scout 1",
"max": "",
"id": ""
},
{
"name": "base_level",
"current": "1",
"max": "",
"id": ""
},
{
"name": "level",
"current": 1,
"max": "",
"id": ""
},
{
"name": "pb",
"current": "2",
"max": "",
"id": ""
},
{
"name": "ac",
"current": "14",
"max": "",
"id": ""
},
{
"name": "initiative_bonus",
"current": 5,
"max": "",
"id": ""
},
{
"name": "speed",
"current": "30 ft",
"max": "",
"id": ""
},
{
"name": "race",
"current": "Human",
"max": "",
"id": ""
},
{
"name": "race_display",
"current": "Human",
"max": "",
"id": ""
},
{
"name": "experience",
"current": "0",
"max": "",
"id": ""
},
{
"name": "background",
"current": "Bounty Hunter",
"max": "",
"id": ""
},
{
"name": "alignment",
"current": "Chaotic Balanced",
"max": "",
"id": ""
},
{
"name": "strength",
"current": 8,
"max": "",
"id": ""
},
{
"name": "strength_base",
"current": "8",
"max": "",
"id": ""
},
{
"name": "strength_mod",
"current": "-1",
"max": "",
"id": ""
},
{
"name": "strength_save_bonus",
"current": 1,
"max": "",
"id": ""
},
{
"name": "strength_save_prof",
"current": "(@{pb})",
"max": "",
"id": ""
},
{
"name": "athletics_bonus",
"current": -1,
"max": "",
"id": ""
},
{
"name": "athletics_prof",
"current": 0,
"max": "",
"id": ""
},
{
"name": "athletics_type",
"current": 0,
"max": "",
"id": ""
},
{
"name": "dexterity",
"current": 17,
"max": "",
"id": ""
},
{
"name": "dexterity_base",
"current": "17",
"max": "",
"id": ""
},
{
"name": "dexterity_mod",
"current": "3",
"max": "",
"id": ""
},
{
"name": "dexterity_save_bonus",
"current": 5,
"max": "",
"id": ""
},
{
"name": "dexterity_save_prof",
"current": "(@{pb})",
"max": "",
"id": ""
},
{
"name": "acrobatics_bonus",
"current": 3,
"max": "",
"id": ""
},
{
"name": "acrobatics_prof",
"current": 0,
"max": "",
"id": ""
},
{
"name": "acrobatics_type",
"current": 0,
"max": "",
"id": ""
},
{
"name": "sleight_of_hand_bonus",
"current": 3,
"max": "",
"id": ""
},
{
"name": "sleight_of_hand_prof",
"current": 0,
"max": "",
"id": ""
},
{
"name": "sleight_of_hand_type",
"current": 0,
"max": "",
"id": ""
},
{
"name": "stealth_bonus",
"current": 3,
"max": "",
"id": ""
},
{
"name": "stealth_prof",
"current": 0,
"max": "",
"id": ""
},
{
"name": "stealth_type",
"current": 0,
"max": "",
"id": ""
},
{
"name": "constitution",
"current": 12,
"max": "",
"id": ""
},
{
"name": "constitution_base",
"current": "12",
"max": "",
"id": ""
},
{
"name": "constitution_mod",
"current": "1",
"max": "",
"id": ""
},
{
"name": "constitution_save_bonus",
"current": 1,
"max": "",
"id": ""
},
{
"name": "constitution_save_prof",
"current": 0,
"max": "",
"id": ""
},
{
"name": "intelligence",
"current": 13,
"max": "",
"id": ""
},
{
"name": "intelligence_base",
"current": "13",
"max": "",
"id": ""
},
{
"name": "intelligence_mod",
"current": "1",
"max": "",
"id": ""
},
{
"name": "intelligence_save_bonus",
"current": 1,
"max": "",
"id": ""
},
{
"name": "intelligence_save_prof",
"current": 0,
"max": "",
"id": ""
},
{
"name": "investigation_bonus",
"current": 1,
"max": "",
"id": ""
},
{
"name": "investigation_prof",
"current": 0,
"max": "",
"id": ""
},
{
"name": "investigation_type",
"current": 0,
"max": "",
"id": ""
},
{
"name": "lore_bonus",
"current": 1,
"max": "",
"id": ""
},
{
"name": "lore_prof",
"current": 0,
"max": "",
"id": ""
},
{
"name": "lore_type",
"current": 0,
"max": "",
"id": ""
},
{
"name": "nature_bonus",
"current": 1,
"max": "",
"id": ""
},
{
"name": "nature_prof",
"current": 0,
"max": "",
"id": ""
},
{
"name": "nature_type",
"current": 0,
"max": "",
"id": ""
},
{
"name": "piloting_bonus",
"current": 3,
"max": "",
"id": ""
},
{
"name": "piloting_prof",
"current": "(@{pb}*@{piloting_type})",
"max": "",
"id": ""
},
{
"name": "piloting_type",
"current": 1,
"max": "",
"id": ""
},
{
"name": "technology_bonus",
"current": 1,
"max": "",
"id": ""
},
{
"name": "technology_prof",
"current": 0,
"max": "",
"id": ""
},
{
"name": "technology_type",
"current": 0,
"max": "",
"id": ""
},
{
"name": "wisdom",
"current": 10,
"max": "",
"id": ""
},
{
"name": "wisdom_base",
"current": "10",
"max": "",
"id": ""
},
{
"name": "wisdom_mod",
"current": "0",
"max": "",
"id": ""
},
{
"name": "wisdom_save_bonus",
"current": 0,
"max": "",
"id": ""
},
{
"name": "wisdom_save_prof",
"current": 0,
"max": "",
"id": ""
},
{
"name": "animal_handling_bonus",
"current": 0,
"max": "",
"id": ""
},
{
"name": "animal_handling_prof",
"current": 0,
"max": "",
"id": ""
},
{
"name": "animal_handling_type",
"current": 0,
"max": "",
"id": ""
},
{
"name": "insight_bonus",
"current": 2,
"max": "",
"id": ""
},
{
"name": "insight_prof",
"current": "(@{pb}*@{insight_type})",
"max": "",
"id": ""
},
{
"name": "insight_type",
"current": 1,
"max": "",
"id": ""
},
{
"name": "medicine_bonus",
"current": 0,
"max": "",
"id": ""
},
{
"name": "medicine_prof",
"current": 0,
"max": "",
"id": ""
},
{
"name": "medicine_type",
"current": 0,
"max": "",
"id": ""
},
{
"name": "perception_bonus",
"current": 2,
"max": "",
"id": ""
},
{
"name": "perception_prof",
"current": "(@{pb}*@{perception_type})",
"max": "",
"id": ""
},
{
"name": "perception_type",
"current": 1,
"max": "",
"id": ""
},
{
"name": "survival_bonus",
"current": 2,
"max": "",
"id": ""
},
{
"name": "survival_prof",
"current": "(@{pb}*@{survival_type})",
"max": "",
"id": ""
},
{
"name": "survival_type",
"current": 1,
"max": "",
"id": ""
},
{
"name": "charisma",
"current": 15,
"max": "",
"id": ""
},
{
"name": "charisma_base",
"current": "15",
"max": "",
"id": ""
},
{
"name": "charisma_mod",
"current": "2",
"max": "",
"id": ""
},
{
"name": "charisma_save_bonus",
"current": 2,
"max": "",
"id": ""
},
{
"name": "charisma_save_prof",
"current": 0,
"max": "",
"id": ""
},
{
"name": "deception_bonus",
"current": 4,
"max": "",
"id": ""
},
{
"name": "deception_prof",
"current": "(@{pb}*@{deception_type})",
"max": "",
"id": ""
},
{
"name": "deception_type",
"current": 1,
"max": "",
"id": ""
},
{
"name": "intimidation_bonus",
"current": 2,
"max": "",
"id": ""
},
{
"name": "intimidation_prof",
"current": 0,
"max": "",
"id": ""
},
{
"name": "intimidation_type",
"current": 0,
"max": "",
"id": ""
},
{
"name": "performance_bonus",
"current": 2,
"max": "",
"id": ""
},
{
"name": "performance_prof",
"current": 0,
"max": "",
"id": ""
},
{
"name": "performance_type",
"current": 0,
"max": "",
"id": ""
},
{
"name": "persuasion_bonus",
"current": 4,
"max": "",
"id": ""
},
{
"name": "persuasion_prof",
"current": "(@{pb}*@{persuasion_type})",
"max": "",
"id": ""
},
{
"name": "persuasion_type",
"current": 1,
"max": "",
"id": ""
},
{
"name": "repeating_inventory_-MEkR140UwOo7BXjwlFz_itemname",
"current": "Combat suit",
"max": "",
"id": ""
},
{
"name": "repeating_inventory_-MEkR140UwOo7BXjwlFz_itemweight",
"current": "10",
"max": "",
"id": ""
},
{
"name": "repeating_inventory_-MEkR140UwOo7BXjwlFz_itemcount",
"current": 1,
"max": "",
"id": ""
},
{
"name": "repeating_inventory_-MVQsJcHl42pz2sIXjLo_itemname",
"current": "Blaster carbine",
"max": "",
"id": ""
},
{
"name": "repeating_inventory_-MVQsJcHl42pz2sIXjLo_itemweight",
"current": "8",
"max": "",
"id": ""
},
{
"name": "repeating_inventory_-MVQsJcHl42pz2sIXjLo_itemcount",
"current": 1,
"max": "",
"id": ""
},
{
"name": "repeating_inventory_-MUyLvOqSdNxKASoorPL_itemname",
"current": "Power cell",
"max": "",
"id": ""
},
{
"name": "repeating_inventory_-MUyLvOqSdNxKASoorPL_itemweight",
"current": "1",
"max": "",
"id": ""
},
{
"name": "repeating_inventory_-MUyLvOqSdNxKASoorPL_itemcount",
"current": "2",
"max": "",
"id": ""
},
{
"name": "repeating_inventory_-MLC4qxNsSNvmVxovp3C_itemname",
"current": "Vibrodagger",
"max": "",
"id": ""
},
{
"name": "repeating_inventory_-MLC4qxNsSNvmVxovp3C_itemweight",
"current": "1",
"max": "",
"id": ""
},
{
"name": "repeating_inventory_-MLC4qxNsSNvmVxovp3C_itemcount",
"current": "2",
"max": "",
"id": ""
},
{
"name": "repeating_inventory_-M6LM3egOFubuujZAF8M_itemname",
"current": "Wristpad",
"max": "",
"id": ""
},
{
"name": "repeating_inventory_-M6LM3egOFubuujZAF8M_itemweight",
"current": "2",
"max": "",
"id": ""
},
{
"name": "repeating_inventory_-M6LM3egOFubuujZAF8M_itemcount",
"current": 1,
"max": "",
"id": ""
},
{
"name": "repeating_proficiencies_-MytIGi95NkweuEul5s6_name",
"current": "Galactic Basic",
"max": "",
"id": ""
},
{
"name": "repeating_proficiencies_-MytIGi95NkweuEul5s6_options-flag",
"current": "0",
"max": "",
"id": ""
},
{
"name": "repeating_attack_-MX9of9acar4y6MviNAo_atkname",
"current": "Blaster carbine",
"max": "",
"id": ""
},
{
"name": "repeating_attack_-MX9of9acar4y6MviNAo_options-flag",
"current": "0",
"max": "",
"id": ""
},
{
"name": "repeating_attack_-MX9of9acar4y6MviNAo_atkbonus",
"current": 5,
"max": "",
"id": ""
},
{
"name": "repeating_attack_-MX9of9acar4y6MviNAo_atkattr_base",
"current": "@{dexterity_mod}",
"max": "",
"id": ""
},
{
"name": "repeating_attack_-MX9of9acar4y6MviNAo_dmgtype",
"current": "Energy",
"max": "",
"id": ""
},
{
"name": "repeating_attack_-MX9of9acar4y6MviNAo_dmgbase",
"current": "1d6",
"max": "",
"id": ""
},
{
"name": "repeating_attack_-MX9of9acar4y6MviNAo_dmgattr",
"current": "@{dexterity_mod}",
"max": "",
"id": ""
},
{
"name": "repeating_attack_-MX9of9acar4y6MviNAo_atkrange",
"current": "60/240",
"max": "",
"id": ""
},
{
"name": "repeating_attack_-MX9of9acar4y6MviNAo_atk_desc",
"current": "Ammunition (range 60/240), reload 16, two-handed",
"max": "",
"id": ""
},
{
"name": "repeating_attack_-MX9of9acar4y6MviNAo_saveeffect",
"current": " ",
"max": "",
"id": ""
},
{
"name": "repeating_attack_-MX9of9acar4y6MviNAo_atkdmgtype",
"current": "1d6+3 Energy",
"max": "",
"id": ""
},
{
"name": "repeating_attack_-MX9of9acar4y6MviNAo_rollbase_dmg",
"current": "@{wtype}&{template:dmg} {{rname=@{atkname}}} @{atkflag} {{range=@{atkrange}}} @{dmgflag} {{dmg1=[[1d6 + 3[DEX]]]}} {{dmg1type=Energy}}@{dmg2flag} {{dmg2=[[0]]}} {{dmg2type=}} @{saveflag} {{desc=@{atk_desc}}} @{hldmg} {{powerlevel=@{powerlevel}}} {{innate=@{power_innate}}} {{globaldamage=[[0]]}} {{globaldamagetype=@{global_damage_mod_type}}} @{charname_output}",
"max": "",
"id": ""
},
{
"name": "repeating_attack_-MX9of9acar4y6MviNAo_rollbase_crit",
"current": "@{wtype}&{template:dmg} {{crit=1}} {{rname=@{atkname}}} @{atkflag} {{range=@{atkrange}}} @{dmgflag}{{dmg1=[[1d6 + 3[DEX]]]}} {{dmg1type=Energy}}@{dmg2flag} {{dmg2=[[0]]}} {{dmg2type=}} {{crit1=[[1d6]]}} {{crit2=[[0]]}} @{saveflag} {{desc=@{atk_desc}}} @{hldmg} {{powerlevel=@{powerlevel}}} {{innate=@{power_innate}}}{{globaldamage=[[0]]}} {{globaldamagecrit=[[0]]}}{{globaldamagetype=@{global_damage_mod_type}}} @{charname_output}",
"max": "",
"id": ""
},
{
"name": "repeating_attack_-MX9of9acar4y6MviNAo_rollbase",
"current": "@{wtype}&{template:atk} {{mod=@{atkbonus}}} {{rname=[@{atkname}](~repeating_attack_attack_dmg)}} {{rnamec=[@{atkname}](~repeating_attack_attack_crit)}} {{r1=[[@{d20}cs>@{atkcritrange} + 3[DEX] + 2[PROF]]]}} @{rtype}cs>@{atkcritrange} + 3[DEX] + 2[PROF]]]}} {{range=@{atkrange}}} {{desc=@{atk_desc}}} {{powerlevel=@{powerlevel}}} {{innate=@{power_innate}}} {{globalattack=@{global_attack_mod}}} ammo=@{ammo} @{charname_output}",
"max": "",
"id": ""
},
{
"name": "repeating_attack_-MHF2l1EQUji5hpSVKJM_atkname",
"current": "Unarmed Strike",
"max": "",
"id": ""
},
{
"name": "repeating_attack_-MHF2l1EQUji5hpSVKJM_options-flag",
"current": "0",
"max": "",
"id": ""
},
{
"name": "repeating_attack_-MHF2l1EQUji5hpSVKJM_atkbonus",
"current": 1,
"max": "",
"id": ""
},
{
"name": "repeating_attack_-MHF2l1EQUji5hpSVKJM_atkattr_base",
"current": "@{strength_mod}",
"max": "",
"id": ""
},
{
"name": "repeating_attack_-MHF2l1EQUji5hpSVKJM_dmgtype",
"current": "Kinetic",
"max": "",
"id": ""
},
{
"name": "repeating_attack_-MHF2l1EQUji5hpSVKJM_dmgbase",
"current": "1",
"max": "",
"id": ""
},
{
"name": "repeating_attack_-MHF2l1EQUji5hpSVKJM_dmgattr",
"current": "@{strength_mod}",
"max": "",
"id": ""
},
{
"name": "repeating_attack_-MHF2l1EQUji5hpSVKJM_atkrange",
"current": "",
"max": "",
"id": ""
},
{
"name": "repeating_attack_-MHF2l1EQUji5hpSVKJM_atk_desc",
"current": "",
"max": "",
"id": ""
},
{
"name": "repeating_attack_-MHF2l1EQUji5hpSVKJM_saveeffect",
"current": " ",
"max": "",
"id": ""
},
{
"name": "repeating_attack_-MHF2l1EQUji5hpSVKJM_atkdmgtype",
"current": "1+-1 Kinetic",
"max": "",
"id": ""
},
{
"name": "repeating_attack_-MHF2l1EQUji5hpSVKJM_rollbase_dmg",
"current": "@{wtype}&{template:dmg} {{rname=@{atkname}}} @{atkflag} {{range=@{atkrange}}} @{dmgflag} {{dmg1=[[1 + -1[STR]]]}} {{dmg1type=Kinetic}}@{dmg2flag} {{dmg2=[[0]]}} {{dmg2type=}} @{saveflag} {{desc=@{atk_desc}}} @{hldmg} {{powerlevel=@{powerlevel}}} {{innate=@{power_innate}}} {{globaldamage=[[0]]}} {{globaldamagetype=@{global_damage_mod_type}}} @{charname_output}",
"max": "",
"id": ""
},
{
"name": "repeating_attack_-MHF2l1EQUji5hpSVKJM_rollbase_crit",
"current": "@{wtype}&{template:dmg} {{crit=1}} {{rname=@{atkname}}} @{atkflag} {{range=@{atkrange}}} @{dmgflag}{{dmg1=[[1 + -1[STR]]]}} {{dmg1type=Kinetic}}@{dmg2flag} {{dmg2=[[0]]}} {{dmg2type=}} {{crit1=[[1]]}} {{crit2=[[0]]}} @{saveflag} {{desc=@{atk_desc}}} @{hldmg} {{powerlevel=@{powerlevel}}} {{innate=@{power_innate}}}{{globaldamage=[[0]]}} {{globaldamagecrit=[[0]]}}{{globaldamagetype=@{global_damage_mod_type}}} @{charname_output}",
"max": "",
"id": ""
},
{
"name": "repeating_attack_-MHF2l1EQUji5hpSVKJM_rollbase",
"current": "@{wtype}&{template:atk} {{mod=@{atkbonus}}} {{rname=[@{atkname}](~repeating_attack_attack_dmg)}} {{rnamec=[@{atkname}](~repeating_attack_attack_crit)}} {{r1=[[@{d20}cs>@{atkcritrange} + -1[STR] + 2[PROF]]]}} @{rtype}cs>@{atkcritrange} + -1[STR] + 2[PROF]]]}} {{range=@{atkrange}}} {{desc=@{atk_desc}}} {{powerlevel=@{powerlevel}}} {{innate=@{power_innate}}} {{globalattack=@{global_attack_mod}}} ammo=@{ammo} @{charname_output}",
"max": "",
"id": ""
},
{
"name": "repeating_traits_-MQfR2f2xSY23IZRyQK5_name",
"current": "Alert",
"max": "",
"id": ""
},
{
"name": "repeating_traits_-MQfR2f2xSY23IZRyQK5_source",
"current": "Feat",
"max": "",
"id": ""
},
{
"name": "repeating_traits_-MQfR2f2xSY23IZRyQK5_description",
"current": "Always on the lookout for danger, you gain the following benefits:\r\n- You gain a +5 bonus to initiative.\r\n- You can't be surprised while you are conscious.\r\n- Other creatures don't gain advantage on attack rolls against you as a result of being unseen by you.\r\n",
"max": "",
"id": ""
},
{
"name": "repeating_traits_-MQfR2f2xSY23IZRyQK5_options-flag",
"current": "0",
"max": "",
"id": ""
},
{
"name": "repeating_traits_-MQfR2f2xSY23IZRyQK5_display_flag",
"current": "on",
"max": "",
"id": ""
},
{
"name": "repeating_traits_-MPTQTTZvDvrBlhQnPJe_name",
"current": "Ear to the Ground",
"max": "",
"id": ""
},
{
"name": "repeating_traits_-MPTQTTZvDvrBlhQnPJe_source",
"current": "Background",
"max": "",
"id": ""
},
{
"name": "repeating_traits_-MPTQTTZvDvrBlhQnPJe_description",
"current": "You are in frequent contact with people in the segment of society that your chosen quarries move through. These people might be associated with the criminal underworld, the rough-and-tumble folk of the streets, or members of high society. This connection comes in the form of a contact in any city you visit, a person who provides information about the people and places of the local area.\r\n",
"max": "",
"id": ""
},
{
"name": "repeating_traits_-MPTQTTZvDvrBlhQnPJe_options-flag",
"current": "0",
"max": "",
"id": ""
},
{
"name": "repeating_traits_-MPTQTTZvDvrBlhQnPJe_display_flag",
"current": "on",
"max": "",
"id": ""
},
{
"name": "repeating_proficiencies_-M0aCcUzqtnoDcL6RPmJ_name",
"current": "All blasters",
"max": "",
"id": ""
},
{
"name": "repeating_proficiencies_-M0aCcUzqtnoDcL6RPmJ_prof_type",
"current": "WEAPON",
"max": "",
"id": ""
},
{
"name": "repeating_proficiencies_-M0aCcUzqtnoDcL6RPmJ_options-flag",
"current": "0",
"max": "",
"id": ""
},
{
"name": "repeating_proficiencies_-MXlQuqIfRj8PGm9B9UU_name",
"current": "all vibroweapons",
"max": "",
"id": ""
},
{
"name": "repeating_proficiencies_-MXlQuqIfRj8PGm9B9UU_prof_type",
"current": "WEAPON",
"max": "",
"id": ""
},
{
"name": "repeating_proficiencies_-MXlQuqIfRj8PGm9B9UU_options-flag",
"current": "0",
"max": "",
"id": ""
},
{
"name": "repeating_proficiencies_-M2rOLcH9Kxv9uq98LgM_name",
"current": "Light armor",
"max": "",
"id": ""
},
{
"name": "repeating_proficiencies_-M2rOLcH9Kxv9uq98LgM_prof_type",
"current": "ARMOR",
"max": "",
"id": ""
},
{
"name": "repeating_proficiencies_-M2rOLcH9Kxv9uq98LgM_options-flag",
"current": "0",
"max": "",
"id": ""
},
{
"name": "repeating_proficiencies_-Mo4nSurubVWlZdxdJdY_name",
"current": "medium armor",
"max": "",
"id": ""
},
{
"name": "repeating_proficiencies_-Mo4nSurubVWlZdxdJdY_prof_type",
"current": "ARMOR",
"max": "",
"id": ""
},
{
"name": "repeating_proficiencies_-Mo4nSurubVWlZdxdJdY_options-flag",
"current": "0",
"max": "",
"id": ""
},
{
"name": "repeating_tool_-MQ8P2mE6cDekBWPN41u_toolname",
"current": "Your choice of demolitions kit, security kit, or slicer's kit",
"max": "",
"id": ""
},
{
"name": "repeating_tool_-MQ8P2mE6cDekBWPN41u_toolattr",
"current": "QUERY",
"max": "",
"id": ""
},
{
"name": "repeating_tool_-MQ8P2mE6cDekBWPN41u_toolbonus",
"current": "?{Attribute?|Strength,@{strength_mod}|Dexterity,@{dexterity_mod}|Constitution,@{constitution_mod}|Intelligence,@{intelligence_mod}|Wisdom,@{wisdom_mod}|Charisma,@{charisma_mod}}+0+2",
"max": "",
"id": ""
},
{
"name": "repeating_tool_-MQ8P2mE6cDekBWPN41u_toolbonus_display",
"current": "?",
"max": "",
"id": ""
},
{
"name": "repeating_tool_-MQ8P2mE6cDekBWPN41u_toolattr_base",
"current": "?{Attribute?|Strength,@{strength_mod}|Dexterity,@{dexterity_mod}|Constitution,@{constitution_mod}|Intelligence,@{intelligence_mod}|Wisdom,@{wisdom_mod}|Charisma,@{charisma_mod}}",
"max": "",
"id": ""
},
{
"name": "repeating_tool_-MQ8P2mE6cDekBWPN41u_toolbonus_base",
"current": "(@{pb})",
"max": "",
"id": ""
},
{
"name": "repeating_tool_-MQ8P2mE6cDekBWPN41u_tool_mod",
"current": "0",
"max": "",
"id": ""
},
{
"name": "repeating_tool_-MQ8P2mE6cDekBWPN41u_options-flag",
"current": "0",
"max": "",
"id": ""
},
{
"name": "hitdietype",
"current": 10,
"max": "",
"id": ""
},
{
"name": "hitdie_final",
"current": "@{hitdietype}",
"max": "",
"id": ""
},
{
"name": "personality_traits",
"current": "",
"max": "",
"id": ""
},
{
"name": "ideals",
"current": "",
"max": "",
"id": ""
},
{
"name": "bonds",
"current": "",
"max": "",
"id": ""
},
{
"name": "flaws",
"current": "",
"max": "",
"id": ""
},
{
"name": "hair",
"current": "",
"max": "",
"id": ""
},
{
"name": "options-flag-personality",
"current": "0",
"max": "",
"id": ""
},
{
"name": "options-flag-ideals",
"current": "0",
"max": "",
"id": ""
},
{
"name": "options-flag-bonds",
"current": "0",
"max": "",
"id": ""
},
{
"name": "options-flag-flaws",
"current": "0",
"max": "",
"id": ""
},
{
"name": "height",
"current": "",
"max": "",
"id": ""
},
{
"name": "eyes",
"current": "",
"max": "",
"id": ""
},
{
"name": "skin",
"current": "",
"max": "",
"id": ""
},
{
"name": "age",
"current": "",
"max": "",
"id": ""
},
{
"name": "character_appearance",
"current": "",
"max": "",
"id": ""
},
{
"name": "character_backstory",
"current": "",
"max": "",
"id": ""
},
{
"name": "hp_temp",
"current": "0",
"max": "",
"id": ""
},
{
"name": "passive_wisdom",
"current": "12",
"max": "",
"id": ""
},
{
"name": "cr",
"current": 1700,
"max": "",
"id": ""
},
{
"name": "force_power_points_total",
"current": 0,
"max": "",
"id": ""
},
{
"name": "force_power_points_expended",
"current": 0,
"max": "",
"id": ""
},
{
"name": "tech_power_points_total",
"current": 2,
"max": "",
"id": ""
},
{
"name": "tech_power_points_expended",
"current": 2,
"max": "",
"id": ""
},
{
"name": "hp",
"current": "11",
"max": "11",
"id": ""
},
{
"name": "hit_dice",
"current": 1,
"max": "1d10",
"id": ""
}
],
"abilities": []
};
}
// transform JSON from sw5e.com to Foundry friendly format
// and insert new actor
transform(){
const name = sourceCharacter.name;
const species = sourceCharacter.attribs.find(o => o.name == "race").current;
const hp = sourceCharacter.attribs.find(o => o.name == "hp").current;
const hpTemp = sourceCharacter.attribs.find(o => o.name == "hp_temp").current;
const ac = sourceCharacter.attribs.find(o => o.name == "ac").current;
const strength = sourceCharacter.attribs.find(o => o.name == "strength").current;
const dexterity = sourceCharacter.attribs.find(o => o.name == "dexterity").current;
const constitution = sourceCharacter.attribs.find(o => o.name == "constitution").current;
const intelligence = sourceCharacter.attribs.find(o => o.name == "intelligence").current;
const wisdom = sourceCharacter.attribs.find(o => o.name == "wisdom").current;
const charisma = sourceCharacter.attribs.find(o => o.name == "charisma").current;
const targetCharacter = {
name: sourceCharacter.name,
type: "character",
data: {
abilities: {
str: {
value: strength
},
dex: {
value: dexterity
},
con: {
value: constitution
},
int: {
value: intelligence
},
wis: {
value: wisdom
},
cha: {
value: charisma
},
},
attributes: {
ac: {
value: ac
},
hp: {
value: hp,
min: 0,
max: hp,
temp: hpTemp
}
}
}
};
Actor.create(targetCharacter);
}
2020-11-15 15:15:25 -05:00
/** */
static addImportButton(html){
2020-11-14 00:56:23 -05:00
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();
2020-11-15 15:15:25 -05:00
newImportButtonDiv.append("<button class='create-entity' id='cs-import-button'><i class='fas fa-upload'></i> Import Character</button>");
2020-11-14 00:56:23 -05:00
newSearch.appendTo(header);
2020-11-15 15:15:25 -05:00
let characterImportButton = $("#cs-import-button");
characterImportButton.click(e => {
let file;
let content = '<h1>Saved Character JSONImport</h1> '
+ '<input class="file-picker" type="file" id="sw5e-character-json" accept=".json" multiple name="sw5e-character-json">'
+ '<hr>'
+ '<div class="sw5e-file-import"></div>';
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"
}
});
2020-11-14 00:56:23 -05:00
}
}
/*
var c = new CharacterImporter().import('filename').transform();
*/