From 3d7a13941def9060b6eeb4015465b4fdf59cf67d Mon Sep 17 00:00:00 2001 From: ellimist25 Date: Fri, 13 Nov 2020 23:34:28 -0500 Subject: [PATCH] Updated characterImport with main logic --- module/characterImport.js | 1291 ++++++++++++++++++++++++++++++++++++- sw5e.js | 2 - 2 files changed, 1290 insertions(+), 3 deletions(-) diff --git a/module/characterImport.js b/module/characterImport.js index 1bb5be3c..0851de7d 100644 --- a/module/characterImport.js +++ b/module/characterImport.js @@ -1 +1,1290 @@ -export default class characterImporter{} \ No newline at end of file +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); + } + + +} + + +/* +var c = new CharacterImporter().import('filename').transform(); +*/ \ No newline at end of file diff --git a/sw5e.js b/sw5e.js index 594e174c..0a04143a 100644 --- a/sw5e.js +++ b/sw5e.js @@ -40,8 +40,6 @@ 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