}
}
-enum class ClusterContention(val controlSpreadChance: Double, val maxFleets: Int, val fleetStrengthMult: Double) {
- BLOODBATH(0.9, 5, 1.0), CONTESTED(0.65, 3, 0.8), PEACEFUL(0.5, 2, 0.5);
+enum class ClusterContention(val numLanesSpreadControl: Double, val maxFleets: Int, val fleetStrengthMult: Double) {
+ BLOODBATH(3.0, 5, 1.0), CONTESTED(1.75, 3, 0.8), PEACEFUL(1.25, 2, 0.5);
val displayName: String
get() = name.lowercase().replaceFirstChar { it.uppercase() }
}
}
h3 { +"Per-Faction Modes" }
+ p {
+ strong { +"Set All" }
+ for (mode in ClusterFactionMode.values()) {
+ +Entities.nbsp
+ a(href = "#", classes = "set-all") {
+ attributes["data-enable-class"] = "faction-mode-${mode.toUrlSlug()}"
+ +mode.displayName
+ }
+ }
+ }
for (factionFlavor in FactionFlavor.values())
p {
strong { +factionFlavor.displayName }
required = true
if (mode == ClusterFactionMode.ALLOW)
checked = true
+ classes = setOf(
+ "faction-choice",
+ "faction-loyalty-${factionFlavor.loyalties.first().toUrlSlug()}",
+ "faction-shipset-${factionFlavor.shipSource.toUrlSlug()}",
+ "faction-mode-${mode.toUrlSlug()}",
+ )
}
+mode.displayName
+Entities.nbsp
}
}
}
+ p {
+ strong { +"Set All by Faction Loyalty" }
+ val loyalties = FactionFlavor.values().map { it.loyalties.first() }.distinct()
+ for (loyalty in loyalties) {
+ br
+ +"${loyalty.shortName}:"
+ for (mode in ClusterFactionMode.values()) {
+ +Entities.nbsp
+ a(href = "#", classes = "set-all-by-faction") {
+ attributes["data-filter-class"] = "faction-loyalty-${loyalty.toUrlSlug()}"
+ attributes["data-enable-class"] = "faction-mode-${mode.toUrlSlug()}"
+ +mode.displayName
+ }
+ }
+ }
+ }
+ p {
+ strong { +"Set All by Shipset" }
+ val shipSets = FactionFlavor.values().map { it.shipSource }.distinct()
+ for (shipSet in shipSets) {
+ br
+ +"${shipSet.shortName}:"
+ for (mode in ClusterFactionMode.values()) {
+ +Entities.nbsp
+ a(href = "#", classes = "set-all-by-faction") {
+ attributes["data-filter-class"] = "faction-shipset-${shipSet.toUrlSlug()}"
+ attributes["data-enable-class"] = "faction-mode-${mode.toUrlSlug()}"
+ +mode.displayName
+ }
+ }
+ }
+ }
submitInput {
value = "Generate Star Cluster"
}
+ script {
+ unsafe { +"window.sfClusterGenTest = true;" }
+ }
}
}
}
}
const canvasLoads = [];
- for (let canvas of canvases) {
+ for (const canvas of canvases) {
const modelName = canvas.getAttribute("data-model");
if (modelName == null) continue;
window.addEventListener("load", function () {
// Localize dates and times
const moments = document.getElementsByClassName("moment");
- for (let moment of moments) {
+ for (const moment of moments) {
let date = new Date(Number(moment.innerHTML.trim()));
moment.innerHTML = date.toLocaleString();
moment.style.display = "inline";
const nameBox = document.getElementById("name");
const isFemaleButton = document.getElementById("sex-female");
const generators = document.getElementsByClassName("generate-admiral-name");
- for (let generator of generators) {
+ for (const generator of generators) {
const flavor = generator.getAttribute("data-flavor");
generator.onclick = (e) => {
e.preventDefault();
window.addEventListener("load", function () {
// Indicate maximum and used length of <textarea>s
const textareas = document.getElementsByTagName("textarea");
- for (let textarea of textareas) {
+ for (const textarea of textareas) {
if (!textarea.hasAttribute("maxLength")) continue;
const maxLengthIndicator = document.createElement("p");
window.addEventListener("load", function () {
// Allow POSTing with <a>s
const anchors = document.getElementsByTagName("a");
- for (let anchor of anchors) {
+ for (const anchor of anchors) {
const method = anchor.getAttribute("data-method");
if (method == null) continue;
if (!window.sfThemeChoice) return;
const themeChoices = document.getElementsByName("theme");
- for (let themeChoice of themeChoices) {
+ for (const themeChoice of themeChoices) {
const theme = themeChoice.value;
themeChoice.addEventListener("click", () => {
document.documentElement.setAttribute("data-theme", theme);
});
}
});
+
+ window.addEventListener("load", function () {
+ // Allow bulk-setting of factions
+ if (!window.sfClusterGenTest) return;
+
+ const setAllButtons = document.getElementsByClassName("set-all");
+ for (const setAllButton of setAllButtons) {
+ setAllButton.onclick = function (e) {
+ e.preventDefault();
+
+ const enableClass = setAllButton.getAttribute("data-enable-class");
+ const factionChoices = document.getElementsByClassName("faction-choice");
+ for (const factionChoice of factionChoices) {
+ factionChoice.checked = factionChoice.classList.contains(enableClass);
+ }
+ };
+ }
+
+ const setSomeButtons = document.getElementsByClassName("set-all-by-faction");
+ for (const setSomeButton of setSomeButtons) {
+ setSomeButton.onclick = function (e) {
+ e.preventDefault();
+
+ const filterClass = setSomeButton.getAttribute("data-filter-class");
+ const chosenClass = setSomeButton.getAttribute("data-enable-class");
+ const factionChoices = document.getElementsByClassName("faction-choice");
+ for (const factionChoice of factionChoices) {
+ if (factionChoice.classList.contains(filterClass))
+ factionChoice.checked = factionChoice.classList.contains(chosenClass);
+ }
+ };
+ }
+ });
})();