[Shadowrun5thA] first step for herolab import
This commit is contained in:
@@ -606,6 +606,7 @@ div.spiritstable .technomancycheckbox:not(:checked) ~ div.technobound
|
|||||||
display:block;
|
display:block;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.statinputwrapper .statinput,
|
||||||
.statinput{
|
.statinput{
|
||||||
width:2em;
|
width:2em;
|
||||||
background-color:#444444;
|
background-color:#444444;
|
||||||
|
|||||||
+1409
-894
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,70 +0,0 @@
|
|||||||
function importSingleArmor(armor, attributes) {
|
|
||||||
|
|
||||||
if(armor.armor.includes("/")) {
|
|
||||||
var armorValueArray = armor.armor.toString().split("/");
|
|
||||||
|
|
||||||
var splitArmor = armor;
|
|
||||||
splitArmor.armor = armorValueArray[0];
|
|
||||||
importSingleArmor(splitArmor, attributes);
|
|
||||||
|
|
||||||
armor.armor = armorValueArray[1];
|
|
||||||
}
|
|
||||||
|
|
||||||
var newrowid = generateRowID()
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armorname"] = armor.name;
|
|
||||||
if(armor.equipped == "True") {
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armorworn"] = "on";
|
|
||||||
}
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armorrating"] = armor.armor;
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armornotes"] = "";
|
|
||||||
if(armor.armormods!=null){
|
|
||||||
if(armor.armormods.armormod.length > 1){
|
|
||||||
for(var j=0; j < armor.armormods.armormod.length; j++){
|
|
||||||
if(Number(armor.armormods.armormod[j].rating) > 0){
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armornotes"] += armor.armormods.armormod[j].name + " " + armor.armormods.armormod[j].rating + "\n";
|
|
||||||
}else{
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armornotes"] += armor.armormods.armormod[j].name + "\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
if(Number(armor.armormods.armormod.rating)>0){
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armornotes"] += armor.armormods.armormod.name + " " + armor.armormods.armormod.rating + "\n";
|
|
||||||
}else{
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armornotes"] += armor.armormods.armormod.name + "\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(armor.gears!=null){
|
|
||||||
if(armor.gears.gear.length > 1){
|
|
||||||
for(var j=0; j < armor.gears.gear.length; j++){
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armornotes"] += armor.gears.gear[j].name + "\n";
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armornotes"] += armor.gears.gear.name + "\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function importCyberwareArmor(nightly, cyberware, attributes) {
|
|
||||||
if(nightly != "on") {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var cyberwareEnhancements = [];
|
|
||||||
if(cyberware.children != null && cyberware.children.cyberware.length > 1) {
|
|
||||||
cyberwareEnhancements = cyberware.children.cyberware;
|
|
||||||
}
|
|
||||||
|
|
||||||
cyberwareEnhancements.forEach(enhancement => importSingleCyberwareArmor(cyberware.name, enhancement, attributes));
|
|
||||||
}
|
|
||||||
|
|
||||||
function importSingleCyberwareArmor(parentname, cyberware, attributes) {
|
|
||||||
|
|
||||||
if(cyberware.name_english === "Armor") {
|
|
||||||
var newrowid = generateRowID()
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armorname"] = parentname;
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armorworn"] = "on";
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armorrating"] = cyberware.rating;
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armornotes"] = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,411 @@
|
|||||||
|
async function importHeroLabChar(attributes, herolabfile, text) {
|
||||||
|
|
||||||
|
const character = herolabfile.public.character;
|
||||||
|
|
||||||
|
var maintab = importMainTabHeroLab(character);
|
||||||
|
var skilltab = importSkillsTabHeroLab(text.experimental, character);
|
||||||
|
<!-- var magictab = importMagicTabHeroLab(text.experimental, character);-->
|
||||||
|
var enhancementtab = importEnhancementTabHeroLab(text, character);
|
||||||
|
<!-- var matrixtab = importMatrixTabHeroLab(text.experimental, character);-->
|
||||||
|
<!-- var vehiclestab = importVehiclesTabHeroLab(text.experimental, character);-->
|
||||||
|
<!-- var equipmentstab = importEquipmentTabHeroLab(text.experimental, character);-->
|
||||||
|
<!-- var socialtab = importSocialTabHeroLab(character);-->
|
||||||
|
|
||||||
|
let results = await Promise.all([maintab, skilltab, enhancementtab]);
|
||||||
|
let dependingResults = await Promise.all([]);
|
||||||
|
<!-- let results = await Promise.all([maintab, skilltab, enhancementtab, socialtab]);-->
|
||||||
|
<!-- let dependingResults = await Promise.all([magictab, matrixtab, vehiclestab, equipmentstab]);-->
|
||||||
|
|
||||||
|
attributes.warningcheckbox="0";
|
||||||
|
attributes.chummercheckbox="0";
|
||||||
|
attributes.chummertext= results.join("") + dependingResults.join("") + "\nREMEMBER THIS IS ONLY A HELP AND YOU NEED TO DOUBLE CHECK EVERYTHING."
|
||||||
|
|
||||||
|
return attributes;
|
||||||
|
}
|
||||||
|
|
||||||
|
async function importMainTabHeroLab(character) {
|
||||||
|
|
||||||
|
var goodcode = true;
|
||||||
|
var error = "";
|
||||||
|
var attributes = {};
|
||||||
|
|
||||||
|
try{
|
||||||
|
console.log("Character meta info");
|
||||||
|
attributes.character_name = character.name;
|
||||||
|
attributes.metatype = character.race.name;
|
||||||
|
attributes.sex = character.personal.gender;
|
||||||
|
attributes.age = character.personal.age;
|
||||||
|
attributes.height = character.personal.charheight.text;
|
||||||
|
attributes.weight = character.personal.charweight.text;
|
||||||
|
|
||||||
|
attributes.player = character.playername;
|
||||||
|
|
||||||
|
attributes.description = character.personal.description;
|
||||||
|
attributes.background = character.personal.description;
|
||||||
|
attributes.karma = character.karma.left;
|
||||||
|
attributes.karmacareer = character.karma.total;
|
||||||
|
|
||||||
|
attributes.initiativebonus = character.attributes[11].modified - character.attributes[11].base;
|
||||||
|
attributes.astralinitiativebonus = character.attributes[11].modified - character.attributes[11].base;
|
||||||
|
attributes.matrixinitiativebonus = character.attributes[11].modified - character.attributes[11].base;
|
||||||
|
attributes.initiativedice = character.attributes[11].text.split('+')[1].charAt(0);
|
||||||
|
<!-- attributes.astralinitiativedice=character.astralinitdice;-->
|
||||||
|
|
||||||
|
<!-- if(character.cmthresholdoffset != null)-->
|
||||||
|
<!-- attributes.woundadditive=character.cmthresholdoffset;-->
|
||||||
|
<!-- if(character.cmthreshold != null)-->
|
||||||
|
<!-- attributes.woundmultiplikative=character.cmthreshold;-->
|
||||||
|
<!-- if(character.cmoverflow != null)-->
|
||||||
|
<!-- attributes.overflowmod=character.cmoverflow-character.attributes[1].attribute[0].total- 1;-->
|
||||||
|
<!-- if(character.physicalcm != null)-->
|
||||||
|
<!-- attributes.physicaltrackmod=character.physicalcm-Math.ceil(character.attributes[1].attribute[0].total/2)- 8;-->
|
||||||
|
<!-- if(character.stuncm != null)-->
|
||||||
|
<!-- attributes.stuntrackmod=character.stuncm-Math.ceil(character.attributes[1].attribute[7].total/2)- 8;-->
|
||||||
|
|
||||||
|
attributes.streetcred = character.reputations[0].value;
|
||||||
|
attributes.notoriety = character.reputations[2].value;
|
||||||
|
attributes.pawareness = character.reputations[4].value;
|
||||||
|
attributes.nuyen_total = character.cash.total;
|
||||||
|
|
||||||
|
<!-- if(character.magician == "True"){-->
|
||||||
|
<!-- // HeroLab 'chummer' export uses drainattribute property and a list, this is a workaround for that-->
|
||||||
|
<!-- try{-->
|
||||||
|
<!-- attributes.drainattribute="@{"+character.tradition.drainattributes.match(/[A-Z]+/g)[1].toLowerCase()+"_total}";-->
|
||||||
|
<!-- } catch(err)-->
|
||||||
|
<!-- {-->
|
||||||
|
<!-- attributes.drainattribute="@{"+character.tradition.drainattribute.attr[1]+"_total}";-->
|
||||||
|
<!-- }-->
|
||||||
|
<!-- }-->
|
||||||
|
}catch(err){
|
||||||
|
goodcode = false;
|
||||||
|
error = "Error with Character Info " + err;
|
||||||
|
}
|
||||||
|
|
||||||
|
try{
|
||||||
|
console.log("Importing Attributes");
|
||||||
|
var attributesCharacter = character.attributes;
|
||||||
|
attributes.bod_base = attributesCharacter[0].base;
|
||||||
|
attributes.agi_base = attributesCharacter[1].base;
|
||||||
|
attributes.rea_base = attributesCharacter[2].base;
|
||||||
|
attributes.str_base = attributesCharacter[3].base;
|
||||||
|
attributes.wil_base = attributesCharacter[4].base;
|
||||||
|
attributes.log_base = attributesCharacter[5].base;
|
||||||
|
attributes.int_base = attributesCharacter[6].base;
|
||||||
|
attributes.cha_base = attributesCharacter[7].base;
|
||||||
|
//essence attributesCharacter[8]
|
||||||
|
attributes.edg_total = attributesCharacter[9].base;
|
||||||
|
if(character.heritage.name === "Technomancer"){
|
||||||
|
attributes.mag_base = character.attributes[10].base;
|
||||||
|
attributes.istechnomancer = 1;
|
||||||
|
}
|
||||||
|
<!-- else if(character.magician==="True" || character.adept==="True"){-->
|
||||||
|
<!-- attributes.mag_base=attributesCharacter.find(a => a.name_english === "MAG").total;-->
|
||||||
|
<!-- attributes.istechnomancer = 0;-->
|
||||||
|
<!-- }-->
|
||||||
|
else {
|
||||||
|
attributes.mag_base = 0;
|
||||||
|
attributes.istechnomancer = 0;
|
||||||
|
}
|
||||||
|
attributes.bod_aug = attributesCharacter[0].modified - attributesCharacter[0].base;
|
||||||
|
attributes.agi_aug = attributesCharacter[1].modified - attributesCharacter[1].base;
|
||||||
|
attributes.rea_aug = attributesCharacter[2].modified - attributesCharacter[2].base;
|
||||||
|
attributes.str_aug = attributesCharacter[3].modified - attributesCharacter[3].base;
|
||||||
|
attributes.wil_aug = attributesCharacter[4].modified - attributesCharacter[4].base;
|
||||||
|
attributes.log_aug = attributesCharacter[5].modified - attributesCharacter[5].base;
|
||||||
|
attributes.int_aug = attributesCharacter[6].modified - attributesCharacter[6].base;
|
||||||
|
attributes.cha_aug = attributesCharacter[7].modified - attributesCharacter[7].base;
|
||||||
|
}catch(err){
|
||||||
|
goodcode=false;
|
||||||
|
error= error + "\n" + "Error with Attributes " +err
|
||||||
|
}
|
||||||
|
|
||||||
|
if(goodcode){
|
||||||
|
try{
|
||||||
|
setAttrs(attributes);
|
||||||
|
return "Main Tab import successfull\n";
|
||||||
|
} catch(err){
|
||||||
|
return "Error setting Attributes: " + err;
|
||||||
|
}
|
||||||
|
} else{
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function importSkillsTabHeroLab(experimental, character) {
|
||||||
|
|
||||||
|
var goodcode = true;
|
||||||
|
var error = "";
|
||||||
|
var attributes = {};
|
||||||
|
|
||||||
|
var index=[];
|
||||||
|
for(var i=1;i<73;i++)
|
||||||
|
{
|
||||||
|
var name='skillname'+i;
|
||||||
|
index[i-1]=name;
|
||||||
|
}
|
||||||
|
|
||||||
|
var names = await asw.getAttrs(index);
|
||||||
|
var exotics=73;
|
||||||
|
try{
|
||||||
|
console.log("Importing Skills");
|
||||||
|
|
||||||
|
character.skills.active.forEach(skill => {
|
||||||
|
for(var j=1; j<73; j++){
|
||||||
|
var compname='skillname'+j;
|
||||||
|
if((names[compname] == skill.name)||(skill.name == "Locksmith" && j==29) || (skill.name == "Pilot Ground Craft" && j==55)){
|
||||||
|
attributes["skillrating"+j] = skill.modified;
|
||||||
|
attributes["skillbonus"+j] = skill.modified - skill.base;
|
||||||
|
|
||||||
|
if(skill.specialization != null) {
|
||||||
|
attributes["skillspec"+j] = skill.specialization.bonustext;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
attributes["skillspec"+j]="none";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
//knowledge skills
|
||||||
|
character.skills.knowledge.forEach(skill => {
|
||||||
|
var newrowid = generateRowID();
|
||||||
|
attributes["repeating_knowledge_"+newrowid+"_knowledgename"] = skill.name;
|
||||||
|
if(skill.skillcategory_english != null){
|
||||||
|
attributes["repeating_knowledge_"+newrowid+"_knowledgeattr"] = "@{"+skill.skillcategory_english.toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
attributes["repeating_knowledge_"+newrowid+"_knowledgerating"] = skill.base;
|
||||||
|
attributes["repeating_knowledge_"+newrowid+"_knowledgebonus"] = skill.modified - skill.base;
|
||||||
|
|
||||||
|
if(skill.specialization != null) {
|
||||||
|
attributes["repeating_knowledge_"+newrowid+"_knowledgespec"] = skill.specialization.bonustext;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
attributes["repeating_knowledge_"+newrowid+"_knowledgespec"] = "none";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
//language skills
|
||||||
|
character.skills.language.forEach(skill => {
|
||||||
|
var newrowid = generateRowID();
|
||||||
|
attributes["repeating_knowledge_"+newrowid+"_knowledgename"] = skill.name;
|
||||||
|
if(skill.skillcategory_english != null){
|
||||||
|
attributes["repeating_knowledge_"+newrowid+"_knowledgeattr"] = "@{"+skill.skillcategory_english.toLowerCase();
|
||||||
|
}
|
||||||
|
|
||||||
|
attributes["repeating_knowledge_"+newrowid+"_knowledgerating"] = skill.base;
|
||||||
|
attributes["repeating_knowledge_"+newrowid+"_knowledgebonus"] = skill.modified - skill.base;
|
||||||
|
|
||||||
|
if(skill.text === "N") {
|
||||||
|
attributes["repeating_knowledge_"+newrowid+"_knowledgerating"] = 100;
|
||||||
|
attributes["repeating_knowledge_"+newrowid+"_knowledgenotes"] = "Natural";
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(skill.specialization != null) {
|
||||||
|
attributes["repeating_knowledge_"+newrowid+"_knowledgespec"] = skill.specialization.bonustext;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
attributes["repeating_knowledge_"+newrowid+"_knowledgespec"] = "none";
|
||||||
|
}
|
||||||
|
attributes["repeating_knowledge_"+newrowid+"_knowledgeattr"]="@{language";
|
||||||
|
});
|
||||||
|
|
||||||
|
}catch(err){
|
||||||
|
goodcode=false;
|
||||||
|
error= error + "\n" + "Error with Skills: "+ err;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(goodcode){
|
||||||
|
try{
|
||||||
|
clearSkills(experimental);
|
||||||
|
setAttrs(attributes);
|
||||||
|
return "Skill Tab import successfull\n";
|
||||||
|
} catch(err){
|
||||||
|
return "Error setting Attributes: " + err;
|
||||||
|
}
|
||||||
|
} else{
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function importEnhancementTabHeroLab(text, character) {
|
||||||
|
|
||||||
|
var goodcode = true;
|
||||||
|
var error = "";
|
||||||
|
var attributes = {};
|
||||||
|
|
||||||
|
try{
|
||||||
|
if(character.qualities != null){
|
||||||
|
console.log("Importing qualities");
|
||||||
|
if(character.qualities.positive != undefined){
|
||||||
|
for(var i=0; i< character.qualities.positive.length; i++){
|
||||||
|
var newrowid=generateRowID();
|
||||||
|
attributes["repeating_posqualities_"+newrowid+"_posqualityname"] = character.qualities.positive[i].name;
|
||||||
|
attributes["repeating_posqualities_"+newrowid+"_posqualitykarma"] = character.qualities.positive[i].traitcost.bp;
|
||||||
|
attributes["repeating_posqualities_"+newrowid+"_posqualnotes"] = character.qualities.positive[i].description;
|
||||||
|
if( character.qualities.positive[i].rank != null) {
|
||||||
|
attributes["repeating_posqualities_"+newrowid+"_posqualitydescription"] = character.qualities.positive[i].rank;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(character.qualities.positive != undefined){
|
||||||
|
for(var i=0; i< character.qualities.negative.length; i++){
|
||||||
|
var newrowid=generateRowID();
|
||||||
|
attributes["repeating_negqualities_"+newrowid+"_negqualityname"] = character.qualities.negative[i].name;
|
||||||
|
attributes["repeating_negqualities_"+newrowid+"_negqualitykarma"] = character.qualities.negative[i].traitcost.bp;
|
||||||
|
attributes["repeating_negqualities_"+newrowid+"_negqualnotes"] = character.qualities.negative[i].description;
|
||||||
|
if(character.qualities.negative[i].rank != null) {
|
||||||
|
attributes["repeating_negqualities_"+newrowid+"_negqualitydescription"] = character.qualities.negative[i].rank
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}catch(err){
|
||||||
|
goodcode=false;
|
||||||
|
error= error + "\n" + "Error with Qualities " +err
|
||||||
|
}
|
||||||
|
|
||||||
|
try{
|
||||||
|
<!-- if(character.powers != null){-->
|
||||||
|
<!-- console.log("Importing Adept Powers");-->
|
||||||
|
<!-- if(character.powers.power.length>1){-->
|
||||||
|
<!-- for(var i=0;i<character.powers.power.length;i++){-->
|
||||||
|
<!-- var newrowid=generateRowID();-->
|
||||||
|
<!-- attributes["repeating_powers_"+newrowid+"_poweryname"]=character.powers.power[i].name;-->
|
||||||
|
<!-- attributes["repeating_powers_"+newrowid+"_powerdescription"]=character.powers.power[i].rating;-->
|
||||||
|
<!-- attributes["repeating_powers_"+newrowid+"_powerpoints"]=character.powers.power[i].totalpoints;-->
|
||||||
|
<!-- if(character.powers.power[i].notes != null) {-->
|
||||||
|
<!-- attributes["repeating_powers_"+newrowid+"_powernotes"]=character.powers.power[i].notes;-->
|
||||||
|
<!-- }-->
|
||||||
|
|
||||||
|
<!-- }-->
|
||||||
|
<!-- }else{-->
|
||||||
|
<!-- var newrowid=generateRowID();-->
|
||||||
|
<!-- attributes["repeating_powers_"+newrowid+"_poweryname"]=character.powers.power.name;-->
|
||||||
|
<!-- attributes["repeating_powers_"+newrowid+"_powerdescription"]=character.powers.power.rating;-->
|
||||||
|
<!-- attributes["repeating_powers_"+newrowid+"_powerpoints"]=character.powers.power.totalpoints;-->
|
||||||
|
<!-- if(character.powers.power.notes != null) {-->
|
||||||
|
<!-- attributes["repeating_powers_"+newrowid+"_powernotes"]=character.powers.power.notes;-->
|
||||||
|
<!-- }-->
|
||||||
|
<!-- }-->
|
||||||
|
<!-- }-->
|
||||||
|
}catch(err){
|
||||||
|
goodcode=false;
|
||||||
|
error="Error with Powers " +err
|
||||||
|
}
|
||||||
|
|
||||||
|
try{
|
||||||
|
var essence=0.0;
|
||||||
|
console.log("Importing Cyberware");
|
||||||
|
for(var i=0; i< character.gear.augmentations.cyberware.length; i++){
|
||||||
|
let cyberware = character.gear.augmentations.cyberware[i];
|
||||||
|
var newrowid=generateRowID();
|
||||||
|
|
||||||
|
attributes["repeating_ware_"+newrowid+"_warename"] = cyberware.name;
|
||||||
|
|
||||||
|
if(cyberware.rating !=null) {
|
||||||
|
attributes["repeating_ware_"+newrowid+"_waredescription"] = cyberware.rating;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(cyberware.description != null) {
|
||||||
|
attributes["repeating_ware_"+newrowid+"_warenotes"] = cyberware.description;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(cyberware.essencecost != null) {
|
||||||
|
attributes["repeating_ware_"+newrowid+"_warekarma"] = cyberware.essencecost;
|
||||||
|
essence += Number(cyberware.essencecost.replace(",","."));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
console.log("Importing Bioware");
|
||||||
|
for(var i=0; i< character.gear.augmentations.bioware.length; i++){
|
||||||
|
let bioware = character.gear.augmentations.bioware[i];
|
||||||
|
var newrowid=generateRowID();
|
||||||
|
|
||||||
|
attributes["repeating_ware_"+newrowid+"_warename"] = bioware.name;
|
||||||
|
|
||||||
|
if(bioware.rating !=null) {
|
||||||
|
attributes["repeating_ware_"+newrowid+"_waredescription"] = bioware.rating;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(bioware.description != null) {
|
||||||
|
attributes["repeating_ware_"+newrowid+"_warenotes"] = bioware.description;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(bioware.essencecost != null) {
|
||||||
|
attributes["repeating_ware_"+newrowid+"_warekarma"] = bioware.essencecost;
|
||||||
|
essence += Number(bioware.essencecost.replace(",","."));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
attributes.ess_total = 6-essence;
|
||||||
|
}catch(err){
|
||||||
|
goodcode=false;
|
||||||
|
error= error + "\n" + "Error with Ware " +err
|
||||||
|
}
|
||||||
|
|
||||||
|
<!-- try{-->
|
||||||
|
<!-- if(character.martialarts != null){-->
|
||||||
|
<!-- console.log("Importing martialarts");-->
|
||||||
|
<!-- if(character.martialarts.martialart.length>1){-->
|
||||||
|
<!-- for(var i=0;i<character.martialarts.martialart.length;i++){-->
|
||||||
|
<!-- if(character.martialarts.martialart[i].martialarttechniques != null){-->
|
||||||
|
<!-- if(character.martialarts.martialart[i].martialarttechniques.length > 1){-->
|
||||||
|
<!-- for(var j=0; j < character.martialarts.martialart[i].martialarttechniques.length; j++){-->
|
||||||
|
<!-- var newrowid=generateRowID();-->
|
||||||
|
<!-- attributes["repeating_martial_"+newrowid+"_martialname"] = character.martialarts.martialart[i].martialarttechniques.martialarttechnique[j].name;-->
|
||||||
|
<!-- attributes["repeating_martial_"+newrowid+"_martialdescription"] = character.martialarts.martialart[i].name;-->
|
||||||
|
<!-- if(character.martialarts.martialart[i].martialarttechniques.martialarttechnique[j].notes != undefined) {-->
|
||||||
|
<!-- attributes["repeating_martial_"+newrowid+"_martialnotes"] = character.martialarts.martialart[i].martialarttechniques.martialarttechnique[j].notes;-->
|
||||||
|
<!-- }-->
|
||||||
|
<!-- }-->
|
||||||
|
<!-- }else{-->
|
||||||
|
<!-- console.log(character.martialarts.martialart[i]);-->
|
||||||
|
<!-- var newrowid=generateRowID();-->
|
||||||
|
<!-- attributes["repeating_martial_"+newrowid+"_martialname"]=character.martialarts.martialart[i].martialarttechniques.martialarttechnique.name;-->
|
||||||
|
<!-- attributes["repeating_martial_"+newrowid+"_martialdescription"]=character.martialarts.martialart[i].name;-->
|
||||||
|
<!-- if(character.martialarts.martialart[i].martialarttechniques.martialarttechnique.notes != undefined) {-->
|
||||||
|
<!-- attributes["repeating_martial_"+newrowid+"_martialnotes"] = character.martialarts.martialart[i].martialarttechniques.martialarttechnique.notes;-->
|
||||||
|
<!-- }-->
|
||||||
|
<!-- }-->
|
||||||
|
<!-- }-->
|
||||||
|
<!-- }-->
|
||||||
|
<!-- }else{-->
|
||||||
|
<!-- if(character.martialarts.martialart.martialarttechniques != null){-->
|
||||||
|
<!-- if(character.martialarts.martialart.martialarttechniques.martialarttechnique.length>1){-->
|
||||||
|
<!-- for(var j=0;j<character.martialarts.martialart.martialarttechniques.martialarttechnique.length;j++){-->
|
||||||
|
<!-- var newrowid=generateRowID();-->
|
||||||
|
<!-- attributes["repeating_martial_"+newrowid+"_martialname"]=character.martialarts.martialart.martialarttechniques.martialarttechnique[j].name;-->
|
||||||
|
<!-- attributes["repeating_martial_"+newrowid+"_martialdescription"]=character.martialarts.martialart.name;-->
|
||||||
|
<!-- if(character.martialarts.martialart.martialarttechniques.martialarttechnique[j].notes != undefined) {-->
|
||||||
|
<!-- attributes["repeating_martial_"+newrowid+"_martialnotes"] = character.martialarts.martialart.martialarttechniques.martialarttechnique[j].notes;-->
|
||||||
|
<!-- }-->
|
||||||
|
<!-- }-->
|
||||||
|
<!-- }else{-->
|
||||||
|
<!-- var newrowid=generateRowID();-->
|
||||||
|
<!-- attributes["repeating_martial_"+newrowid+"_martialname"]=character.martialarts.martialart.martialarttechniques.martialarttechnique.name;-->
|
||||||
|
<!-- attributes["repeating_martial_"+newrowid+"_martialdescription"]=character.martialarts.martialart.name;-->
|
||||||
|
<!-- if(character.martialarts.martialart.martialarttechniques.martialarttechnique.notes != undefined) {-->
|
||||||
|
<!-- attributes["repeating_martial_"+newrowid+"_martialnotes"] = character.martialarts.martialart.martialarttechniques.martialarttechnique.notes;-->
|
||||||
|
<!-- }-->
|
||||||
|
<!-- }-->
|
||||||
|
<!-- }-->
|
||||||
|
<!-- }-->
|
||||||
|
<!-- }-->
|
||||||
|
<!-- }catch(err){-->
|
||||||
|
<!-- goodcode=false;-->
|
||||||
|
<!-- error= error + "\n" + "Error with Martial Arts " +err-->
|
||||||
|
<!-- }-->
|
||||||
|
|
||||||
|
if(goodcode){
|
||||||
|
try{
|
||||||
|
clearEnhancements(text.experimental);
|
||||||
|
setAttrs(attributes);
|
||||||
|
return "Enhancement Tab import successfull\n";
|
||||||
|
} catch(err){
|
||||||
|
return "Error setting Attributes: " + err;
|
||||||
|
}
|
||||||
|
} else{
|
||||||
|
return error;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,103 +0,0 @@
|
|||||||
function importSingleDrone(drone, attributes) {
|
|
||||||
|
|
||||||
var newrowid = generateRowID();
|
|
||||||
attributes["repeating_drones_"+newrowid+"_dronename"]= drone.name;
|
|
||||||
attributes["repeating_drones_"+newrowid+"_dronehand"]= drone.handling.match(/\d+/);
|
|
||||||
attributes["repeating_drones_"+newrowid+"_dronespeed"]= drone.speed.match(/\d+/);
|
|
||||||
attributes["repeating_drones_"+newrowid+"_droneaccl"]= drone.accel.match(/\d+/);
|
|
||||||
attributes["repeating_drones_"+newrowid+"_dronepilot"]= drone.pilot;
|
|
||||||
attributes["repeating_drones_"+newrowid+"_dronesens"]= drone.sensor;
|
|
||||||
attributes["repeating_drones_"+newrowid+"_droneprice"]= drone.cost;
|
|
||||||
attributes["repeating_drones_"+newrowid+"_dronebody"]= drone.body;
|
|
||||||
attributes["repeating_drones_"+newrowid+"_dronearmor"]= drone.armor;
|
|
||||||
attributes["repeating_drones_"+newrowid+"_dronenotes"]="";
|
|
||||||
|
|
||||||
if(drone.mods != null){
|
|
||||||
if(drone.mods.mod.length > 1){
|
|
||||||
var weaponnumber = 1;
|
|
||||||
for(var j = 0; j < drone.mods.mod.length; j++){
|
|
||||||
weaponnumber = importSingleDroneMod(drone.mods.mod[j], newrowid, attributes, weaponnumber);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
attributes["repeating_drones_"+newrowid+"_dronenotes"] += drone.mods.mod.name + "\n";
|
|
||||||
importSingleDroneMod(drone.mods.mod, newrowid, attributes, weaponnumber);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const importSingleDroneMod = (mod, newrowid, attributes, weaponnumber) => {
|
|
||||||
attributes["repeating_drones_" + newrowid + "_dronenotes"] += mod.name + "\n";
|
|
||||||
if(mod.weapons != null && mod.weapons.weapon != null){
|
|
||||||
if(mod.weapons.length > 1){
|
|
||||||
return importSingleDroneWeapon(mod.weapons.weapon[0], newrowid, attributes, weaponnumber);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return importSingleDroneWeapon(mod.weapons.weapon, newrowid, attributes, weaponnumber);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return weaponnumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
const importSingleDroneWeapon = (weapon, newrowid, attributes, weaponnumber) => {
|
|
||||||
attributes["repeating_drones_"+newrowid+"_droneweaponname" + weaponnumber] = weapon.name;
|
|
||||||
attributes["repeating_drones_"+newrowid+"_droneweaponaccuracy"+ weaponnumber] = weapon.accuracy.match(/\d+/g).pop();
|
|
||||||
if(weapon.type == "Ranged")
|
|
||||||
attributes["repeating_drones_"+newrowid+"_droneweaponrc"+ weaponnumber] = weapon.rc.match(/\d+/g).pop();
|
|
||||||
if(Number(weapon.ap) != "NaN"){
|
|
||||||
attributes["repeating_drones_"+newrowid+"_droneweaponap"+ weaponnumber] = weapon.ap;
|
|
||||||
}else{
|
|
||||||
attributes["repeating_drones_"+newrowid+"_droneweaponap"+ weaponnumber] = 0;
|
|
||||||
}
|
|
||||||
attributes["repeating_drones_"+newrowid+"_droneweapondv"+ weaponnumber] = weapon.damage_english.match(/\d*/);
|
|
||||||
attributes["repeating_drones_"+newrowid+"_droneweapondmgtype"+ weaponnumber] = weapon.damage_english.match(/^\d*/);
|
|
||||||
attributes["repeating_drones_"+newrowid+"_droneweaponnotes"+ weaponnumber] = "";
|
|
||||||
if(typeof weapon.accessories != "undefined"){
|
|
||||||
if(weapon.accessories.accessory.length > 1){
|
|
||||||
for(var h = 0; h < weapon.accessories.accessory.length; h++){
|
|
||||||
attributes["repeating_drones_"+newrowid+"_droneweaponnotes"+ weaponnumber] += weapon.accessories.accessory[h].name+"\n";
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
attributes["repeating_drones_"+newrowid+"_droneweaponnotes"+ weaponnumber] += weapon.accessories.accessory.name+"\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return weaponnumber +1;
|
|
||||||
}
|
|
||||||
const importAutosofts = (drone, newrowid, attributes) => {
|
|
||||||
|
|
||||||
let autosofts;
|
|
||||||
if(drone.gears.gear.length > 1) {
|
|
||||||
autosofts = drone.gears.gear.filter(gear => gear.category_english.includes("Autosofts"));
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if(drone.gears.gear.category_english == "Autosofts") {
|
|
||||||
autosofts = [drone.gears.gear];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(autosofts != null) {
|
|
||||||
//search for clearsight
|
|
||||||
let clearsight = autosofts.find(soft => soft.name_english.includes("Clearsight Autosoft"));
|
|
||||||
if(clearsight != null) {
|
|
||||||
attributes["repeating_drones_"+newrowid+"_droneperceptionsoft"] = clearsight.rating;
|
|
||||||
}
|
|
||||||
|
|
||||||
//Maneuvering
|
|
||||||
let maneuvering = autosofts.find(soft => soft.name_english.includes("Maneuvering Autosoft"));
|
|
||||||
if(maneuvering != null) {
|
|
||||||
attributes["repeating_drones_"+newrowid+"_dronemaneuversoft"] = maneuvering.rating;
|
|
||||||
}
|
|
||||||
|
|
||||||
//stealth
|
|
||||||
let stealth = autosofts.find(soft => soft.name_english.includes("Stealth Autosoft"));
|
|
||||||
if(stealth != null) {
|
|
||||||
attributes["repeating_drones_"+newrowid+"_dronesneaksoft"] = stealth.rating;
|
|
||||||
}
|
|
||||||
|
|
||||||
//evasion
|
|
||||||
let evasion = autosofts.find(soft => soft.name_english.includes("Evasion Autosoft"));
|
|
||||||
if(evasion != null) {
|
|
||||||
attributes["repeating_drones_"+newrowid+"_dronedodgesoft"] = evasion.rating;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,155 +0,0 @@
|
|||||||
function provideRepeatingWeaponRowName(weapon) {
|
|
||||||
|
|
||||||
var weaponrow = "weapons";
|
|
||||||
|
|
||||||
switch(weapon.skill) {
|
|
||||||
case "Pistols":
|
|
||||||
weaponrow = weapon.skill.replaceAll(' ', '').toLowerCase();
|
|
||||||
break;
|
|
||||||
case "Automatics":
|
|
||||||
weaponrow = weapon.skill.replaceAll(' ', '').toLowerCase();
|
|
||||||
break;
|
|
||||||
case "Longarms":
|
|
||||||
weaponrow = weapon.skill.replaceAll(' ', '').toLowerCase();
|
|
||||||
break;
|
|
||||||
case "Heavy Weapons":
|
|
||||||
weaponrow = weapon.skill.replaceAll(' ', '').toLowerCase();
|
|
||||||
break;
|
|
||||||
case "Unarmed Combat":
|
|
||||||
weaponrow = "closecombat"
|
|
||||||
break;
|
|
||||||
case "Blades":
|
|
||||||
weaponrow = "closecombat"
|
|
||||||
break;
|
|
||||||
case "Clubs":
|
|
||||||
weaponrow = "closecombat"
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
var row = "repeating_" + weaponrow + "_" + generateRowID() + "_";
|
|
||||||
|
|
||||||
return row;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function importSingleRepeatingWeapon(text, weapon, ammunition, attributes) {
|
|
||||||
var row = provideRepeatingWeaponRowName(weapon);
|
|
||||||
console.log(row);
|
|
||||||
if(weapon.type == "Ranged"){
|
|
||||||
attributes[row + "weaponismelee"] = 0;
|
|
||||||
attributes[row + "weaponrc"] = weapon.rc.match(/\d+/g).pop()-Math.ceil((parseInt(attributes.str_base) + parseInt(attributes.str_aug))/3)- 1;
|
|
||||||
if(!weapon.rawdamage.includes("STR") && weapon.rawdamage.match(/\d+/) !== null) {
|
|
||||||
attributes[row + "weapondv"] = weapon.rawdamage.match(/\d+/)[0];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
attributes[row + "weapondv"] = weapon.damage.match(/\d+/) != null ? weapon.damage.match(/\d+/)[0] : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
attributes[row + "weapondmgtype"] = weapon.rawdamage.match(/S\(e\)|S\b|P|Special\b/) != null ? weapon.rawdamage.match(/S\(e\)|S\b|P|Special\b/)[0] : 0;
|
|
||||||
}else{
|
|
||||||
attributes[row + "weaponismelee"] = "on";
|
|
||||||
attributes[row + "weaponreach"] = weapon.reach;
|
|
||||||
attributes[row + "weapondv"] = weapon.damage_english.match(/\d+/) != null ? weapon.damage_english.match(/\d+/)[0] : 0;
|
|
||||||
attributes[row + "weapondmgtype"] = weapon.damage_english.match(/S\(e\)|S\b|P|Special\b/) != null ? weapon.damage_english.match(/S\(e\)|S\b|P|Special\b/)[0] : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
let skills = [];
|
|
||||||
for(var i=43;i<52;i++)
|
|
||||||
{
|
|
||||||
var name = 'skillname'+i;
|
|
||||||
skills.push(name);
|
|
||||||
var rating = 'skillrating'+i;
|
|
||||||
skills.push(rating);
|
|
||||||
var bonus = 'skillbonus'+i;
|
|
||||||
skills.push(bonus);
|
|
||||||
var attr = 'skillattr_value'+i;
|
|
||||||
skills.push(attr);
|
|
||||||
}
|
|
||||||
skills = await asw.getAttrs(skills);
|
|
||||||
for(var i=43; i<52; i++)
|
|
||||||
{
|
|
||||||
var compname = 'skillname'+i;
|
|
||||||
var rating = 'skillrating'+i;
|
|
||||||
var bonus = 'skillbonus'+i;
|
|
||||||
var skillattr = 'skillattr_value'+i;
|
|
||||||
|
|
||||||
if(skills[compname] == weapon.skill){
|
|
||||||
attributes[row + "weaponcategory"] = "@{skilldicepool"+i+"}";
|
|
||||||
let attribute = await asw.getAttrs([skillattr]);
|
|
||||||
let attrTotal = attribute[skillattr].replace(/[^a-zA-Z0-9_]/g, "");
|
|
||||||
let attributeSum = await asw.getAttrs([attrTotal]);
|
|
||||||
let targetAttributes = attributeSum[attrTotal].replace(/[+]/g, ",").replace(/[^a-zA-Z0-9_,]/g, "").split(",");
|
|
||||||
let attributesValues = [attributes[targetAttributes[0]], attributes[targetAttributes[1]]]
|
|
||||||
attributes[row + "weaponbonus"] = weapon.dicepool - skills[rating] - skills[bonus] - attributesValues.reduce((a,b) => parseInt(a) + parseInt(b));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
attributes[row + "weaponname"] = weapon.name;
|
|
||||||
attributes[row + "weaponaccuracy"] = weapon.accuracy.match(/\d+/g).pop();
|
|
||||||
if(weapon.ap == null || isNaN(weapon.ap)){
|
|
||||||
attributes[row + "weaponap"] = 0;
|
|
||||||
}else{
|
|
||||||
attributes[row + "weaponap"] = weapon.ap;
|
|
||||||
if(weapon.rawap != null) {
|
|
||||||
attributes[row + "weaponap"] = weapon.rawap;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
attributes[row + "weaponnotes"] = "";
|
|
||||||
|
|
||||||
if(typeof weapon.accessories != "undefined"){
|
|
||||||
if(weapon.accessories.accessory.length>1){
|
|
||||||
for(var j=0; j<weapon.accessories.accessory.length; j++){
|
|
||||||
attributes[row + "weaponnotes"] += weapon.accessories.accessory[j].name+"\n";
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
attributes[row + "weaponnotes"] += weapon.accessories.accessory.name+"\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(weapon.clips !== null){
|
|
||||||
if(weapon.clips.clip.length > 1){
|
|
||||||
let amountImported = 0;
|
|
||||||
for(var j=0; j < weapon.clips.clip.length && amountImported < 4; j++){
|
|
||||||
|
|
||||||
if(weapon.clips.clip[j].location === "loaded") {
|
|
||||||
//skip loaded, they will be found later anyway
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
var newrowid=generateRowID();
|
|
||||||
//find ammo to get stats
|
|
||||||
ammo = ammunition.find(clip => clip.guid === weapon.clips.clip[j].id);
|
|
||||||
|
|
||||||
if(ammo != null && !ammo.name_english.includes("Regular")) {
|
|
||||||
importRepeatingWeaponAmmo(row, ammo, amountImported, attributes);
|
|
||||||
amountImported++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
var newrowid = generateRowID();
|
|
||||||
//find ammo to get stats
|
|
||||||
ammo = ammunition.find(clip => clip.guid === weapon.clips.clip.id);
|
|
||||||
|
|
||||||
if(ammo != null) {
|
|
||||||
importRepeatingWeaponAmmo(row, ammo, 0, attributes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function importRepeatingWeaponAmmo(row, ammunition, number, attributes) {
|
|
||||||
|
|
||||||
attributes[row + "ammoname"+number] = ammo.name;
|
|
||||||
|
|
||||||
attributes[row + "ammodv" + number] = ammo.weaponbonusdamage_english != null ? ammo.weaponbonusdamage_english.substring(0,2) : 0;
|
|
||||||
if(ammo.weaponbonusdamage_english != null) {
|
|
||||||
attributes[row + "ammodmgtype" + number] = ammo.weaponbonusdamage_english.substring(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(ammo.name_english === "Ammo: Stick-n-Shock") {
|
|
||||||
attributes[row + "_ammoap" + number] = -5 - attributes[row + "weaponap"]
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
attributes[row + "ammoap" + number] = ammo.weaponbonusap != null? ammo.weaponbonusap : 0;
|
|
||||||
}
|
|
||||||
attributes[row + "ammoacc" + number] = ammo.weaponbonusacc != null ? ammo.weaponbonusacc : 0;
|
|
||||||
}
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
function importSingleSpell(spell, attributes, spellcasting, ritual, alchemy) {
|
|
||||||
var category = "spells";
|
|
||||||
if(spell.category_english == "Rituals") {
|
|
||||||
category = "rituals"
|
|
||||||
}
|
|
||||||
if(spell.alchemy == "True"){
|
|
||||||
category = "alchemy"
|
|
||||||
}
|
|
||||||
|
|
||||||
var row = "repeating_" + category + "_" + generateRowID();
|
|
||||||
|
|
||||||
attributes[row + "_spellname"] = spell.name;
|
|
||||||
attributes[row + "_spelltype"] = spell.type;
|
|
||||||
attributes[row + "_spellcategory"] = spell.category;
|
|
||||||
if(spell.notes != null){
|
|
||||||
attributes[row + "_spelldescription"] = spell.notes;
|
|
||||||
}
|
|
||||||
if(spell.dv.match(/(\-|\+)\d/) != null) {
|
|
||||||
attributes[row + "_spelldrain"] = spell.dv.match(/(\-|\+)\d/)[0];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
attributes[row + "_spelldrain"] = "-0";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if(spell.category_english == "Rituals"){
|
|
||||||
attributes[row + "_spellschool"] = "@{skilldicepool67}";
|
|
||||||
attributes[row + "_spelldrain"] = "*2";
|
|
||||||
attributes[row + "_spellbonus"] = spell.dicepool - ritual;
|
|
||||||
} else {
|
|
||||||
attributes[row + "_spellbonus"] = spell.dicepool - spellcasting;
|
|
||||||
if(spell.alchemy == "True"){
|
|
||||||
attributes[row + "_spellschool"] = "@{skilldicepool58}";
|
|
||||||
attributes[row + "_spellbonus"] = spell.dicepool - alchemy;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
attributes[row + "_spellrange"] = spell.range;
|
|
||||||
attributes[row + "_spellduration"] = spell.duration;
|
|
||||||
}
|
|
||||||
@@ -1,65 +0,0 @@
|
|||||||
function importSingleVehicle(vehicle, attributes) {
|
|
||||||
|
|
||||||
var newrowid = generateRowID();
|
|
||||||
attributes["repeating_vehicles_"+newrowid+"_vehiclename"]= vehicle.name;
|
|
||||||
attributes["repeating_vehicles_"+newrowid+"_vehiclehand"]= vehicle.handling.match(/\d+/);
|
|
||||||
attributes["repeating_vehicles_"+newrowid+"_vehiclespeed"]= vehicle.speed.match(/\d+/);
|
|
||||||
attributes["repeating_vehicles_"+newrowid+"_vehicleaccl"]= vehicle.accel.match(/\d+/);
|
|
||||||
attributes["repeating_vehicles_"+newrowid+"_vehiclepilot"]= vehicle.pilot;
|
|
||||||
attributes["repeating_vehicles_"+newrowid+"_vehiclesens"]= vehicle.sensor;
|
|
||||||
attributes["repeating_vehicles_"+newrowid+"_vehicleseats"]= vehicle.seats;
|
|
||||||
attributes["repeating_vehicles_"+newrowid+"_vehicleprice"]= vehicle.cost;
|
|
||||||
attributes["repeating_vehicles_"+newrowid+"_vehiclebody"]= vehicle.body;
|
|
||||||
attributes["repeating_vehicles_"+newrowid+"_vehiclearmor"]= vehicle.armor;
|
|
||||||
attributes["repeating_vehicles_"+newrowid+"_vehiclenotes"]="";
|
|
||||||
|
|
||||||
if(vehicle.mods != null){
|
|
||||||
if(vehicle.mods.mod.length > 1){
|
|
||||||
var weaponnumber = 1;
|
|
||||||
for(var j = 0; j < vehicle.mods.mod.length; j++){
|
|
||||||
weaponnumber = importSingleVehicleMod(vehicle.mods.mod[j], newrowid, attributes, weaponnumber);
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
attributes["repeating_vehicles_"+newrowid+"_vehiclenotes"] += vehicle.mods.mod.name + "\n";
|
|
||||||
importSingleVehicleMod(vehicle.mods.mod, newrowid, attributes, weaponnumber);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
const importSingleVehicleMod = (mod, newrowid, attributes, weaponnumber) => {
|
|
||||||
attributes["repeating_vehicles_" + newrowid + "_vehiclenotes"] += mod.name + "\n";
|
|
||||||
if(mod.weapons != null && mod.weapons.weapon != null){
|
|
||||||
if(mod.weapons.length > 1){
|
|
||||||
return importSingleVehicleWeapon(mod.weapons.weapon[0], newrowid, attributes, weaponnumber);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return importSingleVehicleWeapon(mod.weapons.weapon, newrowid, attributes, weaponnumber);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return weaponnumber;
|
|
||||||
}
|
|
||||||
|
|
||||||
const importSingleVehicleWeapon = (weapon, newrowid, attributes, weaponnumber) => {
|
|
||||||
attributes["repeating_vehicles_"+newrowid+"_vehicleweaponname" + weaponnumber] = weapon.name;
|
|
||||||
attributes["repeating_vehicles_"+newrowid+"_vehicleweaponaccuracy"+ weaponnumber] = weapon.accuracy.match(/\d+/g).pop();
|
|
||||||
if(weapon.type == "Ranged")
|
|
||||||
attributes["repeating_vehicles_"+newrowid+"_vehicleweaponrc"+ weaponnumber] = weapon.rc.match(/\d+/g).pop();
|
|
||||||
if(Number(weapon.ap) != "NaN"){
|
|
||||||
attributes["repeating_vehicles_"+newrowid+"_vehicleweaponap"+ weaponnumber] = weapon.ap;
|
|
||||||
}else{
|
|
||||||
attributes["repeating_vehicles_"+newrowid+"_vehicleweaponap"+ weaponnumber] = 0;
|
|
||||||
}
|
|
||||||
attributes["repeating_vehicles_"+newrowid+"_vehicleweapondv"+ weaponnumber] = weapon.damage_english.match(/\d*/);
|
|
||||||
attributes["repeating_vehicles_"+newrowid+"_vehicleweapondmgtype"+ weaponnumber] = weapon.damage_english.match(/^\d*/);
|
|
||||||
attributes["repeating_vehicles_"+newrowid+"_vehicleweaponnotes"+ weaponnumber] = "";
|
|
||||||
if(typeof weapon.accessories != "undefined"){
|
|
||||||
if(weapon.accessories.accessory.length > 1){
|
|
||||||
for(var h = 0; h < weapon.accessories.accessory.length; h++){
|
|
||||||
attributes["repeating_vehicles_"+newrowid+"_vehicleweaponnotes"+ weaponnumber] += weapon.accessories.accessory[h].name+"\n";
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
attributes["repeating_vehicles_"+newrowid+"_vehicleweaponnotes"+ weaponnumber] += weapon.accessories.accessory.name+"\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return weaponnumber +1;
|
|
||||||
}
|
|
||||||
@@ -1,102 +0,0 @@
|
|||||||
function importSingleWeapon(text, weapon, number, ammunition, attributes) {
|
|
||||||
if(weapon.type == "Ranged"){
|
|
||||||
attributes["weaponismelee"+number] = 0;
|
|
||||||
attributes["weaponrc"+number] = weapon.rc.match(/\d+/g).pop()-Math.ceil((parseInt(attributes.str_base) + parseInt(attributes.str_aug))/3)- 1;
|
|
||||||
|
|
||||||
if(weapon.rawdamage.match(/\d+/) !== null && !weapon.rawdamage.includes("STR")) {
|
|
||||||
attributes["weapondv"+number] = weapon.rawdamage.match(/\d+/)[0];
|
|
||||||
}
|
|
||||||
else if(weapon.rawdamage.includes("STR")) {
|
|
||||||
attributes["weapondv"+number] = weapon.damage.match(/\d+/)[0];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
attributes["weapondv"+number] = weapon.damage.match(/\d+/) != null ? weapon.damage.match(/\d+/)[0] : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
attributes["weapondmgtype"+number] = weapon.rawdamage.match(/S\(e\)|S\b|P|Special\b/) != null ? weapon.rawdamage.match(/S\(e\)|S\b|P|Special\b/)[0] : 0;
|
|
||||||
}else{
|
|
||||||
attributes["weaponismelee"+number] = "on";
|
|
||||||
attributes["weaponreach"+number] = weapon.reach;
|
|
||||||
attributes["weapondv"+number] = weapon.damage_english.match(/\d+/)[0];
|
|
||||||
attributes["weapondmgtype"+number] = weapon.damage_english.match(/S\(e\)|S\b|P|Special\b/) != null ? weapon.damage_english.match(/S\(e\)|S\b|P|Special\b/)[0] : 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
attributes["weaponname"+number] = weapon.name;
|
|
||||||
attributes["weaponaccuracy"+number] = weapon.accuracy.match(/\d+/g).pop();
|
|
||||||
if(isNaN(weapon.ap)){
|
|
||||||
attributes["weaponap"+number] = 0;
|
|
||||||
}else{
|
|
||||||
attributes["weaponap"+number] = weapon.ap;
|
|
||||||
if(weapon.rawap != null) {
|
|
||||||
attributes["weaponap"+number] = weapon.rawap;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
attributes["weaponnotes"+number] = "";
|
|
||||||
|
|
||||||
if(typeof weapon.accessories != "undefined"){
|
|
||||||
if(weapon.accessories.accessory.length>1){
|
|
||||||
for(var j=0; j<weapon.accessories.accessory.length; j++){
|
|
||||||
attributes["weaponnotes"+number] += weapon.accessories.accessory[j].name+"\n";
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
attributes["weaponnotes"+number] += weapon.accessories.accessory.name+"\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(weapon.clips !== null){
|
|
||||||
if(weapon.clips.clip.length>1){
|
|
||||||
for(var j=0; j<weapon.clips.clip.length; j++){
|
|
||||||
|
|
||||||
if(weapon.clips.clip[j].location === "loaded") {
|
|
||||||
//skip loaded, they will be found later anyway
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
var newrowid=generateRowID();
|
|
||||||
//find ammo to get stats
|
|
||||||
ammo = ammunition.find(clip => clip.guid === weapon.clips.clip[j].id);
|
|
||||||
if(ammo != null) {
|
|
||||||
importRepeatingAmmo(ammo, number, attributes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}else{
|
|
||||||
var newrowid = generateRowID();
|
|
||||||
//find ammo to get stats
|
|
||||||
ammo = ammunition.find(clip => clip.guid === weapon.clips.clip.id);
|
|
||||||
|
|
||||||
if(ammo != null) {
|
|
||||||
importRepeatingAmmo(ammo, number, attributes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function importRepeatingAmmo(ammunition, number, attributes) {
|
|
||||||
|
|
||||||
var newrowid = generateRowID();
|
|
||||||
|
|
||||||
attributes["repeating_ammotype"+number+"_"+newrowid+"_ammoname"] = ammo.name;
|
|
||||||
|
|
||||||
if(ammo.weaponbonusdamage_english != null && ammo.weaponbonusap != null && ammo.weaponbonusacc != null) {
|
|
||||||
attributes["repeating_ammotype"+number+"_"+newrowid+"_ammodv"] = ammo.weaponbonusdamage_english.substring(0,2);
|
|
||||||
attributes["repeating_ammotype"+number+"_"+newrowid+"_ammodmgtype"] = ammo.weaponbonusdamage_english.substring(2);
|
|
||||||
if(ammo.name_english === "Ammo: Stick-n-Shock") {
|
|
||||||
attributes["repeating_ammotype"+number+"_"+newrowid+"_ammoap"] = -5 - attributes["weaponap" + number]
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
attributes["repeating_ammotype"+number+"_"+newrowid+"_ammoap"] = ammo.weaponbonusap;
|
|
||||||
}
|
|
||||||
attributes["repeating_ammotype"+number+"_"+newrowid+"_ammoacc"] = ammo.weaponbonusacc;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
attributes["repeating_ammotype"+number+"_"+newrowid+"_ammodv"] = 0;
|
|
||||||
attributes["repeating_ammotype"+number+"_"+newrowid+"_ammodmgtype"] = 0;
|
|
||||||
if(ammo.name_english === "Ammo: Stick-n-Shock") {
|
|
||||||
attributes["repeating_ammotype"+number+"_"+newrowid+"_ammoap"] = -5 - attributes["weaponap" + number]
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
attributes["repeating_ammotype"+number+"_"+newrowid+"_ammoap"] = 0;
|
|
||||||
}
|
|
||||||
attributes["repeating_ammotype"+number+"_"+newrowid+"_ammoacc"] = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,106 +0,0 @@
|
|||||||
on("sheet:opened", function() {
|
|
||||||
var names=[];
|
|
||||||
for(var i=1; i<77; i++)
|
|
||||||
{
|
|
||||||
var name='skillspec'+i;
|
|
||||||
names[i-1]=name;
|
|
||||||
}
|
|
||||||
getAttrs(names, function(values) {
|
|
||||||
for(var prop in values)
|
|
||||||
{
|
|
||||||
if(values[prop]=="0")
|
|
||||||
{
|
|
||||||
values[prop]="none";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
values.warningcheckbox=0;
|
|
||||||
values.chummercheckbox=0;
|
|
||||||
values.chummertext="In Chummer make sure to mark your character as created\nwith a created character go to File->Export->Export JSON\ncopy the file and paste it into this textfield overriding this text\nclick import and accept\nWhen using Chummer 5.213.95 or later the import is language independent\nIf you find bugs, please report them at https://github.com/Roll20/roll20-character-sheets/issues";
|
|
||||||
values.experimental=0;
|
|
||||||
values.nightly=0;
|
|
||||||
setAttrs(values);
|
|
||||||
});
|
|
||||||
|
|
||||||
var armors=[];
|
|
||||||
for(var i=1; i <9; i++) {
|
|
||||||
armors.push('armorname'+i);
|
|
||||||
armors.push('armorcapacity'+i);
|
|
||||||
armors.push('armornotes'+i);
|
|
||||||
armors.push('armorrating'+i);
|
|
||||||
}
|
|
||||||
armors.push('armormigration042021');
|
|
||||||
getAttrs(armors, function(values) {
|
|
||||||
var attributes={};
|
|
||||||
keys = Object.keys(values);
|
|
||||||
|
|
||||||
if(values.armormigration042021){
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(keys.includes('armorname1') && values.armorname1 !== null) {
|
|
||||||
var newrowid=generateRowID()
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armorname"]=values.armorname1;
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armorrating"]=!!values.armorrating1 ? values.armorrating1 : "0";
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armornotes"]=!!values.armornotes1 ? values.armornotes1 : "";
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armorcapacity"]=!!values.armorcapacity1 ? values.armorcapacity1 : "0";
|
|
||||||
}
|
|
||||||
|
|
||||||
if(keys.includes('armorname2') && values.armorname2 !== null) {
|
|
||||||
var newrowid=generateRowID()
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armorname"]=values.armorname2;
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armorrating"]=!!values.armorrating2 ? values.armorrating2 : "0";
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armornotes"]=!!values.armornotes2 ? values.armornotes2 : "";
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armorcapacity"]=!!values.armorcapacity2 ? values.armorcapacity2 : "0";
|
|
||||||
}
|
|
||||||
|
|
||||||
if(keys.includes('armorname3') && values.armorname3 !== null) {
|
|
||||||
var newrowid=generateRowID()
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armorname"]=values.armorname3;
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armorrating"]=!!values.armorrating3 ? values.armorrating3 : "0";
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armornotes"]=!!values.armornotes3 ? values.armornotes3 : "";
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armorcapacity"]=!!values.armorcapacity3 ? values.armorcapacity3 : "0";
|
|
||||||
}
|
|
||||||
|
|
||||||
if(keys.includes('armorname4') && values.armorname4 !== null) {
|
|
||||||
var newrowid=generateRowID()
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armorname"]=values.armorname4;
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armorrating"]=!!values.armorrating4 ? values.armorrating4 : "0";
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armornotes"]=!!values.armornotes4 ? values.armornotes4 : "";
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armorcapacity"]=!!values.armorcapacity4 ? values.armorcapacity4 : "0";
|
|
||||||
}
|
|
||||||
|
|
||||||
if(keys.includes('armorname5') && values.armorname5 !== null) {
|
|
||||||
var newrowid=generateRowID()
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armorname"]=values.armorname5;
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armorrating"]=!!values.armorrating5 ? values.armorrating5 : "0";
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armornotes"]=!!values.armornotes5 ? values.armornotes5 : "";
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armorcapacity"]=!!values.armorcapacity5 ? values.armorcapacity5 : "0";
|
|
||||||
}
|
|
||||||
|
|
||||||
if(keys.includes('armorname6') && values.armorname6 !== null) {
|
|
||||||
var newrowid=generateRowID()
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armorname"]=values.armorname6;
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armorrating"]=!!values.armorrating6 ? values.armorrating6 : "0";
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armornotes"]=!!values.armornotes6 ? values.armornotes6 : "";
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armorcapacity"]=!!values.armorcapacity6 ? values.armorcapacity6 : "0";
|
|
||||||
}
|
|
||||||
|
|
||||||
if(keys.includes('armorname7') && values.armorname7 !== null) {
|
|
||||||
var newrowid=generateRowID()
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armorname"]=values.armorname7;
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armorrating"]=!!values.armorrating7 ? values.armorrating7 : "0";
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armornotes"]=!!values.armornotes7 ? values.armornotes7 : "";
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armorcapacity"]=!!values.armorcapacity7 ? values.armorcapacity7 : "0";
|
|
||||||
}
|
|
||||||
|
|
||||||
if(keys.includes('armorname8') && values.armorname8 !== null) {
|
|
||||||
var newrowid=generateRowID()
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armorname"]=values.armorname8;
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armorrating"]=!!values.armorrating8 ? values.armorrating8 : "0";
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armornotes"]=!!values.armornotes8 ? values.armornotes8 : "";
|
|
||||||
attributes["repeating_armors_"+newrowid+"_armorcapacity"]=!!values.armorcapacity8 ? values.armorcapacity8 : "0";
|
|
||||||
}
|
|
||||||
attributes["armormigration042021"] = true;
|
|
||||||
setAttrs(attributes);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user