generated from nhcarrigan/template
Reviewed-on: https://codeberg.org/nhcarrigan/tingle-bot/pulls/2 Co-authored-by: Naomi Carrigan <commits@nhcarrigan.com> Co-committed-by: Naomi Carrigan <commits@nhcarrigan.com>
76 lines
1.9 KiB
TypeScript
76 lines
1.9 KiB
TypeScript
/**
|
|
* @copyright nhcarrigan
|
|
* @license Naomi's Public License
|
|
* @author Naomi Carrigan
|
|
*/
|
|
import { join } from "node:path";
|
|
import type { PrecipitationName }
|
|
from "../../interfaces/weather/names/precipitationName.js";
|
|
import type { SpecialName }
|
|
from "../../interfaces/weather/names/specialName.js";
|
|
|
|
/**
|
|
* Checks if the current weather conditions have an overlay.
|
|
* @param name - The name of the weather condition to look for.
|
|
* @returns The file path to the overlay, or null if there is no overlay.
|
|
*/
|
|
export const getOverlayImage = (
|
|
name: SpecialName | PrecipitationName,
|
|
): string | null => {
|
|
let fileName: string | null = null;
|
|
switch (name) {
|
|
case "Blight Rain":
|
|
fileName = "ROOTS-blightrain.png";
|
|
break;
|
|
case "Blizzard":
|
|
fileName = "ROOTS-blizzard.png";
|
|
break;
|
|
case "Cinder Storm":
|
|
fileName = "ROOTS-cinderstorm.png";
|
|
break;
|
|
case "Cloudy":
|
|
case "Partly Cloudy":
|
|
fileName = "ROOTS-cloudy.png";
|
|
break;
|
|
case "Fog":
|
|
fileName = "ROOTS-fog.png";
|
|
break;
|
|
case "Hail":
|
|
fileName = "ROOTS-hail.png";
|
|
break;
|
|
case "Heat Lightning":
|
|
fileName = "ROOTS-heatlightning.png";
|
|
break;
|
|
case "Rain":
|
|
case "Light Rain":
|
|
case "Heavy Rain":
|
|
fileName = "ROOTS-rain.png";
|
|
break;
|
|
case "Rainbow":
|
|
fileName = "ROOTS-rainbow.png";
|
|
break;
|
|
case "Sleet":
|
|
fileName = "ROOTS-sleet.png";
|
|
break;
|
|
case "Snow":
|
|
case "Light Snow":
|
|
case "Heavy Snow":
|
|
fileName = "ROOTS-snow.png";
|
|
break;
|
|
case "Thundersnow":
|
|
fileName = "ROOTS-thundersnow.png";
|
|
break;
|
|
case "Thunderstorm":
|
|
fileName = "ROOTS-thunderstorm.png";
|
|
break;
|
|
default:
|
|
fileName = null;
|
|
}
|
|
if (fileName === null) {
|
|
return null;
|
|
}
|
|
|
|
const filePath = join(process.cwd(), "src", "assets", "overlays", fileName);
|
|
return filePath;
|
|
};
|