[Shadowrun 5th Advanced] fix for init

This commit is contained in:
Stexinator
2021-03-23 18:37:23 +01:00
parent 93d8a80ff1
commit db1fb2ffc8
+55 -42
View File
@@ -9741,7 +9741,7 @@ Only takes the first match even if multiple identical entries are found.">
on("sheet:opened", function() {
var names=[];
for(var i=1;i<77;i++)
for(var i=1; i<77; i++)
{
var name='skillspec'+i;
names[i-1]=name;
@@ -9846,53 +9846,65 @@ on("change:chummercheckbox", function(){
if(text.experimental == "on"){
getSectionIDs("repeating_contacts", function(idarray) {
for(var i=0; i < idarray.length; i++) {
removeRepeatingRow("repeating_contacts_"+idarray[i]);
}});
removeRepeatingRow("repeating_contacts_"+idarray[i]);
}
});
}
getSectionIDs("repeating_posqualities", function(idarray) {
for(var i=0; i < idarray.length; i++) {
removeRepeatingRow("repeating_posqualities_"+idarray[i]);
}});
removeRepeatingRow("repeating_posqualities_"+idarray[i]);
}
});
getSectionIDs("repeating_negqualities", function(idarray) {
for(var i=0; i < idarray.length; i++) {
removeRepeatingRow("repeating_negqualities_"+idarray[i]);
}});
removeRepeatingRow("repeating_negqualities_"+idarray[i]);
}
});
getSectionIDs("repeating_powers", function(idarray) {
for(var i=0; i < idarray.length; i++) {
removeRepeatingRow("repeating_powers_"+idarray[i]);
}});
removeRepeatingRow("repeating_powers_"+idarray[i]);
}
});
getSectionIDs("repeating_ware", function(idarray) {
for(var i=0; i < idarray.length; i++) {
removeRepeatingRow("repeating_ware_"+idarray[i]);
}});
removeRepeatingRow("repeating_ware_"+idarray[i]);
}
});
getSectionIDs("repeating_martial", function(idarray) {
for(var i=0; i < idarray.length; i++) {
removeRepeatingRow("repeating_martial_"+idarray[i]);
}});
removeRepeatingRow("repeating_martial_"+idarray[i]);
}
});
getSectionIDs("repeating_spells", function(idarray) {
for(var i=0; i < idarray.length; i++) {
removeRepeatingRow("repeating_spells_"+idarray[i]);
}});
removeRepeatingRow("repeating_spells_"+idarray[i]);
}
});
getSectionIDs("repeating_initiation", function(idarray) {
for(var i=0; i < idarray.length; i++) {
removeRepeatingRow("repeating_initiation_"+idarray[i]);
}});
removeRepeatingRow("repeating_initiation_"+idarray[i]);
}
});
getSectionIDs("repeating_programs", function(idarray) {
for(var i=0; i < idarray.length; i++) {
removeRepeatingRow("repeating_programs_"+idarray[i]);
}});
removeRepeatingRow("repeating_programs_"+idarray[i]);
}
});
getSectionIDs("repeating_equipment", function(idarray) {
for(var i=0; i < idarray.length; i++) {
removeRepeatingRow("repeating_equipment_"+idarray[i]);
}});
removeRepeatingRow("repeating_equipment_"+idarray[i]);
}
});
getSectionIDs("repeating_knowledge", function(idarray) {
for(var i=0; i < idarray.length; i++) {
removeRepeatingRow("repeating_knowledge_"+idarray[i]);
}});
removeRepeatingRow("repeating_knowledge_"+idarray[i]);
}
});
getSectionIDs("repeating_vehicles", function(idarray) {
for(var i=0; i < idarray.length; i++) {
removeRepeatingRow("repeating_vehicles_"+idarray[i]);
}});
removeRepeatingRow("repeating_vehicles_"+idarray[i]);
}
});
var attributes={};
for(var i=1;i<9;i++){
attributes["weaponismelee"+i]="on";
@@ -10241,31 +10253,31 @@ on("change:chummercheckbox", function(){
if(chummerfile.characters.character.weapons!=null){
console.log("Importing weapons");
ammunition = [];
for( int j = 0; j < chummerfile.characters.character.gears.gear.length; j++) {
for( var j = 0; j < chummerfile.characters.character.gears.gear.length; j++) {
if(chummerfile.characters.character.gears.gear[j].category_english == "Ammunition"){
ammunition.push(chummerfile.characters.character.gears.gear[j]);
}
}
if(chummerfile.characters.character.weapons.weapon.length>1){
for(var i=1;i<chummerfile.characters.character.weapons.weapon.length+1 && i<=8 ;i++){
for(var i=1;i<chummerfile.characters.character.weapons.weapon.length+1 && i<9; i++){
if(chummerfile.characters.character.weapons.weapon[i-1].category!="Gear"){
if(chummerfile.characters.character.weapons.weapon[i-1].type=="Ranged"){
attributes["weaponismelee"+i]=0;
attributes["weaponrc"+i]=chummerfile.characters.character.weapons.weapon[i-1].rc-Math.ceil(chummerfile.characters.character.attributes[1].attribute[3].total/3)- 1;
if(chummerfile.characters.character.weapons.weapon[i-1].rawdamage != "undefined") {
attributes["weapondv"+i]=chummerfile.characters.character.weapons.weapon[i-1].rawdamage.match(/\d*/);
attributes["weapondmgtype"+i]=chummerfile.characters.character.weapons.weapon[i-1].rawdamage.match(^/\D*/);
attributes["weapondmgtype"+i]=chummerfile.characters.character.weapons.weapon[i-1].rawdamage.match(/\D*/);
}
else {
attributes["weapondv"+i]=chummerfile.characters.character.weapons.weapon[i-1].damage_english.match(/\d*/);
attributes["weapondmgtype"+i]=chummerfile.characters.character.weapons.weapon[i-1].damage_english.match(^/\D*/);
attributes["weapondmgtype"+i]=chummerfile.characters.character.weapons.weapon[i-1].damage_english.match(/\D*/);
}
}else{
attributes["weaponismelee"+i]="on";
attributes["weaponreach"+i]=chummerfile.characters.character.weapons.weapon[i-1].reach;
attributes["weapondv"+i]=chummerfile.characters.character.weapons.weapon[i-1].damage_english.match(/\d*/);
attributes["weapondmgtype"+i]=chummerfile.characters.character.weapons.weapon[i-1].damage_english.match(^/\D*/);
attributes["weapondmgtype"+i]=chummerfile.characters.character.weapons.weapon[i-1].damage_english.match(/\D*/);
}
attributes["weaponname"+i]=chummerfile.characters.character.weapons.weapon[i-1].name;
@@ -10319,17 +10331,17 @@ on("change:chummercheckbox", function(){
attributes["weaponrc1"]=chummerfile.characters.character.weapons.weapon.rc-Math.ceil(chummerfile.characters.character.attributes[1].attribute[3].total/3)- 1;
if(chummerfile.characters.character.weapons.weapon.rawdamage != "undefined") {
attributes["weapondv1"]=chummerfile.characters.character.weapons.weapon.rawdamage.match(/\d*/);
attributes["weapondmgtype1"]=chummerfile.characters.character.weapons.weapon.rawdamage.match(^/\D*/);
attributes["weapondmgtype1"]=chummerfile.characters.character.weapons.weapon.rawdamage.match(/\D*/);
}
else {
attributes["weapondv1"]=chummerfile.characters.character.weapons.weapon.damage_english.match(/\d*/);
attributes["weapondmgtype1"]=chummerfile.characters.character.weapons.weapon.damage_english.match(^/\D*/);
attributes["weapondmgtype1"]=chummerfile.characters.character.weapons.weapon.damage_english.match(/\D*/);
}
}else{
attributes["weaponismelee1"]="on";
attributes["weaponreach1"]=chummerfile.characters.character.weapons.weapon.reach;
attributes["weapondv1"]=chummerfile.characters.character.weapons.weapon.damage_english.match(/\d*/);
attributes["weapondmgtype1"]=chummerfile.characters.character.weapons.weapon.damage_english.match(^/\D*/);
attributes["weapondmgtype1"]=chummerfile.characters.character.weapons.weapon.damage_english.match(/\D*/);
}
attributes["weaponname1"]=chummerfile.characters.character.weapons.weapon.name;
attributes["weaponaccuracy1"]=chummerfile.characters.character.weapons.weapon.accuracy;
@@ -10448,11 +10460,12 @@ on("change:chummercheckbox", function(){
error="Error with Gear " +err
}
if(text.experimental == "on"){
//import ai programms
try {
if(text.experimental == "on"){
//import ai programs
if(chummerfile.characters.character.aiprograms != null){
console.log("import ai programs");
try {
if(chummerfile.characters.character.aiprograms.aiprogram.length > 1){
for(var i=0; i < chummerfile.characters.character.aiprograms.aiprogram.length; i++){
var newrowid=generateRowID();
@@ -10463,12 +10476,12 @@ on("change:chummercheckbox", function(){
var newrowid=generateRowID();
attributes["repeating_programs_"+newrowid+"_programname"]=chummerfile.characters.character.aiprograms.aiprogram.name;
}
}catch(err){
goodcode=false;
error="Error with AI programs " +err
}
}
}
}
}catch(err){
goodcode=false;
error="Error with AI programs " +err
}
try{
if(chummerfile.characters.character.vehicles!=null){
@@ -10709,7 +10722,7 @@ on("change:chummercheckbox", function(){
attributes["skillspec"+j]="none";
if(chummerfile.characters.character.weapons!=null){
if(chummerfile.characters.character.weapons.weapon.length>1){
for(var h=1;h<chummerfile.characters.character.weapons.weapon.length+1&&h<=6;h++){
for(var h=1;h<chummerfile.characters.character.weapons.weapon.length+1&&h<9;h++){
if(chummerfile.characters.character.weapons.weapon[h-1].category!="Gear"){
if(names[compname]==chummerfile.characters.character.weapons.weapon[h-1].skill){
attributes["weaponcategory"+h]="@{skilldicepool"+j+"}";