From ff39830a1276292d1ebebc17de6ad742fb838a62 Mon Sep 17 00:00:00 2001 From: lowercasedonkey <lowercasedonkey@gmail.com> Date: Wed, 5 Aug 2020 18:01:42 -0400 Subject: [PATCH] move bc to function --- src/Mods/SecExp/js/secExpBC.js | 97 ++++++++++++++++++---------------- 1 file changed, 50 insertions(+), 47 deletions(-) diff --git a/src/Mods/SecExp/js/secExpBC.js b/src/Mods/SecExp/js/secExpBC.js index 79c59a1e7ce..58da0081b59 100644 --- a/src/Mods/SecExp/js/secExpBC.js +++ b/src/Mods/SecExp/js/secExpBC.js @@ -11,59 +11,14 @@ App.SecExp.generalBC = function (){ } V.SecExp = V.SecExp || SecExpBase(); - // Edicts - V.SecExp.edicts = V.SecExp.edicts || {}; - V.SecExp.edicts.alternativeRents = V.SecExp.edicts.alternativeRents || V.alternativeRents || 0; - V.SecExp.edicts.enslavementRights = V.SecExp.edicts.enslavementRights || V.enslavementRights || 0; - V.SecExp.edicts.sellData = V.SecExp.edicts.sellData || V.sellData || 0; - V.SecExp.edicts.propCampaignBoost = V.SecExp.edicts.propCampaignBoost || V.propCampaignBoost || 0; - V.SecExp.edicts.tradeLegalAid = V.SecExp.edicts.tradeLegalAid || V.tradeLegalAid || 0; - V.SecExp.edicts.taxTrade = V.SecExp.edicts.taxTrade || V.taxTrade || 0; - V.SecExp.edicts.slaveWatch = V.SecExp.edicts.slaveWatch || V.slaveWatch || 0; - V.SecExp.edicts.subsidyChurch = V.SecExp.edicts.subsidyChurch || V.subsidyChurch || 0; - V.SecExp.edicts.SFSupportLevel = V.SecExp.edicts.SFSupportLevel || V.SFSupportLevel || 0; - V.SecExp.edicts.limitImmigration = V.SecExp.edicts.limitImmigration || V.limitImmigration || 0; - V.SecExp.edicts.openBorders = V.SecExp.edicts.openBorders || V.openBorders || 0; - V.SecExp.edicts.weaponsLaw = V.SecExp.edicts.weaponsLaw || V.weaponsLaw || 3; - - V.SecExp.edicts.defense = V.SecExp.edicts.defense || {}; - V.SecExp.edicts.defense.soldierWages = V.SecExp.edicts.defense.soldierWages || V.soldierWages || 1; - V.SecExp.edicts.defense.slavesOfficers = V.SecExp.edicts.defense.slavesOfficers || V.slavesOfficers || 0; - V.SecExp.edicts.defense.discountMercenaries = V.SecExp.edicts.defense.discountMercenaries || V.discountMercenaries || 0; - V.SecExp.edicts.defense.militiaFounded = V.SecExp.edicts.defense.militiaFounded || V.militiaFounded || 0; - V.SecExp.edicts.defense.recruitVolunteers = V.SecExp.edicts.defense.recruitVolunteers || V.recruitVolunteers || 0; - V.SecExp.edicts.defense.conscription = V.SecExp.edicts.defense.conscription || V.conscription || 0; - V.SecExp.edicts.defense.militaryService = V.SecExp.edicts.defense.militaryService || V.militaryService || 0; - V.SecExp.edicts.defense.militarizedSociety = V.SecExp.edicts.defense.militarizedSociety || V.militarizedSociety || 0; - V.SecExp.edicts.defense.militaryExemption = V.SecExp.edicts.defense.militaryExemption || V.militaryExemption || 0; - V.SecExp.edicts.defense.noSubhumansInArmy = V.SecExp.edicts.defense.noSubhumansInArmy || V.noSubhumansInArmy || 0; - V.SecExp.edicts.defense.pregExemption = V.SecExp.edicts.defense.pregExemption || V.pregExemption || 0; - V.SecExp.edicts.defense.liveTargets = V.SecExp.edicts.defense.liveTargets || V.liveTargets || 0; - V.SecExp.edicts.defense.pregExemption = V.SecExp.edicts.defense.pregExemption || V.pregExemption || 0; - - // Units - V.SecExp.edicts.defense.martialSchool = V.SecExp.edicts.defense.martialSchool || V.martialSchool || 0; - V.SecExp.edicts.defense.eliteOfficers = V.SecExp.edicts.defense.eliteOfficers || V.eliteOfficers || 0; - V.SecExp.edicts.defense.lowerRequirements = V.SecExp.edicts.defense.lowerRequirements || V.lowerRequirements|| V.lowerRquirements || 0; - V.SecExp.edicts.defense.legionTradition = V.SecExp.edicts.defense.legionTradition || V.legionTradition || 0; - V.SecExp.edicts.defense.eagleWarriors = V.SecExp.edicts.defense.eagleWarriors || V.eagleWarriors || 0; - V.SecExp.edicts.defense.ronin = V.SecExp.edicts.defense.ronin || V.ronin || 0; - V.SecExp.edicts.defense.sunTzu = V.SecExp.edicts.defense.sunTzu || V.sunTzu || 0; - V.SecExp.edicts.defense.mamluks = V.SecExp.edicts.defense.mamluks || V.mamluks || 0; - V.SecExp.edicts.defense.pharaonTradition = V.SecExp.edicts.defense.pharaonTradition || V.pharaonTradition || 0; - - // Priv - V.SecExp.edicts.defense.privilege = V.SecExp.edicts.defense.privilege || {}; - V.SecExp.edicts.defense.privilege.militiaSoldier = V.SecExp.edicts.defense.privilege.militiaSoldier || V.militiaSoldier || 0; - V.SecExp.edicts.defense.privilege.slaveSoldier = V.SecExp.edicts.defense.privilege.slaveSoldier || V.slaveSoldier || 0; - V.SecExp.edicts.defense.privilege.mercSoldier = V.SecExp.edicts.defense.privilege.mercSoldier || V.mercSoldier || 0; - V.SecExp.settings = V.SecExp.settings || {}; delete V.SecExp.settings.show; delete V.SecExp.army; if (V.secExpEnabled > 0) { + checkEdicts(); + Object.assign(V.secBots, { active: V.secBots.active || V.arcologyUpgrade.drones > 0 ? 1 : 0, ID: -1, @@ -288,4 +243,52 @@ App.SecExp.generalBC = function (){ if (jsDef(V.SecExp.core)) { delete V.SecExp.core.crimeCap; } + function checkEdicts() { + // Edicts + V.SecExp.edicts = V.SecExp.edicts || {}; + V.SecExp.edicts.alternativeRents = V.SecExp.edicts.alternativeRents || V.alternativeRents || 0; + V.SecExp.edicts.enslavementRights = V.SecExp.edicts.enslavementRights || V.enslavementRights || 0; + V.SecExp.edicts.sellData = V.SecExp.edicts.sellData || V.sellData || 0; + V.SecExp.edicts.propCampaignBoost = V.SecExp.edicts.propCampaignBoost || V.propCampaignBoost || 0; + V.SecExp.edicts.tradeLegalAid = V.SecExp.edicts.tradeLegalAid || V.tradeLegalAid || 0; + V.SecExp.edicts.taxTrade = V.SecExp.edicts.taxTrade || V.taxTrade || 0; + V.SecExp.edicts.slaveWatch = V.SecExp.edicts.slaveWatch || V.slaveWatch || 0; + V.SecExp.edicts.subsidyChurch = V.SecExp.edicts.subsidyChurch || V.subsidyChurch || 0; + V.SecExp.edicts.SFSupportLevel = V.SecExp.edicts.SFSupportLevel || V.SFSupportLevel || 0; + V.SecExp.edicts.limitImmigration = V.SecExp.edicts.limitImmigration || V.limitImmigration || 0; + V.SecExp.edicts.openBorders = V.SecExp.edicts.openBorders || V.openBorders || 0; + V.SecExp.edicts.weaponsLaw = V.SecExp.edicts.weaponsLaw || V.weaponsLaw || 3; + + V.SecExp.edicts.defense = V.SecExp.edicts.defense || {}; + V.SecExp.edicts.defense.soldierWages = V.SecExp.edicts.defense.soldierWages || V.soldierWages || 1; + V.SecExp.edicts.defense.slavesOfficers = V.SecExp.edicts.defense.slavesOfficers || V.slavesOfficers || 0; + V.SecExp.edicts.defense.discountMercenaries = V.SecExp.edicts.defense.discountMercenaries || V.discountMercenaries || 0; + V.SecExp.edicts.defense.militiaFounded = V.SecExp.edicts.defense.militiaFounded || V.militiaFounded || 0; + V.SecExp.edicts.defense.recruitVolunteers = V.SecExp.edicts.defense.recruitVolunteers || V.recruitVolunteers || 0; + V.SecExp.edicts.defense.conscription = V.SecExp.edicts.defense.conscription || V.conscription || 0; + V.SecExp.edicts.defense.militaryService = V.SecExp.edicts.defense.militaryService || V.militaryService || 0; + V.SecExp.edicts.defense.militarizedSociety = V.SecExp.edicts.defense.militarizedSociety || V.militarizedSociety || 0; + V.SecExp.edicts.defense.militaryExemption = V.SecExp.edicts.defense.militaryExemption || V.militaryExemption || 0; + V.SecExp.edicts.defense.noSubhumansInArmy = V.SecExp.edicts.defense.noSubhumansInArmy || V.noSubhumansInArmy || 0; + V.SecExp.edicts.defense.pregExemption = V.SecExp.edicts.defense.pregExemption || V.pregExemption || 0; + V.SecExp.edicts.defense.liveTargets = V.SecExp.edicts.defense.liveTargets || V.liveTargets || 0; + V.SecExp.edicts.defense.pregExemption = V.SecExp.edicts.defense.pregExemption || V.pregExemption || 0; + + // Units + V.SecExp.edicts.defense.martialSchool = V.SecExp.edicts.defense.martialSchool || V.martialSchool || 0; + V.SecExp.edicts.defense.eliteOfficers = V.SecExp.edicts.defense.eliteOfficers || V.eliteOfficers || 0; + V.SecExp.edicts.defense.lowerRequirements = V.SecExp.edicts.defense.lowerRequirements || V.lowerRequirements|| V.lowerRquirements || 0; + V.SecExp.edicts.defense.legionTradition = V.SecExp.edicts.defense.legionTradition || V.legionTradition || 0; + V.SecExp.edicts.defense.eagleWarriors = V.SecExp.edicts.defense.eagleWarriors || V.eagleWarriors || 0; + V.SecExp.edicts.defense.ronin = V.SecExp.edicts.defense.ronin || V.ronin || 0; + V.SecExp.edicts.defense.sunTzu = V.SecExp.edicts.defense.sunTzu || V.sunTzu || 0; + V.SecExp.edicts.defense.mamluks = V.SecExp.edicts.defense.mamluks || V.mamluks || 0; + V.SecExp.edicts.defense.pharaonTradition = V.SecExp.edicts.defense.pharaonTradition || V.pharaonTradition || 0; + + // Priv + V.SecExp.edicts.defense.privilege = V.SecExp.edicts.defense.privilege || {}; + V.SecExp.edicts.defense.privilege.militiaSoldier = V.SecExp.edicts.defense.privilege.militiaSoldier || V.militiaSoldier || 0; + V.SecExp.edicts.defense.privilege.slaveSoldier = V.SecExp.edicts.defense.privilege.slaveSoldier || V.slaveSoldier || 0; + V.SecExp.edicts.defense.privilege.mercSoldier = V.SecExp.edicts.defense.privilege.mercSoldier || V.mercSoldier || 0; + } }; -- GitLab