Commit Code
Reduced cache file by 35%-40% by removing all falsey variables and hardcoding default falsey values. Such as when an attribute (Roll20) returns undefined then a default value of 0 will be assigned.
This commit is contained in:
+124
-124
@@ -30,7 +30,7 @@
|
||||
<div class="row padt padb"><h3 class="col-1 center border"><span>Sheet Options</span></h3></div>
|
||||
<div class="row center padb">
|
||||
<div class="col-1-5 padr"><h4 class="center border"><span>Sheet Version
|
||||
<input type="text" class="center" name="attr_version" value="1.8.3" readonly />
|
||||
<input type="text" class="center" name="attr_version" value="1.8.4" readonly />
|
||||
<input type="hidden" name="attr_global_version" value="0.0.0" readonly />
|
||||
</span></h4></div>
|
||||
<div class="col-1-5 padr"><h4 class="center border"><span>Sheet Type
|
||||
@@ -2993,7 +2993,7 @@
|
||||
<input type="hidden" name="attr_customizations" readonly />
|
||||
<input type="hidden" name="attr_group" value=0 readonly />
|
||||
<input type="hidden" name="attr_source" value="" readonly />
|
||||
<input type="hidden" name="attr_new" value=1 readonly />
|
||||
<!--<input type="hidden" name="attr_new" value=1 readonly />-->
|
||||
|
||||
<div class="flex-1-13 flex-center">
|
||||
<input type="checkbox" class="border lock" name="attr_lock" value="1" /><span></span>
|
||||
@@ -7844,6 +7844,16 @@
|
||||
return (!str || str.length === 0);
|
||||
}
|
||||
|
||||
function isFalsey(v) {
|
||||
const testFalsey =
|
||||
parseInt(v) === 0 ? true :
|
||||
v === '' ? true :
|
||||
v === null ? true :
|
||||
v === undefined ? true :
|
||||
false;
|
||||
return testFalsey;
|
||||
}
|
||||
|
||||
function clog(debug, timer, text, data = '', title = '', type = 'event') {
|
||||
//types = 'info', 'event'
|
||||
//debug = 0:off, 1:info, 2:event, 3:performance
|
||||
@@ -7986,15 +7996,10 @@
|
||||
}
|
||||
|
||||
function upgradeTo_1_8_3(value, setObj) {
|
||||
/*
|
||||
const body = parseInt(value.static_stat_base_body);
|
||||
const mind = parseInt(value.static_stat_base_mind);
|
||||
const soul = parseInt(value.static_stat_base_soul);
|
||||
*/
|
||||
const statValues = [
|
||||
parseInt(value.static_stat_base_body),
|
||||
parseInt(value.static_stat_base_mind),
|
||||
parseInt(value.static_stat_base_soul)
|
||||
parseInt(value.static_stat_base_body) || 0,
|
||||
parseInt(value.static_stat_base_mind) || 0,
|
||||
parseInt(value.static_stat_base_soul) || 0
|
||||
];
|
||||
clog(2, {}, 'statValues:', statValues, 'upgradeTo_1_8_3()');
|
||||
_.each(statValues, (s, i) => {
|
||||
@@ -8017,18 +8022,18 @@
|
||||
|
||||
function setTotalLift(debug, timer, attrdb, value, setObj) {
|
||||
const size = value.static_template_size_name;
|
||||
const rank = parseInt(value.static_template_size_rank);
|
||||
const rank = parseInt(value.static_template_size_rank) || 0;
|
||||
clog(debug, timer, 'size =', size, 'setTotalLift()');
|
||||
const liftMultiplier = size === 'Medium' ? 1 :
|
||||
rank < 0 ? parseFloat(value.static_template_size_lift) :
|
||||
parseInt(value.static_template_size_lift);
|
||||
parseInt(value.static_template_size_lift) || 0;
|
||||
clog(debug, timer, 'liftMultiplier =', liftMultiplier);
|
||||
const ssdb = attrdb.superstrength;
|
||||
const hasSuperStrength = ssdb === undefined ? false :
|
||||
_.chain(ssdb).pluck('level').reduce((p,c) => { return p + c; }, 0).value();
|
||||
clog(debug, timer, 'hasSuperStrength =', hasSuperStrength);
|
||||
const strValue = isNaN(parseInt(setObj.stat_total_str)) ?
|
||||
parseInt(value.stat_total_str) : parseInt(setObj.stat_total_str);
|
||||
parseInt(value.stat_total_str) || 0 : parseInt(setObj.stat_total_str);
|
||||
const lift = hasSuperStrength ? parseInt(getSuperStrengthLift(debug, timer, hasSuperStrength)) :
|
||||
strValue * 25;
|
||||
clog(debug, timer, 'lift =', lift);
|
||||
@@ -8223,7 +8228,7 @@
|
||||
'limiterassignments',
|
||||
'lock',
|
||||
'name',
|
||||
'new',
|
||||
//'new',
|
||||
'object',
|
||||
'objects',
|
||||
'options',
|
||||
@@ -8363,10 +8368,10 @@
|
||||
const groupType = value[`static_attrgroup_${groupid}_type`] || 'Standard';
|
||||
const groupSourceID = value[`static_attrgroup_${groupid}_source`];
|
||||
const isPowerFlux = groupType.toLowerCase().indexOf('flux') !== -1 ? true : false;
|
||||
const fluxcost = parseInt(value[`repeating_attr_${groupSourceID}_totalcost`]);
|
||||
const fluxcost = parseInt(value[`repeating_attr_${groupSourceID}_totalcost`]) || 0;
|
||||
const standardgroupcost = getStandardGroupCost(debug, timer, attrIDs, value, rowID, false, groupid, setObj);
|
||||
const groupIsActive = groupSourceID !== false ?
|
||||
parseInt(value[`repeating_attr_${groupSourceID}_activate`]) :
|
||||
parseInt(value[`repeating_attr_${groupSourceID}_activate`]) || 0 :
|
||||
false;
|
||||
const aggregateAttrGroupCost =
|
||||
isPowerFlux && groupIsActive ?
|
||||
@@ -8412,7 +8417,7 @@
|
||||
const result =
|
||||
!isFlux ?
|
||||
false : //not flux group, keep running
|
||||
groupSourceID == rowID ?
|
||||
groupSourceID === rowID ?
|
||||
false : //flux group source, keep running
|
||||
isGroupActive ?
|
||||
false : //flux group is active, keep running
|
||||
@@ -8427,18 +8432,18 @@
|
||||
//const isPowerVariation = /variation/i.test(groupType);
|
||||
const isPowerVariation = groupType.toLowerCase().indexOf('variation') !== -1 ? true : false;
|
||||
const groupSourceID = value[`static_attrgroup_${groupid}_source`];
|
||||
const groupIsActive = parseInt(value[`repeating_attr_${groupSourceID}_activate`]);
|
||||
const groupIsActive = parseInt(value[`repeating_attr_${groupSourceID}_activate`]) || 0;
|
||||
clog(debug, timer, 'isPowerVariation =', isPowerVariation, 'setPoolCostIfGroupIsVariation()');
|
||||
if(!isPowerVariation || !groupIsActive){
|
||||
clog(debug, timer, 'groupIsActive =', groupIsActive);
|
||||
return;
|
||||
}
|
||||
const groupCost = parseInt(value[`repeating_attr_${groupSourceID}_totalcost`]);
|
||||
const groupCost = parseInt(value[`repeating_attr_${groupSourceID}_totalcost`]) || 0;
|
||||
const defect = value[`repeating_attr_${rowID}_attribute`];
|
||||
const isDefect = defect.indexOf(defect) !== -1 ? true : false;
|
||||
const attrcost = groupSourceID == rowID ? 0 :
|
||||
isDefect ? 0 :
|
||||
parseInt(value[`repeating_attr_${rowID}_totalcost`]);
|
||||
parseInt(value[`repeating_attr_${rowID}_totalcost`]) || 0;
|
||||
const aggregateAttrCost =
|
||||
getAggregateAttrGroupCost(debug, timer, attrIDs, value, 'attr', rowID, setObj);
|
||||
const poolcost = aggregateAttrCost - groupCost;
|
||||
@@ -8455,7 +8460,7 @@
|
||||
if(!isPowerFlux) return;
|
||||
const groupSourceID = value[`static_attrgroup_${groupid}_source`];
|
||||
clog(debug, timer, 'groupSourceID =', groupSourceID);
|
||||
const groupCost = parseInt(value[`repeating_attr_${groupSourceID}_totalcost`]);
|
||||
const groupCost = parseInt(value[`repeating_attr_${groupSourceID}_totalcost`]) || 0;
|
||||
clog(debug, timer, 'groupCost =', groupCost);
|
||||
const fluxactive = parseInt(value[`repeating_attr_${groupSourceID}_activate`]) || 0;
|
||||
clog(debug, timer, 'fluxactive =', fluxactive);
|
||||
@@ -8464,7 +8469,7 @@
|
||||
clog(debug, timer, 'isDefect =', isDefect);
|
||||
const attrcost = groupSourceID == rowID ? 0 :
|
||||
isDefect ? 0 :
|
||||
parseInt(value[`repeating_attr_${rowID}_totalcost`]);
|
||||
parseInt(value[`repeating_attr_${rowID}_totalcost`]) || 0;
|
||||
clog(debug, timer, 'attrcost =', attrcost);
|
||||
const isFluxActive = isPowerFlux && fluxactive ? true : false;
|
||||
clog(debug, timer, 'isFluxActive =', isFluxActive);
|
||||
@@ -8485,7 +8490,7 @@
|
||||
2 : 1;
|
||||
const result =
|
||||
Math.round((getAttrCostPerLevel(debug, timer, value, rowID) *
|
||||
parseInt(value[`repeating_attr_${rowID}_level`])) / isAltmunition);
|
||||
(parseInt(value[`repeating_attr_${rowID}_level`])) || 0) / isAltmunition);
|
||||
clog(debug, timer, `repeating_attr_${rowID}_totalcost =`, result, 'setAttrCost()');
|
||||
clog(debug, timer, `isWeapon =`, isWeapon);
|
||||
clog(debug, timer, `isAltmunition =`, isAltmunition);
|
||||
@@ -8506,7 +8511,7 @@
|
||||
const groupSourceID = isPowerFlux || isPowerVariation ?
|
||||
value[`static_attrgroup_${groupid}_source`] : false;
|
||||
const groupIsActive = groupSourceID !== false ?
|
||||
parseInt(value[`repeating_attr_${groupSourceID}_activate`]) :
|
||||
parseInt(value[`repeating_attr_${groupSourceID}_activate`]) || 0 :
|
||||
false;
|
||||
const isVariationPool = isPowerVariation && groupIsActive ? true : false;
|
||||
const standardgroupcost = getStandardGroupCost(debug, timer, attrIDs, value, rowID, isLevelChange, groupid, setObj, isVariationPool);
|
||||
@@ -8518,7 +8523,7 @@
|
||||
standardgroupcost;
|
||||
const poolspent =
|
||||
isPowerFlux && groupIsActive ?
|
||||
parseInt(value[`static_attrgroup_${groupid}_spent`]) :
|
||||
parseInt(value[`static_attrgroup_${groupid}_spent`]) || 0 :
|
||||
isPowerVariation && groupIsActive ?
|
||||
getPowerVariationPoolCost(debug, timer, value, standardgroupcost, groupSourceID, groupid, setObj) :
|
||||
0;
|
||||
@@ -8537,7 +8542,7 @@
|
||||
}
|
||||
|
||||
function setAttrGroupPoolSpentByActivation(debug, timer, isActive, attrIDs, value, rowID, setObj) {
|
||||
const groupid = parseInt(value[`repeating_attr_${rowID}_group`]); //getGroupID(value, 'attr');
|
||||
const groupid = parseInt(value[`repeating_attr_${rowID}_group`]) || 0; //getGroupID(value, 'attr');
|
||||
clog(debug, timer, 'groupid =', groupid, 'setAttrGroupPoolSpentByActivation()');
|
||||
const groupType =
|
||||
value[`static_attrgroup_${groupid}_type`] || 'Standard';
|
||||
@@ -8551,7 +8556,7 @@
|
||||
true : false;
|
||||
clog(debug, timer, 'isPowerVariation =', isPowerVariation);
|
||||
if (isPowerFlux || isPowerVariation) {
|
||||
const poolmax = parseInt(value[`static_attrgroup_${groupid}_groupmax`]);
|
||||
const poolmax = parseInt(value[`static_attrgroup_${groupid}_groupmax`]) || 0;
|
||||
clog(debug, timer, 'poolmax =', poolmax);
|
||||
const poolspent =
|
||||
isPowerFlux ?
|
||||
@@ -8569,7 +8574,7 @@
|
||||
_.chain(attrIDs)
|
||||
.map(id=>{
|
||||
const attribute = value[`repeating_attr_${id}_attribute`];
|
||||
const group = parseInt(value[`repeating_attr_${id}_group`]);
|
||||
const group = parseInt(value[`repeating_attr_${id}_group`]) || 0;
|
||||
const isGroupMember = group === groupid;
|
||||
if (!isGroupMember) return 0;
|
||||
const isDefect = attribute === 'defect' ? true : false;
|
||||
@@ -8580,8 +8585,8 @@
|
||||
2 : 1;
|
||||
const isCurrAttr = id === rowID ? true : false;
|
||||
const attrcost = isCurrAttr && isLevelChange ?
|
||||
parseInt(setObj[`repeating_attr_${id}_totalcost`]) * isAltmunition :
|
||||
parseInt(value[`repeating_attr_${id}_totalcost`]) * isAltmunition;
|
||||
(parseInt(setObj[`repeating_attr_${id}_totalcost`]) || 0) * isAltmunition :
|
||||
(parseInt(value[`repeating_attr_${id}_totalcost`]) || 0) * isAltmunition;
|
||||
return attrcost;
|
||||
})
|
||||
.reduce((memo, num)=>{ return memo + num; }, 0)
|
||||
@@ -8606,11 +8611,11 @@
|
||||
function getPowerFluxPoolSpent(debug, timer, isActive, attrIDs, value, rowID, groupid, setObj) {
|
||||
clog(debug, timer, 'groupid =', groupid, 'getPowerFluxPoolSpent()');
|
||||
const groupSourceID = value[`static_attrgroup_${groupid}_source`];
|
||||
const groupIsActive = parseInt(value[`repeating_attr_${groupSourceID}_activate`]);
|
||||
const groupIsActive = parseInt(value[`repeating_attr_${groupSourceID}_activate`]) || 0;
|
||||
const result = !groupIsActive ? 0 :
|
||||
_.chain(attrIDs)
|
||||
.map(id=>{
|
||||
const group = parseInt(value[`repeating_attr_${id}_group`]);
|
||||
const group = parseInt(value[`repeating_attr_${id}_group`]) || 0;
|
||||
const isGroupMember = group === groupid;
|
||||
if (!isGroupMember) return 0;
|
||||
|
||||
@@ -8635,12 +8640,12 @@
|
||||
isCurrAttr ?
|
||||
isActive :
|
||||
isNaN(parseInt(setObj[`repeating_attr_${id}_activate`])) ?
|
||||
parseInt(value[`repeating_attr_${id}_activate`]) > 0 ? true : false :
|
||||
(parseInt(value[`repeating_attr_${id}_activate`]) || 0) > 0 ? true : false :
|
||||
parseInt(setObj[`repeating_attr_${id}_activate`]) > 0 ? true : false;
|
||||
clog(debug, timer, 'isActivated =', isActivated);
|
||||
if (!isActivated) return 0;
|
||||
|
||||
const attrcost = parseInt(value[`repeating_attr_${id}_totalcost`]) * isAltmunition;
|
||||
const attrcost = (parseInt(value[`repeating_attr_${id}_totalcost`]) || 0) * isAltmunition;
|
||||
clog(debug, timer, 'attrcost =', attrcost);
|
||||
return attrcost;
|
||||
})
|
||||
@@ -8653,12 +8658,12 @@
|
||||
|
||||
function getPowerVariationPoolCost(debug, timer, isActive, attrIDs, value, rowID, groupid, setObj) {
|
||||
const groupSourceID = value[`static_attrgroup_${groupid}_source`];
|
||||
const groupIsActive = parseInt(value[`repeating_attr_${groupSourceID}_activate`]);
|
||||
const groupIsActive = parseInt(value[`repeating_attr_${groupSourceID}_activate`]) || 0;
|
||||
clog(debug, timer, 'groupid =', groupid, 'getPowerVariationPoolCost()');
|
||||
const result = !groupIsActive ? 0 :
|
||||
_.chain(attrIDs)
|
||||
.map(id=>{
|
||||
const group = parseInt(value[`repeating_attr_${id}_group`]);
|
||||
const group = parseInt(value[`repeating_attr_${id}_group`]) || 0;
|
||||
const isGroupMember = group === groupid;
|
||||
if (!isGroupMember) return 0;
|
||||
|
||||
@@ -8683,12 +8688,12 @@
|
||||
isCurrAttr ?
|
||||
isActive :
|
||||
isNaN(parseInt(setObj[`repeating_attr_${id}_activate`])) ?
|
||||
parseInt(value[`repeating_attr_${id}_activate`]) > 0 ? true : false :
|
||||
(parseInt(value[`repeating_attr_${id}_activate`]) || 0) > 0 ? true : false :
|
||||
parseInt(setObj[`repeating_attr_${id}_activate`]) > 0 ? true : false;
|
||||
clog(debug, timer, 'isActive =', isActive);
|
||||
if (!isActivated) return 0;
|
||||
|
||||
const attrcost = parseInt(value[`repeating_attr_${id}_totalcost`]) * isAltmunition;
|
||||
const attrcost = (parseInt(value[`repeating_attr_${id}_totalcost`]) || 0) * isAltmunition;
|
||||
clog(debug, timer, 'attrcost =', attrcost);
|
||||
return attrcost;
|
||||
})
|
||||
@@ -8783,8 +8788,8 @@
|
||||
const id = o.source;
|
||||
const defect = o.name;
|
||||
const defectcategory = getDefectPointsByCategory(value, id, defect);
|
||||
const group = parseInt(value[`repeating_attr_${id}_group`]);
|
||||
const defectpoints = parseInt(value[`repeating_attr_${id}_rank`]) * defectcategory;
|
||||
const group = parseInt(value[`repeating_attr_${id}_group`]) || 0;
|
||||
const defectpoints = (parseInt(value[`repeating_attr_${id}_rank`]) || 0) * defectcategory;
|
||||
const appliedPoints = group == groupid ?
|
||||
defectpoints : 0;
|
||||
return appliedPoints;
|
||||
@@ -8803,7 +8808,7 @@
|
||||
const aggregatePoolCost = _.chain(ids)
|
||||
.map(id=>{
|
||||
const isGroupMember =
|
||||
parseInt(value[`repeating_${sectionName}_${id}_group`]) == groupid ?
|
||||
(parseInt(value[`repeating_${sectionName}_${id}_group`]) || 0) == groupid ?
|
||||
true : false;
|
||||
const isDefect =
|
||||
value[`repeating_attr_${id}_attribute`] === 'defect' ?
|
||||
@@ -8816,11 +8821,11 @@
|
||||
true : false;
|
||||
const isActivated = sectionName == 'skill' ? 1 :
|
||||
isNaN(parseInt(setObj[`repeating_attr_${id}_activate`])) ?
|
||||
parseInt(value[`repeating_attr_${id}_activate`]) :
|
||||
parseInt(value[`repeating_attr_${id}_activate`]) || 0 :
|
||||
parseInt(setObj[`repeating_attr_${id}_activate`]);
|
||||
const attrcost = id == rowID ?
|
||||
parseInt(eventInfo.newValue) * getAttrCostPerLevel(debug, timer, value, rowID) :
|
||||
parseInt(value[`repeating_${sectionName}_${id}_totalcost`]);
|
||||
parseInt(value[`repeating_${sectionName}_${id}_totalcost`]) || 0;
|
||||
const appliedCost = isGroupMember ?
|
||||
isDefect ? 0 :
|
||||
isStandardGroup ? 0 :
|
||||
@@ -8846,13 +8851,13 @@
|
||||
const attribute = value[`repeating_attr_${id}_attribute`];
|
||||
clog(debug, timer, 'attribute =', attribute);
|
||||
clog(debug, timer, 'isCurrAttr =', isCurrAttr);
|
||||
const group = parseInt(value[`repeating_attr_${id}_group`]);
|
||||
const group = parseInt(value[`repeating_attr_${id}_group`]) || 0;
|
||||
clog(debug, timer, 'group =', group);
|
||||
const activated =
|
||||
parseInt(setObj[`repeating_attr_${id}_activate`]) ||
|
||||
parseInt(value[`repeating_attr_${id}_activate`]);
|
||||
parseInt(setObj[`repeating_attr_${id}_activate`]) ||
|
||||
parseInt(value[`repeating_attr_${id}_activate`]) || 0;
|
||||
clog(debug, timer, 'activated =', activated);
|
||||
const attrcost = parseInt(value[`repeating_attr_${id}_totalcost`]);
|
||||
const attrcost = parseInt(value[`repeating_attr_${id}_totalcost`]) || 0;
|
||||
clog(debug, timer, 'attrcost =', attrcost);
|
||||
const isGroupMember = group == groupid ? true : false;
|
||||
clog(debug, timer, 'isGroupMember =', isGroupMember);
|
||||
@@ -8887,9 +8892,9 @@
|
||||
function getAggregateSkillGroupCost(debug, timer, skillIDs, value, rowID, groupID, setObj){
|
||||
const result = _.chain(skillIDs)
|
||||
.map(id => {
|
||||
const group = parseInt(value[`repeating_skill_${id}_group`]);
|
||||
const group = parseInt(value[`repeating_skill_${id}_group`]) || 0;
|
||||
const totalcost = isNaN(parseInt(setObj[`repeating_skill_${id}_totalcost`])) ?
|
||||
parseInt(value[`repeating_skill_${id}_totalcost`]) :
|
||||
parseInt(value[`repeating_skill_${id}_totalcost`]) || 0 :
|
||||
parseInt(setObj[`repeating_skill_${id}_totalcost`]);
|
||||
const appliedCost = group == groupID ?
|
||||
id == rowID ? 0 :
|
||||
@@ -8915,7 +8920,7 @@
|
||||
const skillcost = getSkillCost(debug, timer, value, skillname);
|
||||
clog(debug, timer, 'skillcost =', skillcost);
|
||||
const skillrank = isNaN(parseInt(setObj[`repeating_skill_${rowID}_level`])) ?
|
||||
parseInt(value[`repeating_skill_${rowID}_level`]) :
|
||||
parseInt(value[`repeating_skill_${rowID}_level`]) || 0 :
|
||||
parseInt(setObj[`repeating_skill_${rowID}_level`]);
|
||||
clog(debug, timer, 'skillrank =', skillrank);
|
||||
const totalcost = (skillcost * skillrank) + specilizationscost;
|
||||
@@ -8944,7 +8949,7 @@
|
||||
const poolSpent = aggregatePoolCost;
|
||||
|
||||
const standardcost = aggregateAttrCost + aggregateDefectPoints + attrcost;
|
||||
const variationcost = parseInt(value[`static_attrgroup_${groupid}_groupcost`]);
|
||||
const variationcost = parseInt(value[`static_attrgroup_${groupid}_groupcost`]) || 0;
|
||||
const fluxcost = parseInt(value[`repeating_attr_${groupSourceID}_totalcost`]) || 0;
|
||||
const groupCost =
|
||||
isPowerFlux && isGroupActive ? fluxcost :
|
||||
@@ -8981,7 +8986,7 @@
|
||||
const aggregateRank = _.chain(defectdb)
|
||||
.map(defect => {
|
||||
const result = defect.name == 'shortcoming' ? defect.aspect == stat ?
|
||||
parseInt(value[`repeating_attr_${defect.source}_activate`]) > 0 ?
|
||||
(parseInt(value[`repeating_attr_${defect.source}_activate`]) || 0) > 0 ?
|
||||
defect.rank : 0 : 0 : 0;
|
||||
return result;
|
||||
})
|
||||
@@ -9108,7 +9113,7 @@
|
||||
const result = _.chain(defectdb)
|
||||
.map(defect => {
|
||||
const isActive = isNaN(parseInt(setObj[`repeating_attr_${defect.source}_activate`])) ?
|
||||
parseInt(value[`repeating_attr_${defect.source}_activate`]) :
|
||||
parseInt(value[`repeating_attr_${defect.source}_activate`]) || 0 :
|
||||
parseInt(setObj[`repeating_attr_${defect.source}_activate`]);
|
||||
const rank = defect.name == 'shortcoming' ?
|
||||
major_stats_regex.test(defect.aspect) ?
|
||||
@@ -9245,7 +9250,7 @@
|
||||
function setAttrVisibilityByGroup(value, eventInfo, attrIDs, setObj, sectionName) {
|
||||
const section = sectionName.substring(0, sectionName.length - 5);
|
||||
_.each(attrIDs, (id) => {
|
||||
const group = parseInt(value[`repeating_${section}_${id}_group`]);
|
||||
const group = parseInt(value[`repeating_${section}_${id}_group`]) || 0;
|
||||
const currGroup = eventInfo.newValue.substring(sectionName.length);
|
||||
const visible = group == currGroup ? 0 : 1;
|
||||
setObj[`repeating_${section}_${id}_visible`] = visible;
|
||||
@@ -9361,7 +9366,7 @@
|
||||
}
|
||||
|
||||
function removePoolCpFromGroupCost(value, source, setObj) {
|
||||
let type = parseInt(value[`${source}_type`]);
|
||||
let type = parseInt(value[`${source}_type`]) || 0;
|
||||
if (type < 3) {
|
||||
let groupcost = setObj[`${source}_groupcost`] - setObj[`${source}_poolcp`];
|
||||
setObj[`${source}_groupcost`] = groupcost;
|
||||
@@ -9397,7 +9402,7 @@
|
||||
type == 2 ?
|
||||
(newlevel - poolenhancement) * 5 :
|
||||
type == 3 ?
|
||||
parseInt(value[`${source}_groupmax`]) :
|
||||
parseInt(value[`${source}_groupmax`]) || 0 :
|
||||
isSkill ? newlevel * 10 : 0;
|
||||
setLevelElevation(eventInfo, `${source}`, `poollevelelevation`, setObj);
|
||||
const newgroupcost =
|
||||
@@ -9448,13 +9453,13 @@
|
||||
clog(debug, timer, 'currGroup =', currGroup);
|
||||
//setObj[`${source}_new`] = 0;
|
||||
//setObj[`${source}_group`] = currGroup;
|
||||
writeValues(debug, timer, value, `${source}_new`, 0, setObj);
|
||||
//writeValues(debug, timer, value, `${source}_new`, 0, setObj);
|
||||
writeValues(debug, timer, value, `${source}_group`, currGroup, setObj);
|
||||
}
|
||||
|
||||
function resetOnActive(debug, timer, eventInfo, value, match, rowID, setObj) {
|
||||
let activate = parseInt(value[`repeating_attr_${rowID}_activate`]),
|
||||
reset = (eventInfo.previousValue == eventInfo.newValue) ? 0 : eventInfo.previousValue;
|
||||
const activate = parseInt(value[`repeating_attr_${rowID}_activate`]) || 0;
|
||||
const reset = (eventInfo.previousValue == eventInfo.newValue) ? 0 : eventInfo.previousValue;
|
||||
if (activate) {
|
||||
clog(debug, timer, 'attribute is active, exiting', '', 'resetOnActive()');
|
||||
setObj[`${match}`] = reset;
|
||||
@@ -9466,8 +9471,8 @@
|
||||
}
|
||||
|
||||
function resetOnLocked(debug, timer, eventInfo, value, match, rowID, setObj) {
|
||||
const locked = parseInt(value[`repeating_attr_${rowID}_lock`]),
|
||||
reset = (eventInfo.previousValue == eventInfo.newValue) ? 0 : eventInfo.previousValue;
|
||||
const locked = parseInt(value[`repeating_attr_${rowID}_lock`]) || 0;
|
||||
const reset = (eventInfo.previousValue == eventInfo.newValue) ? 0 : eventInfo.previousValue;
|
||||
if (locked) {
|
||||
clog(debug, timer, 'attribute is locked, exiting', '', 'resetOnLocked()');
|
||||
setObj[`${match}`] = reset;
|
||||
@@ -9479,15 +9484,15 @@
|
||||
}
|
||||
|
||||
function getIsLocked(debug, timer, value, rowID, sourceAttr) {
|
||||
const result = parseInt(value[`repeating_attr_${rowID}_lock`]) ? true : false;
|
||||
const result = (parseInt(value[`repeating_attr_${rowID}_lock`]) || 0) ? true : false;
|
||||
clog(debug, timer, 'result =', result, 'getIsLocked()');
|
||||
return result;
|
||||
}
|
||||
|
||||
function resetOnLevelNotZero(debug, timer, eventInfo, value, match, rowID, setObj) {
|
||||
let level = parseInt(value[`repeating_attr_${rowID}_level`]),
|
||||
elevel = parseInt(value[`repeating_attr_${rowID}_effectivelevel`]),
|
||||
reset = (eventInfo.previousValue == eventInfo.newValue) ? 0 : eventInfo.previousValue;
|
||||
const level = parseInt(value[`repeating_attr_${rowID}_level`]) || 0;
|
||||
const elevel = parseInt(value[`repeating_attr_${rowID}_effectivelevel`]) || 0;
|
||||
const reset = (eventInfo.previousValue == eventInfo.newValue) ? 0 : eventInfo.previousValue;
|
||||
if (level || elevel) {
|
||||
clog(debug, timer, 'can‘t change Attribute when Level or Effective Level is greater than 0, exiting', '', 'resetOnLevelNotZero()');
|
||||
setObj[`${match}`] = reset;
|
||||
@@ -10135,8 +10140,10 @@
|
||||
}
|
||||
|
||||
function getCharacteristicByAttr(debug, timer, value, rowID, attribute, setObj) {
|
||||
const level = parseInt(setObj[`repeating_attr_${rowID}_effectivelevel`]) || parseInt(value[`repeating_attr_${rowID}_effectivelevel`]) || 0,
|
||||
chardb = {
|
||||
const level =
|
||||
parseInt(setObj[`repeating_attr_${rowID}_effectivelevel`]) ||
|
||||
parseInt(value[`repeating_attr_${rowID}_effectivelevel`]) || 0;
|
||||
const chardb = {
|
||||
"capacity": {
|
||||
0: {
|
||||
1: "200 kg",
|
||||
@@ -10955,7 +10962,7 @@
|
||||
const layer = attr == `armor` ?
|
||||
parseInt(value[`repeating_attr_${rowID}_armorlayer`]) || 1 : '';
|
||||
const type = (attr == `absorption` || attr == `conversion`) ?
|
||||
parseInt(value[`repeating_attr_${rowID}_collectiontype`]) : '';
|
||||
parseInt(value[`repeating_attr_${rowID}_collectiontype`]) || 0 : '';
|
||||
const attrstate =
|
||||
parseInt(value[`protection_${attr}${layer}${type}_state`]) || 0;
|
||||
const source =
|
||||
@@ -11156,7 +11163,7 @@
|
||||
clog(debug, timer, 'rowID =', rowID, 'getIsTargetedActive()');
|
||||
const isTargeted = getIsTargeted(debug, timer, value, rowID, setObj);
|
||||
if (!isTargeted) return '';
|
||||
const activeID = parseInt(value[`repeating_attr_${rowID}_activate`]) === 1 ?
|
||||
const activeID = (parseInt(value[`repeating_attr_${rowID}_activate`]) || 0) === 1 ?
|
||||
rowID : '';
|
||||
clog(debug, timer, 'activeID =', activeID);
|
||||
clog(debug, timer, 'activate =', value[`repeating_attr_${rowID}_activate`]);
|
||||
@@ -11470,7 +11477,7 @@
|
||||
clog(debug, timer, 'result =', result, 'getIsMelee()');
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
function getAttackMod(debug, timer, value, attrIDs, wpnclass, sourceAttr) {
|
||||
var result = 0,
|
||||
ismelee = getIsMelee(debug, timer, wpnclass);
|
||||
@@ -11485,7 +11492,7 @@
|
||||
clog(debug, timer, 'result =', result, 'getAttackMod()');
|
||||
return result;
|
||||
}
|
||||
|
||||
*/
|
||||
function getSumOfActiveAttrLevels(attrdb, attribute, focus = '') {
|
||||
var result = 0;
|
||||
_.each(attrdb[`${attribute}`], (o) => {
|
||||
@@ -11526,7 +11533,7 @@
|
||||
|
||||
function updateWeaponStates(debug, timer, attrdb, extraarmIDs, value, source, sourceAttr, setObj){
|
||||
const handsource = getHandSource(debug, timer, extraarmIDs, source);
|
||||
const state = parseInt(value[`${handsource}_state`]);
|
||||
const state = parseInt(value[`${handsource}_state`]) || 0;
|
||||
clog(debug, timer, 'state =', state, 'updateWeaponStates()');
|
||||
if(state > 0) {
|
||||
setWeaponStates(debug, timer, extraarmIDs, value, handsource, setObj);
|
||||
@@ -11779,7 +11786,7 @@
|
||||
|
||||
function setAttrEffects(debug, timer, isActive, value, attrdb, extraarmIDs, attrIDs, skillIDs, sectionName, rowID, sourceAttr, setObj) {
|
||||
const attribute = removeWhiteSpace(value[`repeating_attr_${rowID}_attribute`]);
|
||||
const level = parseInt(value[`repeating_attr_${rowID}_effectivelevel`]);
|
||||
const level = parseInt(value[`repeating_attr_${rowID}_effectivelevel`]) || 0;
|
||||
switch (attribute) {
|
||||
case "absorption":
|
||||
case "armor":
|
||||
@@ -11928,11 +11935,11 @@
|
||||
|
||||
function setSwarmCritters(isActive, debug, timer, value, attrdb, rowID, setObj){
|
||||
const debugtext = '[setSwarmCritters()]';
|
||||
const body = parseInt(value.stat_total_body);
|
||||
const soul = parseInt(value.stat_total_soul);
|
||||
const body = parseInt(value.stat_total_body) || 0;
|
||||
const soul = parseInt(value.stat_total_soul) || 0;
|
||||
const health = (body+soul)*5;
|
||||
const wounds = parseInt(value.static_stat_total_wounds) || 0;
|
||||
const level = parseInt(value[`repeating_attr_${rowID}_effectivelevel`]);
|
||||
const level = parseInt(value[`repeating_attr_${rowID}_effectivelevel`]) || 0;
|
||||
const critters = isActive ? health * level : 0;
|
||||
let swarmobj = _.find(attrdb.swarm, o => {
|
||||
if(o.source == rowID) return true;
|
||||
@@ -12001,15 +12008,15 @@
|
||||
const groupCost = _.chain(attrIDs)
|
||||
.map(id=>{
|
||||
id = id.toLowerCase();
|
||||
const group = parseInt(value[`repeating_attr_${id}_group`]);
|
||||
const group = parseInt(value[`repeating_attr_${id}_group`]) || 0;
|
||||
const activated = parseInt(setObj[`repeating_attr_${id}_activate`]) ||
|
||||
parseInt(value[`repeating_attr_${id}_activate`]);
|
||||
parseInt(value[`repeating_attr_${id}_activate`]) || 0;
|
||||
const attribute = value[`repeating_attr_${id}_attribute`];
|
||||
const isWeapon = attribute === 'weapon' ? true : false;
|
||||
const isAltmunition = isWeapon &&
|
||||
getCustomizationExists('altmunition', value[`repeating_attr_${id}_customizations`]) ?
|
||||
2 : 1;
|
||||
const totalcost = parseInt(value[`repeating_attr_${id}_totalcost`]) * isAltmunition;
|
||||
const totalcost = (parseInt(value[`repeating_attr_${id}_totalcost`]) || 0) * isAltmunition;
|
||||
const appliedCost = group == groupid ?
|
||||
id == rowID ? 0 :
|
||||
///flux/i.test(groupType) ? activated ? totalcost : 0 :
|
||||
@@ -12021,7 +12028,7 @@
|
||||
.value();
|
||||
const max = //isActive ? /flux/i.test(groupType) ?
|
||||
isActive && groupType.toLowerCase().indexOf('flux') !== -1 ?
|
||||
parseInt(value[`repeating_${sectionName}_${rowID}_effectivelevel`]) * 5 :
|
||||
(parseInt(value[`repeating_${sectionName}_${rowID}_effectivelevel`]) || 0) * 5 :
|
||||
///variation/i.test(groupType) ? groupCost : 0 : 0;
|
||||
isActive && groupType.toLowerCase().indexOf('variation') !== -1 ?
|
||||
groupCost : 0;
|
||||
@@ -12032,13 +12039,13 @@
|
||||
function convertAttrGroupCost(isActive, debug, timer, value, sectionName, attrIDs, rowID, setObj){
|
||||
const groupid = getGroupID(value, sectionName);
|
||||
const groupType = value[`static_${sectionName}group_${groupid}_type`];
|
||||
const dynamicGroupCost = parseInt(value[`repeating_${sectionName}_${rowID}_totalcost`]);
|
||||
const dynamicGroupCost = parseInt(value[`repeating_${sectionName}_${rowID}_totalcost`]) || 0;
|
||||
const aggregateAttrCost = _.chain(attrIDs)
|
||||
.map(id=>{
|
||||
const group = parseInt(value[`repeating_${sectionName}_${id}_group`]);
|
||||
const group = parseInt(value[`repeating_${sectionName}_${id}_group`]) || 0;
|
||||
const activated = parseInt(setObj[`repeating_${sectionName}_${id}_activate`]) ||
|
||||
parseInt(value[`repeating_${sectionName}_${id}_activate`]);
|
||||
const totalcost = parseInt(value[`repeating_${sectionName}_${id}_totalcost`]);
|
||||
parseInt(value[`repeating_${sectionName}_${id}_activate`]) || 0;
|
||||
const totalcost = parseInt(value[`repeating_${sectionName}_${id}_totalcost`]) || 0;
|
||||
const appliedCost = //group == groupid ?
|
||||
///flux/i.test(groupType) ?
|
||||
group == groupid && groupType.toLowerCase().indexOf('flux') !== -1 ?
|
||||
@@ -12092,9 +12099,9 @@
|
||||
function setSkillGroupMaxByLevelChange(isActive, timer, debug, value, rowID, setObj){
|
||||
const isSkillAttr = attribute => attribute=='skill' ? true: false;
|
||||
if(isSkillAttr(value[`repeating_attr_${rowID}_attribute`])==false) return;
|
||||
const groupid = parseInt(value[`repeating_attr_${rowID}_skillgroup`]);
|
||||
const groupid = parseInt(value[`repeating_attr_${rowID}_skillgroup`]) || 0;
|
||||
const skillpointmax = isActive ?
|
||||
parseInt(value[`repeating_attr_${rowID}_effectivelevel`]) * 10 : 0;
|
||||
(parseInt(value[`repeating_attr_${rowID}_effectivelevel`]) || 0) * 10 : 0;
|
||||
setObj[`static_skillgroup_${groupid}_groupmax`] = skillpointmax;
|
||||
clog(debug, timer, 'groupid =', groupid, 'setSkillGroupMaxByLevelChange()');
|
||||
clog(debug, timer, 'skillpointmax =', skillpointmax);
|
||||
@@ -12300,11 +12307,11 @@
|
||||
const state =
|
||||
(type == 'acv') ?
|
||||
isNaN(parseInt(setObj.static_button_targeted_attack)) ?
|
||||
parseInt(value.static_button_targeted_attack) :
|
||||
parseInt(value.static_button_targeted_attack) || 0 :
|
||||
parseInt(setObj.static_button_targeted_attack) :
|
||||
(type == 'dcv') ?
|
||||
isNaN(parseInt(setObj.static_button_targeted_defense)) ?
|
||||
parseInt(value.static_button_targeted_defense) :
|
||||
parseInt(value.static_button_targeted_defense) || 0 :
|
||||
parseInt(setObj.static_button_targeted_defense) :
|
||||
0;
|
||||
clog(debug, timer, 'state =', state);
|
||||
@@ -12330,8 +12337,8 @@
|
||||
const cv =
|
||||
Math.round((parseInt(setObj.stat_total_body) + parseInt(setObj.stat_total_mind) +
|
||||
parseInt(setObj.stat_total_soul)) / 3) ||
|
||||
Math.round((parseInt(value.stat_total_body) + parseInt(value.stat_total_mind) +
|
||||
parseInt(value.stat_total_soul)) / 3) ||
|
||||
Math.round(((parseInt(value.stat_total_body) || 0) + (parseInt(value.stat_total_mind) || 0) +
|
||||
(parseInt(value.stat_total_soul) || 0)) / 3) ||
|
||||
0;
|
||||
clog(debug, timer, 'cv =', cv);
|
||||
const result =
|
||||
@@ -12463,8 +12470,8 @@
|
||||
|
||||
function setWeaponReload(debug, timer, attrdb, value, setObj) {
|
||||
const rowID = value.active_weapon;
|
||||
const capacity = parseInt(value[`repeating_attr_${rowID}_capacity`]);
|
||||
let ammostate = parseInt(value.weapon_ammo_reloads);
|
||||
const capacity = parseInt(value[`repeating_attr_${rowID}_capacity`]) || 0;
|
||||
let ammostate = parseInt(value.weapon_ammo_reloads) || 0;
|
||||
const reloadcapacity = ammostate > 0 ? capacity : 0;
|
||||
const reloadammo = ammostate > 0 ? ammostate -= 1 : 0;
|
||||
writeValues(debug, timer, value, 'weapon_ammo_reloads', reloadammo, setObj);
|
||||
@@ -12477,8 +12484,8 @@
|
||||
const state = setObj[`${handsource}_state`];
|
||||
const rowID = value[`${handsource}_source`];
|
||||
const type = value[`repeating_attr_${rowID}_attribute`];
|
||||
const ammostate = parseInt(value.weapon_ammo_reloads);
|
||||
const capacitystate = parseInt(value.weapon_ammo_capacity);
|
||||
const ammostate = parseInt(value.weapon_ammo_reloads) || 0;
|
||||
const capacitystate = parseInt(value.weapon_ammo_capacity) || 0;
|
||||
clog(debug, timer, 'ammostate =', ammostate, 'setWeaponAmmo()');
|
||||
clog(debug, timer, 'capacitystate =', capacitystate);
|
||||
if (rowID !== setObj.previous_weapon && _.isString(setObj.previous_weapon)) {
|
||||
@@ -12499,17 +12506,15 @@
|
||||
if (!getIsObject(customization)) return;
|
||||
const ammo = isNaN(parseInt(value[`repeating_attr_${rowID}_ammostate`])) ?
|
||||
getAmmoMax(debug, timer, customization.rank) :
|
||||
parseInt(value[`repeating_attr_${rowID}_ammostate`]);
|
||||
parseInt(value[`repeating_attr_${rowID}_ammostate`]) || 0;
|
||||
const capacity = isNaN(parseInt(value[`repeating_attr_${rowID}_capacitystate`])) ?
|
||||
0 :
|
||||
parseInt(value[`repeating_attr_${rowID}_capacitystate`]);
|
||||
parseInt(value[`repeating_attr_${rowID}_capacitystate`]) || 0;
|
||||
writeValues(debug, timer, value, 'weapon_ammo_reloads', ammo, setObj);
|
||||
writeValues(debug, timer, value, 'weapon_ammo_capacity', capacity, setObj);
|
||||
clog(debug, timer, 'ammo =', ammo, 'setWeaponAmmo()');
|
||||
clog(debug, timer, 'capacity =', capacity);
|
||||
} else if (rowID.length === 20) {//weapon unarmed, save ammo state
|
||||
//const ammostate = parseInt(value.weapon_ammo_reloads);
|
||||
//const capacitystate = parseInt(value.weapon_ammo_capacity);
|
||||
clog(debug, timer, 'weapon unarmed, save ammo state', '');
|
||||
writeValues(debug, timer, value, `repeating_attr_${rowID}_ammostate`, ammostate, setObj);
|
||||
writeValues(debug, timer, value, `repeating_attr_${rowID}_capacitystate`, capacitystate, setObj);
|
||||
@@ -13075,7 +13080,7 @@
|
||||
targetedmdState ? targetedmdLevel : 0;
|
||||
const rushattackState =
|
||||
isNaN(parseInt(setObj.static_button_targeted_rushdamage)) ?
|
||||
parseInt(value.static_button_targeted_rushdamage) :
|
||||
parseInt(value.static_button_targeted_rushdamage) || 0 :
|
||||
parseInt(setObj.static_button_targeted_rushdamage);
|
||||
const rushattackLevel =
|
||||
//getRushAttack(debug, attrdb);
|
||||
@@ -13161,7 +13166,7 @@
|
||||
break;
|
||||
case 'autofire':
|
||||
const firemode = parseInt(setObj[`static_weapon_autofire_selection`]) ||
|
||||
parseInt(value[`static_weapon_autofire_selection`]);
|
||||
parseInt(value[`static_weapon_autofire_selection`]) || 1;
|
||||
const numhits = firemode == 1 ?
|
||||
`{{hits2=1}} {{hits3=1}} {{hits4=1}} {{hits5=1}} {{hits6=1}} {{hits7=1}} {{hits8=1}} {{hits9=1}} {{hits10=1}} {{hits11=1}} {{hits12=1}}` :
|
||||
firemode == 3 ?
|
||||
@@ -13278,7 +13283,7 @@
|
||||
result = `${result} {{${customization.name}=${customization.rank}}} {{range=${range}}}`;
|
||||
break;
|
||||
case 'stoppable':
|
||||
const stopdamage = parseInt(value[`repeating_attr_${rowID}_level`]) * 10;
|
||||
const stopdamage = (parseInt(value[`repeating_attr_${rowID}_level`]) || 0) * 10;
|
||||
const timetostop = customization.rank > 3 ? '1 hour' :
|
||||
customization.rank > 2 ? '1 minute' :
|
||||
customization.rank > 1 ? '5 rounds' :
|
||||
@@ -13385,7 +13390,7 @@
|
||||
setObj.weapon_ammo = 0;
|
||||
setObj.weapon_autofire = 0;
|
||||
const state = parseInt(setObj[`repeating_attr_${rowID}_activate`]) ||
|
||||
parseInt(value[`repeating_attr_${rowID}_activate`]);
|
||||
parseInt(value[`repeating_attr_${rowID}_activate`]) || 0;
|
||||
clog(debug, timer, 'state =', state, 'disableActiveWeapon()');
|
||||
clog(debug, timer, 'activeweapon =', activeweapon);
|
||||
if (!state) return;
|
||||
@@ -13395,7 +13400,7 @@
|
||||
}
|
||||
|
||||
function setButtonState(debug, timer, value, source, rowID, sourceAttr, setObj) {
|
||||
const theme = parseInt(value.theme);
|
||||
const theme = parseInt(value.theme) || 1;
|
||||
const attribute = sourceAttr;
|
||||
const setstate = value[`${source}_${attribute}`] || 0;
|
||||
const state = setstate == 0 ? 1 : 0;
|
||||
@@ -13446,7 +13451,7 @@
|
||||
const handsStateArray =
|
||||
_.map(handsArray, hand => {
|
||||
const source = setObj[`${hand}_source`] || value[`${hand}_source`];
|
||||
const state = parseInt(setObj[`${hand}_state`]) || parseInt(value[`${hand}_state`]);
|
||||
const state = parseInt(setObj[`${hand}_state`]) || parseInt(value[`${hand}_state`]) || 0;
|
||||
const isExtraArm = extraarmIDs.indexOf(hand) !== -1 ? true : false;
|
||||
const extraArmType = parseInt(value[`${hand}_type`]) || false;
|
||||
const isWeaponMount = isExtraArm && extraArmType === 0 ? true : false;
|
||||
@@ -13485,7 +13490,7 @@
|
||||
}
|
||||
|
||||
function setDepleteRules(debug, timer, value, attrIDs, setObj) {
|
||||
const state = parseInt(value.static_rules_deplete_alt) == 1 ?
|
||||
const state = (parseInt(value.static_rules_deplete_alt) || 0) == 1 ?
|
||||
1 : 0;
|
||||
if (_.isArray(attrIDs)) {
|
||||
_.each(attrIDs, id => {
|
||||
@@ -13499,7 +13504,7 @@
|
||||
|
||||
function setDepleteResurvation(debug, timer, attrdb, value, rowID, setObj) {
|
||||
const depleteRank = getCustomizationValue(debug, timer, value, rowID, 'rank', 'deplete');
|
||||
const useDepleteAltRules = parseInt(value.static_rules_deplete_alt);
|
||||
const useDepleteAltRules = (parseInt(value.static_rules_deplete_alt) || 0);
|
||||
if (!depleteRank && !useDepleteAltRules) return;
|
||||
const totalDepete = _.chain(all_attributes_array)
|
||||
.map( a => {
|
||||
@@ -13667,7 +13672,7 @@
|
||||
const skillStatButtonState = button =>
|
||||
allaspects_stats_array.indexOf(button) !== -1 ||
|
||||
major_stats_array.indexOf(button) !== -1 ?
|
||||
parseInt(value[`${match}state`]) > 0 ?
|
||||
(parseInt(value[`${match}state`]) || 0) > 0 ?
|
||||
setObj[`${match}state`] = 0 :
|
||||
setObj[`${match}state`] = 1 :
|
||||
false;
|
||||
@@ -13681,7 +13686,7 @@
|
||||
sourceAttr;
|
||||
const setButtonState = button => button == 'stat' || button == 'type' ||
|
||||
button.length == 20 ?
|
||||
parseInt(value[`${source}state`]) > 0 ?
|
||||
(parseInt(value[`${source}state`]) || 0) > 0 ?
|
||||
setObj[`${source}state`] = 0 :
|
||||
setObj[`${source}state`] = 1 :
|
||||
false;
|
||||
@@ -13702,7 +13707,7 @@
|
||||
(specilizations.match(/,/g) || []).length;
|
||||
const skillname = value[`repeating_skill_${rowID}_name`];
|
||||
const skillcost = getSkillCost(debug, timer, value, skillname);
|
||||
const skillrank = parseInt(value[`repeating_skill_${rowID}_level`]);
|
||||
const skillrank = parseInt(value[`repeating_skill_${rowID}_level`]) || 0;
|
||||
const totalcost = (skillcost * skillrank) + specilizationscost;
|
||||
const groupid = getGroupID(value, 'skill');
|
||||
const spent = getAggregateSkillGroupCost(debug, timer, skillIDs, value, rowID, groupid, setObj);
|
||||
@@ -13712,7 +13717,7 @@
|
||||
|
||||
function setSkillGroupCost(value, sectionName, cost, setObj){
|
||||
const groupID = getGroupID(value, sectionName);
|
||||
const groupcost = parseInt(value[`static_skillgroup_${groupID}_groupcost`]);
|
||||
const groupcost = parseInt(value[`static_skillgroup_${groupID}_groupcost`]) || 0;
|
||||
setObj[`static_skillgroup_${groupID}_groupcost`] = groupcost + cost;
|
||||
}
|
||||
|
||||
@@ -13743,7 +13748,7 @@
|
||||
const stats = type.major==1 ? statmajor: statallaspect;
|
||||
const sum = _.chain(stats)
|
||||
.map(stat=>{
|
||||
return parseInt(value[`stat_total_${stat}`]);
|
||||
return parseInt(value[`stat_total_${stat}`]) || 0;
|
||||
})
|
||||
.reduce((memo,stat)=>{
|
||||
return memo + stat;
|
||||
@@ -13981,7 +13986,8 @@
|
||||
sheetdb.extraarmIDs = extraarmIDs;
|
||||
|
||||
_.each(getAttrsString, o => {
|
||||
if(value[o] !== undefined) sheetdb[o] = value[o];
|
||||
//if(value[o] !== undefined) sheetdb[o] = value[o];
|
||||
if(!isFalsey(value[o])) sheetdb[o] = value[o];
|
||||
});
|
||||
clog(3, timer, 'value:', value);
|
||||
|
||||
@@ -14128,8 +14134,10 @@
|
||||
|
||||
switch (sectionName) {
|
||||
case `attr`:
|
||||
const isNew = parseInt(value[`${source}_new`]) === 0 ? false : true;
|
||||
clog(debug, timer, `${source}_new =`, value[`${source}_new`], 'Attribute is new?');
|
||||
//const isNew = parseInt(value[`${source}_new`]) === 0 ? false : true;
|
||||
const group = parseInt(value[`${source}_group`]) || 0;
|
||||
const isNew = group !== 0 ? false : true;
|
||||
clog(debug, timer, `isNew =`, isNew, 'Attribute is new?');
|
||||
if(isNew) {
|
||||
setGroupMembership(debug, timer, value, setObj, source, sectionName);
|
||||
attrIDs.indexOf(rowID) === -1 ? attrIDs.push(rowID) : false;
|
||||
@@ -14137,13 +14145,6 @@
|
||||
}
|
||||
if(getIsSheetworker(eventInfo.sourceType)) return;
|
||||
switch (sourceAttr) {
|
||||
/*
|
||||
case `options`:
|
||||
if (resetOnLocked(debug, timer, eventInfo, value, match, rowID, setObj)) return;
|
||||
const state = parseInt(value[`${source}_${sourceAttr}`]) > 0 ? 0: 1;
|
||||
setObj[`${source}_${sourceAttr}`] = state;
|
||||
break;
|
||||
*/
|
||||
case `attribute`:
|
||||
if (resetOnLocked(debug, timer, eventInfo, value, match, rowID, setObj)) return;
|
||||
if (resetOnLevelNotZero(debug, timer, eventInfo, value, match, rowID, setObj)) return;
|
||||
@@ -14172,7 +14173,7 @@
|
||||
if (getFluxGroupIsNotActive(debug, timer, value, rowID)) return;
|
||||
const isActive = setButtonState(debug, timer, value, source, rowID, sourceAttr, setObj);
|
||||
const handsource = getHandSource(debug, timer, extraarmIDs, value[`repeating_attr_${rowID}_source`]);
|
||||
const handstate = handsource !== false ? parseInt(value[`${handsource}_state`]) : false;
|
||||
const handstate = handsource !== false ? parseInt(value[`${handsource}_state`]) || 0 : false;
|
||||
setAttrEffects(debug, timer, isActive, value, attrdb, extraarmIDs, attrIDs, skillIDs, sectionName, rowID, sourceAttr, setObj);
|
||||
//setPoolCostIfGroupIsFlux(debug, timer, attrIDs, value, rowID, setObj);
|
||||
setAttrGroupPoolSpentByActivation(debug, timer, isActive, attrIDs, value, rowID, setObj);
|
||||
@@ -14240,8 +14241,7 @@
|
||||
break;
|
||||
case 'statselection':
|
||||
case 'option':
|
||||
const state = parseInt(value[`${source}_${sourceAttr}`]) > 0 ? 0: 1;
|
||||
//setObj[`${source}_${sourceAttr}`] = state;
|
||||
const state = (parseInt(value[`${source}_${sourceAttr}`]) || 0) > 0 ? 0 : 1;
|
||||
writeValues(debug, timer, value, `${source}_${sourceAttr}`, state, setObj);
|
||||
break;
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user