Added prettier (#661)
* Added prettier * Added prettier * Added prettier
This commit is contained in:
@@ -1,13 +1,23 @@
|
||||
/** Functions related to the Bottom Bar */
|
||||
|
||||
import { CacheObjects1, CacheObjects10, CacheObjects100 } from '../../Cache/VariablesAndData';
|
||||
import {
|
||||
CacheObjects1,
|
||||
CacheObjects10,
|
||||
CacheObjects100,
|
||||
} from '../../Cache/VariablesAndData';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import { VersionMajor, VersionMinor } from '../../Data/Moddata';
|
||||
import { Beautify, GetTimeColor } from '../BeautifyAndFormatting/BeautifyFormatting';
|
||||
import {
|
||||
Beautify,
|
||||
GetTimeColor,
|
||||
} from '../BeautifyAndFormatting/BeautifyFormatting';
|
||||
import GetCPS from '../HelperFunctions/GetCPS';
|
||||
import GetWrinkConfigBank from '../HelperFunctions/GetWrinkConfigBank';
|
||||
import {
|
||||
ColorBlue, ColorTextPre, ColorYellow, LastTargetBotBar,
|
||||
ColorBlue,
|
||||
ColorTextPre,
|
||||
ColorYellow,
|
||||
LastTargetBotBar,
|
||||
} from '../VariablesAndData';
|
||||
import { CreateBotBarBuildingColumn } from './CreateDOMElements';
|
||||
|
||||
@@ -15,74 +25,96 @@ import { CreateBotBarBuildingColumn } from './CreateDOMElements';
|
||||
* This function creates the bottom bar and appends it to l('wrapper')
|
||||
*/
|
||||
export function CreateBotBar() {
|
||||
const BotBar = document.createElement('div');
|
||||
BotBar.id = 'CMBotBar';
|
||||
BotBar.style.height = '69px';
|
||||
BotBar.style.width = '100%';
|
||||
BotBar.style.position = 'absolute';
|
||||
BotBar.style.display = 'none';
|
||||
BotBar.style.backgroundColor = '#262224';
|
||||
BotBar.style.backgroundImage = 'linear-gradient(to bottom, #4d4548, #000000)';
|
||||
BotBar.style.borderTop = '1px solid black';
|
||||
BotBar.style.overflow = 'auto';
|
||||
BotBar.style.textShadow = '-1px 0 black, 0 1px black, 1px 0 black, 0 -1px black';
|
||||
const BotBar = document.createElement('div');
|
||||
BotBar.id = 'CMBotBar';
|
||||
BotBar.style.height = '69px';
|
||||
BotBar.style.width = '100%';
|
||||
BotBar.style.position = 'absolute';
|
||||
BotBar.style.display = 'none';
|
||||
BotBar.style.backgroundColor = '#262224';
|
||||
BotBar.style.backgroundImage = 'linear-gradient(to bottom, #4d4548, #000000)';
|
||||
BotBar.style.borderTop = '1px solid black';
|
||||
BotBar.style.overflow = 'auto';
|
||||
BotBar.style.textShadow =
|
||||
'-1px 0 black, 0 1px black, 1px 0 black, 0 -1px black';
|
||||
|
||||
const table = BotBar.appendChild(document.createElement('table'));
|
||||
table.style.width = '100%';
|
||||
table.style.textAlign = 'center';
|
||||
table.style.whiteSpace = 'nowrap';
|
||||
const tbody = table.appendChild(document.createElement('tbody'));
|
||||
const table = BotBar.appendChild(document.createElement('table'));
|
||||
table.style.width = '100%';
|
||||
table.style.textAlign = 'center';
|
||||
table.style.whiteSpace = 'nowrap';
|
||||
const tbody = table.appendChild(document.createElement('tbody'));
|
||||
|
||||
const firstCol = function (text, color) {
|
||||
const td = document.createElement('td');
|
||||
td.style.textAlign = 'right';
|
||||
td.className = ColorTextPre + color;
|
||||
td.textContent = text;
|
||||
return td;
|
||||
};
|
||||
const type = tbody.appendChild(document.createElement('tr'));
|
||||
type.style.fontWeight = 'bold';
|
||||
type.appendChild(firstCol(`CM ${VersionMajor}.${VersionMinor}`, ColorYellow));
|
||||
const bonus = tbody.appendChild(document.createElement('tr'));
|
||||
bonus.appendChild(firstCol('Bonus Income', ColorBlue));
|
||||
const pp = tbody.appendChild(document.createElement('tr'));
|
||||
pp.appendChild(firstCol('Payback Period', ColorBlue));
|
||||
const time = tbody.appendChild(document.createElement('tr'));
|
||||
time.appendChild(firstCol('Time Left', ColorBlue));
|
||||
const firstCol = function (text, color) {
|
||||
const td = document.createElement('td');
|
||||
td.style.textAlign = 'right';
|
||||
td.className = ColorTextPre + color;
|
||||
td.textContent = text;
|
||||
return td;
|
||||
};
|
||||
const type = tbody.appendChild(document.createElement('tr'));
|
||||
type.style.fontWeight = 'bold';
|
||||
type.appendChild(firstCol(`CM ${VersionMajor}.${VersionMinor}`, ColorYellow));
|
||||
const bonus = tbody.appendChild(document.createElement('tr'));
|
||||
bonus.appendChild(firstCol('Bonus Income', ColorBlue));
|
||||
const pp = tbody.appendChild(document.createElement('tr'));
|
||||
pp.appendChild(firstCol('Payback Period', ColorBlue));
|
||||
const time = tbody.appendChild(document.createElement('tr'));
|
||||
time.appendChild(firstCol('Time Left', ColorBlue));
|
||||
|
||||
l('wrapper').appendChild(BotBar);
|
||||
l('wrapper').appendChild(BotBar);
|
||||
|
||||
for (const i of Object.keys(Game.Objects)) {
|
||||
CreateBotBarBuildingColumn(i);
|
||||
}
|
||||
for (const i of Object.keys(Game.Objects)) {
|
||||
CreateBotBarBuildingColumn(i);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This function updates the bonus-, pp-, and time-rows in the the bottom bar
|
||||
*/
|
||||
export function UpdateBotBar() {
|
||||
if (CMOptions.BotBar === 1 && CacheObjects1 && Game.buyMode === 1) {
|
||||
let count = 0;
|
||||
for (const i of Object.keys(CacheObjects1)) {
|
||||
let target = Game.buyBulk;
|
||||
if (Game.buyMode === 1) {
|
||||
LastTargetBotBar = target;
|
||||
} else {
|
||||
target = LastTargetBotBar;
|
||||
}
|
||||
if (target === 1) target = CacheObjects1;
|
||||
if (target === 10) target = CacheObjects10;
|
||||
if (target === 100) target = CacheObjects100;
|
||||
count++;
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[0].childNodes[count].childNodes[1].textContent = Game.Objects[i].amount;
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[1].childNodes[count].textContent = Beautify(target[i].bonus, 2);
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[2].childNodes[count].className = ColorTextPre + target[i].color;
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[2].childNodes[count].textContent = Beautify(target[i].pp, 2);
|
||||
const timeColor = GetTimeColor((Game.Objects[i].bulkPrice - (Game.cookies + GetWrinkConfigBank())) / GetCPS());
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[count].className = ColorTextPre + timeColor.color;
|
||||
if (timeColor.text === 'Done!' && Game.cookies < Game.Objects[i].bulkPrice) {
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[count].textContent = `${timeColor.text} (with Wrink)`;
|
||||
} else l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[count].textContent = timeColor.text;
|
||||
}
|
||||
}
|
||||
if (CMOptions.BotBar === 1 && CacheObjects1 && Game.buyMode === 1) {
|
||||
let count = 0;
|
||||
for (const i of Object.keys(CacheObjects1)) {
|
||||
let target = Game.buyBulk;
|
||||
if (Game.buyMode === 1) {
|
||||
LastTargetBotBar = target;
|
||||
} else {
|
||||
target = LastTargetBotBar;
|
||||
}
|
||||
if (target === 1) target = CacheObjects1;
|
||||
if (target === 10) target = CacheObjects10;
|
||||
if (target === 100) target = CacheObjects100;
|
||||
count++;
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[0].childNodes[
|
||||
count
|
||||
].childNodes[1].textContent = Game.Objects[i].amount;
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[1].childNodes[
|
||||
count
|
||||
].textContent = Beautify(target[i].bonus, 2);
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[2].childNodes[
|
||||
count
|
||||
].className = ColorTextPre + target[i].color;
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[2].childNodes[
|
||||
count
|
||||
].textContent = Beautify(target[i].pp, 2);
|
||||
const timeColor = GetTimeColor(
|
||||
(Game.Objects[i].bulkPrice - (Game.cookies + GetWrinkConfigBank())) /
|
||||
GetCPS(),
|
||||
);
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[
|
||||
count
|
||||
].className = ColorTextPre + timeColor.color;
|
||||
if (
|
||||
timeColor.text === 'Done!' &&
|
||||
Game.cookies < Game.Objects[i].bulkPrice
|
||||
) {
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[
|
||||
count
|
||||
].textContent = `${timeColor.text} (with Wrink)`;
|
||||
} else
|
||||
l('CMBotBar').firstChild.firstChild.childNodes[3].childNodes[
|
||||
count
|
||||
].textContent = timeColor.text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,58 +9,58 @@ import { ColorBackPre, ColorBlue, ColorTextPre } from '../VariablesAndData';
|
||||
* @param [{{string}, {string}}, ...] bars ([id, color]) The id and colours of individual parts of the timer
|
||||
*/
|
||||
export function CreateTimer(id, name, bars) {
|
||||
const timerBar = document.createElement('div');
|
||||
timerBar.id = id;
|
||||
timerBar.style.height = '12px';
|
||||
timerBar.style.margin = '0px 10px';
|
||||
timerBar.style.position = 'relative';
|
||||
const timerBar = document.createElement('div');
|
||||
timerBar.id = id;
|
||||
timerBar.style.height = '12px';
|
||||
timerBar.style.margin = '0px 10px';
|
||||
timerBar.style.position = 'relative';
|
||||
|
||||
const div = document.createElement('div');
|
||||
div.style.width = '100%';
|
||||
div.style.height = '10px';
|
||||
div.style.margin = 'auto';
|
||||
div.style.position = 'absolute';
|
||||
div.style.left = '0px';
|
||||
div.style.top = '0px';
|
||||
div.style.right = '0px';
|
||||
div.style.bottom = '0px';
|
||||
const div = document.createElement('div');
|
||||
div.style.width = '100%';
|
||||
div.style.height = '10px';
|
||||
div.style.margin = 'auto';
|
||||
div.style.position = 'absolute';
|
||||
div.style.left = '0px';
|
||||
div.style.top = '0px';
|
||||
div.style.right = '0px';
|
||||
div.style.bottom = '0px';
|
||||
|
||||
const type = document.createElement('span');
|
||||
type.style.display = 'inline-block';
|
||||
type.style.textAlign = 'right';
|
||||
type.style.fontSize = '10px';
|
||||
type.style.width = '108px';
|
||||
type.style.marginRight = '5px';
|
||||
type.style.verticalAlign = 'text-top';
|
||||
type.textContent = name;
|
||||
div.appendChild(type);
|
||||
const type = document.createElement('span');
|
||||
type.style.display = 'inline-block';
|
||||
type.style.textAlign = 'right';
|
||||
type.style.fontSize = '10px';
|
||||
type.style.width = '108px';
|
||||
type.style.marginRight = '5px';
|
||||
type.style.verticalAlign = 'text-top';
|
||||
type.textContent = name;
|
||||
div.appendChild(type);
|
||||
|
||||
for (let i = 0; i < bars.length; i++) {
|
||||
const colorBar = document.createElement('span');
|
||||
colorBar.id = bars[i].id;
|
||||
colorBar.style.display = 'inline-block';
|
||||
colorBar.style.height = '10px';
|
||||
colorBar.style.verticalAlign = 'text-top';
|
||||
colorBar.style.textAlign = 'center';
|
||||
if (bars.length - 1 === i) {
|
||||
colorBar.style.borderTopRightRadius = '10px';
|
||||
colorBar.style.borderBottomRightRadius = '10px';
|
||||
}
|
||||
if (typeof bars[i].color !== 'undefined') {
|
||||
colorBar.className = ColorBackPre + bars[i].color;
|
||||
}
|
||||
div.appendChild(colorBar);
|
||||
}
|
||||
for (let i = 0; i < bars.length; i++) {
|
||||
const colorBar = document.createElement('span');
|
||||
colorBar.id = bars[i].id;
|
||||
colorBar.style.display = 'inline-block';
|
||||
colorBar.style.height = '10px';
|
||||
colorBar.style.verticalAlign = 'text-top';
|
||||
colorBar.style.textAlign = 'center';
|
||||
if (bars.length - 1 === i) {
|
||||
colorBar.style.borderTopRightRadius = '10px';
|
||||
colorBar.style.borderBottomRightRadius = '10px';
|
||||
}
|
||||
if (typeof bars[i].color !== 'undefined') {
|
||||
colorBar.className = ColorBackPre + bars[i].color;
|
||||
}
|
||||
div.appendChild(colorBar);
|
||||
}
|
||||
|
||||
const timer = document.createElement('span');
|
||||
timer.id = `${id}Time`;
|
||||
timer.style.marginLeft = '5px';
|
||||
timer.style.verticalAlign = 'text-top';
|
||||
div.appendChild(timer);
|
||||
const timer = document.createElement('span');
|
||||
timer.id = `${id}Time`;
|
||||
timer.style.marginLeft = '5px';
|
||||
timer.style.verticalAlign = 'text-top';
|
||||
div.appendChild(timer);
|
||||
|
||||
timerBar.appendChild(div);
|
||||
timerBar.appendChild(div);
|
||||
|
||||
return timerBar;
|
||||
return timerBar;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -68,22 +68,26 @@ export function CreateTimer(id, name, bars) {
|
||||
* @param {string} buildingName Objectname to be added (e.g., "Cursor")
|
||||
*/
|
||||
export function CreateBotBarBuildingColumn(buildingName) {
|
||||
if (l('CMBotBar') !== null) {
|
||||
const type = l('CMBotBar').firstChild.firstChild.childNodes[0];
|
||||
const bonus = l('CMBotBar').firstChild.firstChild.childNodes[1];
|
||||
const pp = l('CMBotBar').firstChild.firstChild.childNodes[2];
|
||||
const time = l('CMBotBar').firstChild.firstChild.childNodes[3];
|
||||
if (l('CMBotBar') !== null) {
|
||||
const type = l('CMBotBar').firstChild.firstChild.childNodes[0];
|
||||
const bonus = l('CMBotBar').firstChild.firstChild.childNodes[1];
|
||||
const pp = l('CMBotBar').firstChild.firstChild.childNodes[2];
|
||||
const time = l('CMBotBar').firstChild.firstChild.childNodes[3];
|
||||
|
||||
const i = buildingName;
|
||||
const header = type.appendChild(document.createElement('td'));
|
||||
header.appendChild(document.createTextNode(`${i.indexOf(' ') !== -1 ? i.substring(0, i.indexOf(' ')) : i} (`));
|
||||
const i = buildingName;
|
||||
const header = type.appendChild(document.createElement('td'));
|
||||
header.appendChild(
|
||||
document.createTextNode(
|
||||
`${i.indexOf(' ') !== -1 ? i.substring(0, i.indexOf(' ')) : i} (`,
|
||||
),
|
||||
);
|
||||
|
||||
const span = header.appendChild(document.createElement('span'));
|
||||
span.className = ColorTextPre + ColorBlue;
|
||||
const span = header.appendChild(document.createElement('span'));
|
||||
span.className = ColorTextPre + ColorBlue;
|
||||
|
||||
header.appendChild(document.createTextNode(')'));
|
||||
bonus.appendChild(document.createElement('td'));
|
||||
pp.appendChild(document.createElement('td'));
|
||||
time.appendChild(document.createElement('td'));
|
||||
}
|
||||
header.appendChild(document.createTextNode(')'));
|
||||
bonus.appendChild(document.createElement('td'));
|
||||
pp.appendChild(document.createElement('td'));
|
||||
time.appendChild(document.createElement('td'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,12 @@
|
||||
import { UpdateBotTimerBarPosition } from '../../Config/SpecificToggles';
|
||||
import { CMOptions } from '../../Config/VariablesAndData';
|
||||
import {
|
||||
BuffColors,
|
||||
ColorBackPre, ColorGray, ColorOrange, ColorPurple, LastNumberOfTimers,
|
||||
BuffColors,
|
||||
ColorBackPre,
|
||||
ColorGray,
|
||||
ColorOrange,
|
||||
ColorPurple,
|
||||
LastNumberOfTimers,
|
||||
} from '../VariablesAndData';
|
||||
import { CreateTimer } from './CreateDOMElements';
|
||||
|
||||
@@ -12,111 +16,191 @@ import { CreateTimer } from './CreateDOMElements';
|
||||
* This function creates the TimerBar and appends it to l('wrapper')
|
||||
*/
|
||||
export function CreateTimerBar() {
|
||||
const TimerBar = document.createElement('div');
|
||||
TimerBar.id = 'CMTimerBar';
|
||||
TimerBar.style.position = 'absolute';
|
||||
TimerBar.style.display = 'none';
|
||||
TimerBar.style.height = '0px';
|
||||
TimerBar.style.fontSize = '10px';
|
||||
TimerBar.style.fontWeight = 'bold';
|
||||
TimerBar.style.backgroundColor = 'black';
|
||||
const TimerBar = document.createElement('div');
|
||||
TimerBar.id = 'CMTimerBar';
|
||||
TimerBar.style.position = 'absolute';
|
||||
TimerBar.style.display = 'none';
|
||||
TimerBar.style.height = '0px';
|
||||
TimerBar.style.fontSize = '10px';
|
||||
TimerBar.style.fontWeight = 'bold';
|
||||
TimerBar.style.backgroundColor = 'black';
|
||||
|
||||
// Create standard Golden Cookie bar
|
||||
const CMTimerBarGC = CreateTimer('CMTimerBarGC',
|
||||
'Next Cookie',
|
||||
[{ id: 'CMTimerBarGCMinBar', color: ColorGray }, { id: 'CMTimerBarGCBar', color: ColorPurple }]);
|
||||
TimerBar.appendChild(CMTimerBarGC);
|
||||
// Create standard Golden Cookie bar
|
||||
const CMTimerBarGC = CreateTimer('CMTimerBarGC', 'Next Cookie', [
|
||||
{ id: 'CMTimerBarGCMinBar', color: ColorGray },
|
||||
{ id: 'CMTimerBarGCBar', color: ColorPurple },
|
||||
]);
|
||||
TimerBar.appendChild(CMTimerBarGC);
|
||||
|
||||
// Create standard Reindeer bar
|
||||
const CMTimerBarRen = CreateTimer('CMTimerBarRen',
|
||||
'Next Reindeer',
|
||||
[{ id: 'CMTimerBarRenMinBar', color: ColorGray }, { id: 'CMTimerBarRenBar', color: ColorOrange }]);
|
||||
TimerBar.appendChild(CMTimerBarRen);
|
||||
const TimerBarBuffTimers = document.createElement('div');
|
||||
TimerBarBuffTimers.id = 'CMTimerBarBuffTimers';
|
||||
TimerBar.appendChild(TimerBarBuffTimers);
|
||||
// Create standard Reindeer bar
|
||||
const CMTimerBarRen = CreateTimer('CMTimerBarRen', 'Next Reindeer', [
|
||||
{ id: 'CMTimerBarRenMinBar', color: ColorGray },
|
||||
{ id: 'CMTimerBarRenBar', color: ColorOrange },
|
||||
]);
|
||||
TimerBar.appendChild(CMTimerBarRen);
|
||||
const TimerBarBuffTimers = document.createElement('div');
|
||||
TimerBarBuffTimers.id = 'CMTimerBarBuffTimers';
|
||||
TimerBar.appendChild(TimerBarBuffTimers);
|
||||
|
||||
l('wrapper').appendChild(TimerBar);
|
||||
l('wrapper').appendChild(TimerBar);
|
||||
}
|
||||
|
||||
/**
|
||||
* This function updates indivudual timers in the timer bar
|
||||
*/
|
||||
export function UpdateTimerBar() {
|
||||
if (CMOptions.TimerBar === 1) {
|
||||
// label width: 113, timer width: 30, div margin: 20
|
||||
const maxWidthTwoBar = l('CMTimerBar').offsetWidth - 163;
|
||||
// label width: 113, div margin: 20, calculate timer width at runtime
|
||||
const maxWidthOneBar = l('CMTimerBar').offsetWidth - 133;
|
||||
let numberOfTimers = 0;
|
||||
if (CMOptions.TimerBar === 1) {
|
||||
// label width: 113, timer width: 30, div margin: 20
|
||||
const maxWidthTwoBar = l('CMTimerBar').offsetWidth - 163;
|
||||
// label width: 113, div margin: 20, calculate timer width at runtime
|
||||
const maxWidthOneBar = l('CMTimerBar').offsetWidth - 133;
|
||||
let numberOfTimers = 0;
|
||||
|
||||
// Regulates visibility of Golden Cookie timer
|
||||
if (Game.shimmerTypes.golden.spawned === 0 && !Game.Has('Golden switch [off]')) {
|
||||
l('CMTimerBarGC').style.display = '';
|
||||
l('CMTimerBarGCMinBar').style.width = `${Math.round(Math.max(0, Game.shimmerTypes.golden.minTime - Game.shimmerTypes.golden.time) * maxWidthTwoBar / Game.shimmerTypes.golden.maxTime)}px`;
|
||||
if (CMOptions.TimerBarOverlay >= 1) l('CMTimerBarGCMinBar').textContent = Math.ceil((Game.shimmerTypes.golden.minTime - Game.shimmerTypes.golden.time) / Game.fps);
|
||||
else l('CMTimerBarGCMinBar').textContent = '';
|
||||
if (Game.shimmerTypes.golden.minTime === Game.shimmerTypes.golden.maxTime) {
|
||||
l('CMTimerBarGCMinBar').style.borderTopRightRadius = '10px';
|
||||
l('CMTimerBarGCMinBar').style.borderBottomRightRadius = '10px';
|
||||
} else {
|
||||
l('CMTimerBarGCMinBar').style.borderTopRightRadius = '';
|
||||
l('CMTimerBarGCMinBar').style.borderBottomRightRadius = '';
|
||||
}
|
||||
l('CMTimerBarGCBar').style.width = `${Math.round(Math.min(Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.minTime, Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time) * maxWidthTwoBar / Game.shimmerTypes.golden.maxTime)}px`;
|
||||
if (CMOptions.TimerBarOverlay >= 1) l('CMTimerBarGCBar').textContent = Math.ceil(Math.min(Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.minTime, Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time) / Game.fps);
|
||||
else l('CMTimerBarGCBar').textContent = '';
|
||||
l('CMTimerBarGCTime').textContent = Math.ceil((Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time) / Game.fps);
|
||||
numberOfTimers++;
|
||||
} else l('CMTimerBarGC').style.display = 'none';
|
||||
// Regulates visibility of Golden Cookie timer
|
||||
if (
|
||||
Game.shimmerTypes.golden.spawned === 0 &&
|
||||
!Game.Has('Golden switch [off]')
|
||||
) {
|
||||
l('CMTimerBarGC').style.display = '';
|
||||
l('CMTimerBarGCMinBar').style.width = `${Math.round(
|
||||
(Math.max(
|
||||
0,
|
||||
Game.shimmerTypes.golden.minTime - Game.shimmerTypes.golden.time,
|
||||
) *
|
||||
maxWidthTwoBar) /
|
||||
Game.shimmerTypes.golden.maxTime,
|
||||
)}px`;
|
||||
if (CMOptions.TimerBarOverlay >= 1)
|
||||
l('CMTimerBarGCMinBar').textContent = Math.ceil(
|
||||
(Game.shimmerTypes.golden.minTime - Game.shimmerTypes.golden.time) /
|
||||
Game.fps,
|
||||
);
|
||||
else l('CMTimerBarGCMinBar').textContent = '';
|
||||
if (
|
||||
Game.shimmerTypes.golden.minTime === Game.shimmerTypes.golden.maxTime
|
||||
) {
|
||||
l('CMTimerBarGCMinBar').style.borderTopRightRadius = '10px';
|
||||
l('CMTimerBarGCMinBar').style.borderBottomRightRadius = '10px';
|
||||
} else {
|
||||
l('CMTimerBarGCMinBar').style.borderTopRightRadius = '';
|
||||
l('CMTimerBarGCMinBar').style.borderBottomRightRadius = '';
|
||||
}
|
||||
l('CMTimerBarGCBar').style.width = `${Math.round(
|
||||
(Math.min(
|
||||
Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.minTime,
|
||||
Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time,
|
||||
) *
|
||||
maxWidthTwoBar) /
|
||||
Game.shimmerTypes.golden.maxTime,
|
||||
)}px`;
|
||||
if (CMOptions.TimerBarOverlay >= 1)
|
||||
l('CMTimerBarGCBar').textContent = Math.ceil(
|
||||
Math.min(
|
||||
Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.minTime,
|
||||
Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time,
|
||||
) / Game.fps,
|
||||
);
|
||||
else l('CMTimerBarGCBar').textContent = '';
|
||||
l('CMTimerBarGCTime').textContent = Math.ceil(
|
||||
(Game.shimmerTypes.golden.maxTime - Game.shimmerTypes.golden.time) /
|
||||
Game.fps,
|
||||
);
|
||||
numberOfTimers++;
|
||||
} else l('CMTimerBarGC').style.display = 'none';
|
||||
|
||||
// Regulates visibility of Reindeer timer
|
||||
if (Game.season === 'christmas' && Game.shimmerTypes.reindeer.spawned === 0) {
|
||||
l('CMTimerBarRen').style.display = '';
|
||||
l('CMTimerBarRenMinBar').style.width = `${Math.round(Math.max(0, Game.shimmerTypes.reindeer.minTime - Game.shimmerTypes.reindeer.time) * maxWidthTwoBar / Game.shimmerTypes.reindeer.maxTime)}px`;
|
||||
if (CMOptions.TimerBarOverlay >= 1) l('CMTimerBarRenMinBar').textContent = Math.ceil((Game.shimmerTypes.reindeer.minTime - Game.shimmerTypes.reindeer.time) / Game.fps);
|
||||
else l('CMTimerBarRenMinBar').textContent = '';
|
||||
l('CMTimerBarRenBar').style.width = `${Math.round(Math.min(Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.minTime, Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time) * maxWidthTwoBar / Game.shimmerTypes.reindeer.maxTime)}px`;
|
||||
if (CMOptions.TimerBarOverlay >= 1) l('CMTimerBarRenBar').textContent = Math.ceil(Math.min(Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.minTime, Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time) / Game.fps);
|
||||
else l('CMTimerBarRenBar').textContent = '';
|
||||
l('CMTimerBarRenTime').textContent = Math.ceil((Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time) / Game.fps);
|
||||
numberOfTimers++;
|
||||
} else {
|
||||
l('CMTimerBarRen').style.display = 'none';
|
||||
}
|
||||
// Regulates visibility of Reindeer timer
|
||||
if (
|
||||
Game.season === 'christmas' &&
|
||||
Game.shimmerTypes.reindeer.spawned === 0
|
||||
) {
|
||||
l('CMTimerBarRen').style.display = '';
|
||||
l('CMTimerBarRenMinBar').style.width = `${Math.round(
|
||||
(Math.max(
|
||||
0,
|
||||
Game.shimmerTypes.reindeer.minTime - Game.shimmerTypes.reindeer.time,
|
||||
) *
|
||||
maxWidthTwoBar) /
|
||||
Game.shimmerTypes.reindeer.maxTime,
|
||||
)}px`;
|
||||
if (CMOptions.TimerBarOverlay >= 1)
|
||||
l('CMTimerBarRenMinBar').textContent = Math.ceil(
|
||||
(Game.shimmerTypes.reindeer.minTime -
|
||||
Game.shimmerTypes.reindeer.time) /
|
||||
Game.fps,
|
||||
);
|
||||
else l('CMTimerBarRenMinBar').textContent = '';
|
||||
l('CMTimerBarRenBar').style.width = `${Math.round(
|
||||
(Math.min(
|
||||
Game.shimmerTypes.reindeer.maxTime -
|
||||
Game.shimmerTypes.reindeer.minTime,
|
||||
Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time,
|
||||
) *
|
||||
maxWidthTwoBar) /
|
||||
Game.shimmerTypes.reindeer.maxTime,
|
||||
)}px`;
|
||||
if (CMOptions.TimerBarOverlay >= 1)
|
||||
l('CMTimerBarRenBar').textContent = Math.ceil(
|
||||
Math.min(
|
||||
Game.shimmerTypes.reindeer.maxTime -
|
||||
Game.shimmerTypes.reindeer.minTime,
|
||||
Game.shimmerTypes.reindeer.maxTime -
|
||||
Game.shimmerTypes.reindeer.time,
|
||||
) / Game.fps,
|
||||
);
|
||||
else l('CMTimerBarRenBar').textContent = '';
|
||||
l('CMTimerBarRenTime').textContent = Math.ceil(
|
||||
(Game.shimmerTypes.reindeer.maxTime - Game.shimmerTypes.reindeer.time) /
|
||||
Game.fps,
|
||||
);
|
||||
numberOfTimers++;
|
||||
} else {
|
||||
l('CMTimerBarRen').style.display = 'none';
|
||||
}
|
||||
|
||||
// On every frame all buff-timers are deleted and re-created
|
||||
const BuffTimerBars = {};
|
||||
l('CMTimerBarBuffTimers').innerHTML = '';
|
||||
for (const i of Object.keys(Game.buffs)) {
|
||||
if (Game.buffs[i]) {
|
||||
const timer = CreateTimer(Game.buffs[i].name, Game.buffs[i].name, [{ id: `${Game.buffs[i].name}Bar` }]);
|
||||
timer.style.display = '';
|
||||
let classColor = '';
|
||||
// Gives specific timers specific colors
|
||||
if (typeof BuffColors[Game.buffs[i].name] !== 'undefined') {
|
||||
classColor = BuffColors[Game.buffs[i].name];
|
||||
} else classColor = ColorPurple;
|
||||
timer.lastChild.children[1].className = ColorBackPre + classColor;
|
||||
timer.lastChild.children[1].style.color = 'black';
|
||||
if (CMOptions.TimerBarOverlay === 2) timer.lastChild.children[1].textContent = `${Math.round(100 * (Game.buffs[i].time / Game.buffs[i].maxTime))}%`;
|
||||
else timer.lastChild.children[1].textContent = '';
|
||||
timer.lastChild.children[1].style.width = `${Math.round(Game.buffs[i].time * (maxWidthOneBar - Math.ceil(Game.buffs[i].time / Game.fps).toString().length * 8) / Game.buffs[i].maxTime)}px`;
|
||||
timer.lastChild.children[2].textContent = Math.ceil(Game.buffs[i].time / Game.fps);
|
||||
numberOfTimers++;
|
||||
BuffTimerBars[Game.buffs[i].name] = timer;
|
||||
}
|
||||
}
|
||||
for (const i of Object.keys(BuffTimerBars)) {
|
||||
l('CMTimerBarBuffTimers').appendChild(BuffTimerBars[i]);
|
||||
}
|
||||
// On every frame all buff-timers are deleted and re-created
|
||||
const BuffTimerBars = {};
|
||||
l('CMTimerBarBuffTimers').innerHTML = '';
|
||||
for (const i of Object.keys(Game.buffs)) {
|
||||
if (Game.buffs[i]) {
|
||||
const timer = CreateTimer(Game.buffs[i].name, Game.buffs[i].name, [
|
||||
{ id: `${Game.buffs[i].name}Bar` },
|
||||
]);
|
||||
timer.style.display = '';
|
||||
let classColor = '';
|
||||
// Gives specific timers specific colors
|
||||
if (typeof BuffColors[Game.buffs[i].name] !== 'undefined') {
|
||||
classColor = BuffColors[Game.buffs[i].name];
|
||||
} else classColor = ColorPurple;
|
||||
timer.lastChild.children[1].className = ColorBackPre + classColor;
|
||||
timer.lastChild.children[1].style.color = 'black';
|
||||
if (CMOptions.TimerBarOverlay === 2)
|
||||
timer.lastChild.children[1].textContent = `${Math.round(
|
||||
100 * (Game.buffs[i].time / Game.buffs[i].maxTime),
|
||||
)}%`;
|
||||
else timer.lastChild.children[1].textContent = '';
|
||||
timer.lastChild.children[1].style.width = `${Math.round(
|
||||
(Game.buffs[i].time *
|
||||
(maxWidthOneBar -
|
||||
Math.ceil(Game.buffs[i].time / Game.fps).toString().length * 8)) /
|
||||
Game.buffs[i].maxTime,
|
||||
)}px`;
|
||||
timer.lastChild.children[2].textContent = Math.ceil(
|
||||
Game.buffs[i].time / Game.fps,
|
||||
);
|
||||
numberOfTimers++;
|
||||
BuffTimerBars[Game.buffs[i].name] = timer;
|
||||
}
|
||||
}
|
||||
for (const i of Object.keys(BuffTimerBars)) {
|
||||
l('CMTimerBarBuffTimers').appendChild(BuffTimerBars[i]);
|
||||
}
|
||||
|
||||
if (numberOfTimers !== 0) {
|
||||
l('CMTimerBar').style.height = `${numberOfTimers * 12 + 2}px`;
|
||||
}
|
||||
if (LastNumberOfTimers !== numberOfTimers) {
|
||||
LastNumberOfTimers = numberOfTimers;
|
||||
UpdateBotTimerBarPosition();
|
||||
}
|
||||
}
|
||||
if (numberOfTimers !== 0) {
|
||||
l('CMTimerBar').style.height = `${numberOfTimers * 12 + 2}px`;
|
||||
}
|
||||
if (LastNumberOfTimers !== numberOfTimers) {
|
||||
LastNumberOfTimers = numberOfTimers;
|
||||
UpdateBotTimerBarPosition();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user