Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions ui/eureka/eureka.css
Original file line number Diff line number Diff line change
Expand Up @@ -284,11 +284,20 @@
padding-top: 5px;
}

#label-weather-container.hidden {
display: none;
}

#label-time {
padding-bottom: 5px;
border-bottom: 2px dashed rgb(255 255 255 / 30%);
}

#label-time.weather-hidden {
padding-bottom: 0;
border-bottom: none;
}

.aspect-ratio-anemos #label-container {
top: 0%;
}
Expand Down
161 changes: 102 additions & 59 deletions ui/eureka/eureka.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ type NMInfo = {
x: number;
y: number;
respawnMinutes?: number;
partnerFateId?: number;
partnerFateRespawnMinutes?: number;

// Modified
element?: HTMLElement;
Expand Down Expand Up @@ -117,6 +119,7 @@ const defaultEurekaConfigOptions = {
FlagTimeoutMs: 90,
CompleteNamesSTQ: false,
EnrichedSTQ: false,
HideWeather: false,
PopNoiseForNM: true,
PopNoiseForBunny: true,
PopNoiseForSkirmish: false,
Expand Down Expand Up @@ -546,8 +549,40 @@ class EurekaTracker {
}
}

StartPartnerFateRespawnTimer(fate: NMInfo) {
if (!fate.partnerFateId || !fate.partnerFateRespawnMinutes)
return;

const partnerFate = Object.values(this.nms).find(
(nm) => nm.fateId === fate.partnerFateId,
);

if (!partnerFate) {
this.DebugPrint(
`Partner FATE ${fate.partnerFateId} not found for ${this.TransByDispLang(fate.label)}`,
);
return;
}

partnerFate.respawnTimeMsLocal = Date.now() + fate.partnerFateRespawnMinutes * 60 * 1000;

partnerFate.element?.classList.remove('nm-hidden');
partnerFate.element?.classList.remove('nm-pop');
partnerFate.element?.classList.add('nm-down');

if (partnerFate.progressElement)
partnerFate.progressElement.innerText = '';

this.DebugPrint(
`Started ${fate.partnerFateRespawnMinutes} minute timer for partner FATE: ${
this.TransByDispLang(partnerFate.label)
}`,
);
}

OnFateKill(fate: NMInfo) {
this.DebugPrint(`OnFateKill: ${this.TransByDispLang(fate.label)}`);
this.StartPartnerFateRespawnTimer(fate);
this.UpdateTimes();
if (fate.element?.classList.contains('nm-pop')) {
if (this.zoneInfo?.onlyShowInactiveWithExplicitRespawns && !fate.respawnMinutes)
Expand Down Expand Up @@ -586,71 +621,79 @@ class EurekaTracker {
return;
const nowMs = +new Date();

const primaryWeatherList = this.zoneInfo?.primaryWeather;
const currentWeather = getWeather(nowMs, zoneId);
if (primaryWeatherList) {
for (let i = 0; i < numWeatherElem; ++i) {
const iconElem = document.getElementById(`label-weather-icon${i}`);
const textElem = document.getElementById(`label-weather-text${i}`);
if (!iconElem || !textElem)
throw new UnreachableCode();
iconElem.innerHTML = '';
textElem.innerHTML = '';
}
const weatherContainer = document.getElementById('label-weather-container');
const labelTime = document.getElementById('label-time');

primaryWeatherList.forEach((primaryWeather, i) => {
const weatherIcon = gWeatherIcons[primaryWeather];
let weatherStr = '';
if (currentWeather === primaryWeather) {
const stopTime = findNextWeatherNot(nowMs, zoneId, primaryWeather);
weatherStr = this.TransByDispLang(this.options.timeStrings.weatherFor)(nowMs, stopTime);
} else {
const startTime = findNextWeather(nowMs, zoneId, primaryWeather);
if (startTime !== undefined)
weatherStr = this.TransByDispLang(this.options.timeStrings.weatherIn)(nowMs, startTime);
}
const iconElem = document.getElementById(`label-weather-icon${i}`);
const textElem = document.getElementById(`label-weather-text${i}`);
if (!iconElem || !textElem)
throw new UnreachableCode();
if (!weatherContainer || !labelTime)
throw new UnreachableCode();

weatherContainer.classList.toggle('hidden', this.options.HideWeather);
labelTime.classList.toggle('weather-hidden', this.options.HideWeather);

if (!this.options.HideWeather) {
const primaryWeatherList = this.zoneInfo?.primaryWeather;
const currentWeather = getWeather(nowMs, zoneId);

if (primaryWeatherList) {
primaryWeatherList.forEach((primaryWeather, i) => {
const weatherIcon = gWeatherIcons[primaryWeather];
let weatherStr = '';
if (currentWeather === primaryWeather) {
const stopTime = findNextWeatherNot(nowMs, zoneId, primaryWeather);
weatherStr = this.TransByDispLang(this.options.timeStrings.weatherFor)(nowMs, stopTime);
} else {
const startTime = findNextWeather(nowMs, zoneId, primaryWeather);
if (startTime !== undefined) {
weatherStr = this.TransByDispLang(this.options.timeStrings.weatherIn)(
nowMs,
startTime,
);
}
}
const iconElem = document.getElementById(`label-weather-icon${i}`);
const textElem = document.getElementById(`label-weather-text${i}`);
if (!iconElem || !textElem)
throw new UnreachableCode();

iconElem.innerHTML = weatherIcon ?? '';
textElem.innerHTML = weatherStr;
});
} else if (currentWeather !== undefined) {
const stopTime = findNextWeatherNot(nowMs, zoneId, currentWeather);
const weatherIcon = gWeatherIcons[currentWeather];
let weatherStr = this.TransByDispLang(this.options.timeStrings.weatherFor)(nowMs, stopTime);

const iconElem = document.getElementById('label-weather-icon0');
const textElem = document.getElementById('label-weather-text0');

iconElem.innerHTML = weatherIcon ?? '';
textElem.innerHTML = weatherStr;
});
} else if (currentWeather !== undefined) {
const stopTime = findNextWeatherNot(nowMs, zoneId, currentWeather);
const weatherIcon = gWeatherIcons[currentWeather];
let weatherStr = this.TransByDispLang(this.options.timeStrings.weatherFor)(nowMs, stopTime);

const iconElem = document.getElementById(`label-weather-icon0`);
const textElem = document.getElementById(`label-weather-text0`);
if (!iconElem || !textElem)
throw new UnreachableCode();
iconElem.innerHTML = weatherIcon ?? '';
textElem.innerHTML = weatherStr;

// round up current time
let lastTime = nowMs;
let lastWeather = currentWeather;
for (let i = 1; i < 5; ++i) {
const startTime = findNextWeatherNot(lastTime, zoneId, lastWeather);
if (startTime === undefined)
continue;
const weather = getWeather(startTime + 1, zoneId);
if (weather === undefined)
continue;
const weatherIcon = gWeatherIcons[weather];
weatherStr = this.TransByDispLang(this.options.timeStrings.weatherIn)(nowMs, startTime);

const iconElem = document.getElementById(`label-weather-icon${i}`);
const textElem = document.getElementById(`label-weather-text${i}`);
if (!iconElem || !textElem)
throw new UnreachableCode();

iconElem.innerHTML = weatherIcon ?? '';
textElem.innerHTML = weatherStr;
lastTime = startTime;
lastWeather = weather;

let lastTime = nowMs;
let lastWeather = currentWeather;

for (let i = 1; i < numWeatherElem; ++i) {
const startTime = findNextWeatherNot(lastTime, zoneId, lastWeather);
if (startTime === undefined)
continue;
const weather = getWeather(startTime + 1, zoneId);
if (weather === undefined)
continue;
const weatherIcon = gWeatherIcons[weather];
weatherStr = this.TransByDispLang(this.options.timeStrings.weatherIn)(nowMs, startTime);

const iconElem = document.getElementById(`label-weather-icon${i}`);
const textElem = document.getElementById(`label-weather-text${i}`);
if (!iconElem || !textElem)
throw new UnreachableCode();

iconElem.innerHTML = weatherIcon ?? '';
textElem.innerHTML = weatherStr;
lastTime = startTime;
lastWeather = weather;
}
}
}

Expand Down
8 changes: 8 additions & 0 deletions ui/eureka/eureka_config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ UserConfig.registerOptions('eureka', {
type: 'checkbox',
default: false,
},
{
id: 'HideWeather',
name: {
en: 'Hide weather information',
},
type: 'checkbox',
default: false,
},
{
id: 'PopNoiseForNM',
name: {
Expand Down
Loading