Newer
Older

svornost
committed
/** Replaces <<SetFacilityDecoration>> widget
* @returns {DocumentFragment}

svornost
committed
*/
App.UI.facilityRedecoration = function() {
const el = new DocumentFragment();
const activeFacilities = new Map([]);
const options = new App.UI.OptionsGroup();
FutureSocieties.DecorationCleanup();
const applicableFS = FutureSocieties.activeFSes(arc).filter(name => (arc[name] > 20));
const decorationNames = Array.from(applicableFS, FS => FutureSocieties.decorationName(FS));
if (V.brothel > 0) {
activeFacilities.set(V.brothelName, "brothelDecoration");
}
if (V.club > 0) {
activeFacilities.set(V.clubName, "clubDecoration");
}
if (V.dairy > 0) {
activeFacilities.set(V.dairyName, "dairyDecoration");
}
if (V.farmyard > 0) {
activeFacilities.set(V.farmyardName, "farmyardDecoration");
}
if (V.spa > 0) {
activeFacilities.set(V.spaName, "spaDecoration");
}
if (V.nursery > 0) {
activeFacilities.set(V.nurseryName, "nurseryDecoration");
}
if (V.clinic > 0) {
activeFacilities.set(V.clinicName, "clinicDecoration");

svornost
committed
}
if (V.schoolroom > 0) {
activeFacilities.set(V.schoolroomName, "schoolroomDecoration");
}
if (V.cellblock > 0) {
activeFacilities.set(V.cellblockName, "cellblockDecoration");
}
if (V.servantsQuarters > 0) {
activeFacilities.set(V.servantsQuartersName, "servantsQuartersDecoration");
}
if (V.arcade > 0) {
activeFacilities.set(V.arcadeName, "arcadeDecoration");
}
if (V.masterSuite > 0) {
activeFacilities.set(V.masterSuiteName, "masterSuiteDecoration");

svornost
committed
}
options.addOption(`Change style for all facilities`)
.addCustomDOM(modifyAll());
for (const [name, decoration] of activeFacilities) {
options.addOption(`The decoration style of ${name} is`)
.addCustomDOM(createPulldown(decoration));
}
el.append(options.render());
return el;
function createPulldown(variable) {
const select = document.createElement("select");
select.classList.add("rajs-list");
// Standard decorations
const choice = App.UI.DOM.appendNewElement("option", select, "Standard");
choice.value = "standard";
if (V[variable] === "standard") {
choice.selected = true;
}
// FS decorations
for (const decorationName of decorationNames) {
const choice = App.UI.DOM.makeElement("option", decorationName);
if (V[variable] === decorationName) {
choice.selected = true;
select.onchange = () => {
const O = select.options[select.selectedIndex];
cashX(-5000, "capEx");
}
App.UI.reload();
};
return select;
function modifyAll() {
const select = document.createElement("select");
select.classList.add("rajs-list");
// Standard decorations
const standard = App.UI.DOM.appendNewElement("option", select, "Standard");
standard.value = "standard";
// FS decorations
for (const decorationName of decorationNames) {
App.UI.DOM.appendNewElement("option", select, decorationName);
App.UI.DOM.appendNewElement("option", select, "Distribute Evenly");
select.onchange = () => {
const O = select.options[select.selectedIndex];
if (O.value === "Distribute Evenly") { // Cycles through the list of available FS decorations, and distributes them to facilities round robin style.
let i = 0;
for (const decoration of activeFacilities.values()) {
cashX(-5000, "capEx");
V[decoration] = decorationNames[i];
i++;
if (i >= decorationNames.length) {
i = 0;
}
}
} else {
for (const decoration of activeFacilities.values()) {
}
}
App.UI.reload();
};
select.selectedIndex = -1;
return select;

svornost
committed
};
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
/**
*
* @param {FC.FutureSociety} FS
* @param {Array} items
* @returns {HTMLElement}
*/
App.UI.FSChangeDecoration = function(FS, items) {
const el = document.createElement("div");
el.classList.add("indent");
const FSDecoration = FS + "Decoration";
let costs;
switch (V.arcologies[0][FSDecoration]) {
case 20:
costs = 2500;
el.append(`${V.arcologies[0].name} is not customized to support this goal. `);
if (V.arcologies[0][FS] >= 10) {
el.append(
App.UI.DOM.link(
`Modify your arcology's internal media to support this goal`,
() => {
V.arcologies[0][FSDecoration] = 40;
cashX(forceNeg(costs), "capEx");
},
[],
"Future Society",
`Costs ${cashFormat(costs)}`
),
);
} else {
el.append(`You must advance this goal before customization to support it becomes available. `);
}
break;
case 40:
el.append(`${V.arcologies[0].name}'s media is supporting this goal. `);
if (V.arcologies[0][FS] >= 30) {
costs = 10000;
el.append(
App.UI.DOM.link(
`Redecorate your arcology's public spaces to support this goal`,
() => {
V.arcologies[0][FSDecoration] = 60;
cashX(forceNeg(costs), "capEx");
},
[],
"Future Society",
`Costs ${cashFormat(costs)}`
),
);
} else {
el.append(`You must advance this goal before further customization to support it becomes available. `);
}
break;
case 60:
el.append(`${V.arcologies[0].name}'s media is supporting this goal, and ${V.arcologies[0].name}'s public spaces are decorated to support it too. `);
if (V.arcologies[0][FS] >= 50) {
costs = 10000;
el.append(
App.UI.DOM.link(
`Station slaves in your arcology's public spaces to promote this goal`,
() => {
V.arcologies[0][FSDecoration] = 80;
cashX(forceNeg(costs), "capEx");
},
[],
"Future Society",
`Costs ${cashFormat(costs)}`
),
);
} else {
el.append(`You must advance this goal before further customization to support it becomes available. `);
}
break;
case 80:
el.append(`${V.arcologies[0].name}'s media is supporting this goal; ${V.arcologies[0].name}'s public spaces are decorated to support it, and have slaves stationed in them to support it too. `);
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
if (V.arcologies[0][FS] >= 70) {
if (FS === "FSRestart") {
costs = 75000;
el.append(
App.UI.DOM.link(
`Customize the exterior of the arcology to support this goal and fully establish the Societal Elite`,
() => {
V.arcologies[0].FSRestartDecoration = 100;
V.upgradeMultiplierArcology = upgradeMultiplier('engineering');
V.upgradeMultiplierMedicine = upgradeMultiplier('medicine');
for (const item of items) {
_.set(V, item, 1);
}
},
[],
"Future Society",
`Costs ${cashFormat(costs)}`
),
);
} else {
costs = 10000;
el.append(
App.UI.DOM.link(
`Station slaves in your arcology's public spaces to promote this goal`,
() => {
V.arcologies[0][FSDecoration] = 100;
cashX(forceNeg(costs), "capEx");
for (const item of items) {
}
},
[],
"Future Society",
`Costs ${cashFormat(costs)}`
),
);
}
} else {
el.append(`You must advance this goal before further customization to support it becomes available. `);
}
break;
case 100:
el.append(`${V.arcologies[0].name}'s media is supporting this goal; ${V.arcologies[0].name}'s public spaces are decorated to support it, and have slaves stationed in them to support it. The exterior of the arcology has been remodeled to support it as well; the arcology is fully customized for this goal. `);