@@ -254,17 +254,17 @@ on('ready', () => {
254
254
return `${ moonIcons [ phase ] || "🌑" } ${ name } : ${ tPhase ( phase ) } ` ;
255
255
} ) . join ( "<br>" ) ;
256
256
257
- let html = `<div style="${ chatStyle } ">` ;
258
- html += `<div style="${ styleTitle } ">${ t ( 'weather' ) } </div>` ;
259
- html += `<div><b>${ t ( 'date' ) } :</b> ${ lang ( ) === 'fr' ? `${ dayName } ${ c . day } ${ monthName } ${ c . year } ` : `${ monthName } ${ c . day } , ${ c . year } (${ dayName } )` } </div>` ;
260
- html += `<div style="${ styleSection } ">${ t ( 'season' ) } :</div> ${ seasonIcons [ season ] } ${ tSeason ( season ) } ` ;
261
- html += `${ hr } <div style="${ styleSection } ">${ t ( 'moon' ) } :</div><div>${ moon } </div>${ hr } ` ;
262
- html += `<div style="${ styleSection } ">${ t ( 'climate' ) } :</div> ${ climateIcons [ state . WeatherMod . selectedClimate ] } ${ tClimate ( state . WeatherMod . selectedClimate ) } ` ;
263
- html += `<div><b>${ t ( 'temperature' ) } :</b> ${ temp } °C ${ tempIcon ( temp ) } </div>` ;
264
- html += `<div><b>${ t ( 'humidity' ) } :</b> ${ humidity } ${ humidity !== "-" ? "%" : "" } ${ humidity !== "-" ? humidityIcon ( humidity ) : "" } </div>` ;
265
- html += `<div><b>${ t ( 'wind' ) } :</b> ${ tWindForce ( windForce . name ) } (${ windSpeed } km/h) ${ t ( 'windFrom' ) } ${ tWindDir ( windOrigin ) } ${ windSpeedIcon ( windSpeed ) } </div>` ;
266
- html += `<div><b>${ t ( 'precipitation' ) } :</b> ${ precipStrength } </div>` ;
267
- html += `</div>` ;
257
+ let html = `<div style="${ chatStyle } ">`
258
+ + `<div style="${ styleTitle } ">${ t ( 'weather' ) } </div>`
259
+ + `<div><b>${ t ( 'date' ) } :</b> ${ lang ( ) === 'fr' ? `${ dayName } ${ c . day } ${ monthName } ${ c . year } ` : `${ monthName } ${ c . day } , ${ c . year } (${ dayName } )` } </div>`
260
+ + `<div style="${ styleSection } ">${ t ( 'season' ) } :</div> ${ seasonIcons [ season ] } ${ tSeason ( season ) } `
261
+ + `${ hr } <div style="${ styleSection } ">${ t ( 'moon' ) } :</div><div>${ moon } </div>${ hr } `
262
+ + `<div style="${ styleSection } ">${ t ( 'climate' ) } :</div> ${ climateIcons [ state . WeatherMod . selectedClimate ] } ${ tClimate ( state . WeatherMod . selectedClimate ) } `
263
+ + `<div><b>${ t ( 'temperature' ) } :</b> ${ temp } °C ${ tempIcon ( temp ) } </div>`
264
+ + `<div><b>${ t ( 'humidity' ) } :</b> ${ humidity } ${ humidity !== "-" ? "%" : "" } ${ humidity !== "-" ? humidityIcon ( humidity ) : "" } </div>`
265
+ + `<div><b>${ t ( 'wind' ) } :</b> ${ tWindForce ( windForce . name ) } (${ windSpeed } km/h) ${ t ( 'windFrom' ) } ${ tWindDir ( windOrigin ) } ${ windSpeedIcon ( windSpeed ) } </div>`
266
+ + `<div><b>${ t ( 'precipitation' ) } :</b> ${ precipStrength } </div>`
267
+ + `</div>` ;
268
268
return html ;
269
269
} ;
270
270
@@ -279,74 +279,73 @@ on('ready', () => {
279
279
280
280
// Styled menus
281
281
const showGMMainMenu = ( ) => {
282
- const s = state . WeatherMod ;
283
- const climates = Object . keys ( WeatherConfig . climates ) . map ( climate =>
284
- `<a style="${ btnStyle } " href="!weather setgm climate ${ climate } ">${ climateIcons [ climate ] } ${ tClimate ( climate ) } </a>`
285
- ) . join ( " " ) ;
286
-
287
- const html = `<div style="${ chatStyle } ">
288
- <div style="${ styleTitle } ">${ t ( 'weather' ) } </div>${ hr }
289
- <div style="${ styleSection } ">${ t ( 'climate' ) } :</div> ${ climateIcons [ s . selectedClimate ] } ${ tClimate ( s . selectedClimate ) } <br>
290
- ${ btnGroup ( climates ) } ${ hr }
291
- <div style="${ styleSection } ">${ t ( 'language' ) } :</div> ${ s . language . toUpperCase ( ) } <br>
292
- ${ btnGroup ( `<a style="${ btnStyle } " href="!weather lang en">EN</a> <a style="${ btnStyle } " href="!weather lang fr">FR</a>` ) } ${ hr }
293
- ${ btnGroup ( `<a style="${ btnStyle } " href="!weather menu-date">📅 ${ t ( 'date' ) } </a>` ) }
294
- ${ btnGroup ( `<a style="${ btnStyle } " href="!weather menu-manual">🛠 ${ t ( 'manual' ) } </a>` ) }
295
- ${ btnGroup ( `<a style="${ btnStyle } " href="!weather menu-profiles">💾 ${ t ( 'profiles' ) } </a>` ) }
296
- ${ btnGroup ( `<a style="${ btnStyle } " href="!weather report">🌦 ${ t ( 'generate' ) } </a>` ) }
297
- ${ btnGroup ( `<a style="${ btnStyle } " href="!weather showplayers">📣 ${ t ( 'weather' ) } → Players</a>` ) }
298
- </div>` ;
299
- sendChat ( "WeatherMod" , `/w gm ${ html } ` ) ;
300
- } ;
282
+ const s = state . WeatherMod ;
283
+ const climates = Object . keys ( WeatherConfig . climates ) . map ( climate =>
284
+ `<a style="${ btnStyle } " href="!weather setgm climate ${ climate } ">${ climateIcons [ climate ] } ${ tClimate ( climate ) } </a>`
285
+ ) . join ( " " ) ;
286
+
287
+ const html = `<div style="${ chatStyle } ">`
288
+ + ` <div style="${ styleTitle } ">${ t ( 'weather' ) } </div>${ hr } `
289
+ + ` <div style="${ styleSection } ">${ t ( 'climate' ) } :</div> ${ climateIcons [ s . selectedClimate ] } ${ tClimate ( s . selectedClimate ) } <br>`
290
+ + ` ${ btnGroup ( climates ) } ${ hr } `
291
+ + ` <div style="${ styleSection } ">${ t ( 'language' ) } :</div> ${ s . language . toUpperCase ( ) } <br>`
292
+ + ` ${ btnGroup ( `<a style="${ btnStyle } " href="!weather lang en">EN</a> <a style="${ btnStyle } " href="!weather lang fr">FR</a>` ) } ${ hr } `
293
+ + ` ${ btnGroup ( `<a style="${ btnStyle } " href="!weather menu-date">📅 ${ t ( 'date' ) } </a>` ) } `
294
+ + ` ${ btnGroup ( `<a style="${ btnStyle } " href="!weather menu-manual">🛠 ${ t ( 'manual' ) } </a>` ) } `
295
+ + ` ${ btnGroup ( `<a style="${ btnStyle } " href="!weather menu-profiles">💾 ${ t ( 'profiles' ) } </a>` ) } `
296
+ + ` ${ btnGroup ( `<a style="${ btnStyle } " href="!weather report">🌦 ${ t ( 'generate' ) } </a>` ) } `
297
+ + ` ${ btnGroup ( `<a style="${ btnStyle } " href="!weather showplayers">📣 ${ t ( 'weather' ) } → Players</a>` ) } `
298
+ + ` </div>`;
299
+ sendChat ( "WeatherMod" , `/w gm ${ html } ` ) ;
300
+ } ;
301
301
302
- const showDateMenu = ( ) => {
303
- const c = state . WeatherMod . calendar ;
304
- const months = CalendarConfig . months . map ( ( m , i ) =>
305
- `<a style="${ btnStyle } " href="!weather setgm month ${ i } ">${ m . name } </a>`
306
- ) . join ( " " ) ;
307
- const html = `<div style="${ chatStyle } ">
308
- <div style="${ styleTitle } ">${ t ( 'date' ) } </div>${ hr }
309
- ${ btnGroup ( `<a style="${ btnStyle } " href="!weather setgm day ?{${ t ( 'setDay' ) } |${ c . day } }">${ t ( 'setDay' ) } </a> <a style="${ btnStyle } " href="!weather setgm year ?{${ t ( 'setYear' ) } |${ c . year } }">${ t ( 'setYear' ) } </a>` ) }
310
- ${ hr } ${ btnGroup ( months ) } ${ hr }
311
- ${ btnGroup ( `<a style="${ btnStyle } " href="!weather menu">⬅️ ${ t ( 'back' ) } </a>` ) }
312
- </div>` ;
313
- sendChat ( "WeatherMod" , `/w gm ${ html } ` ) ;
314
- } ;
302
+ const showDateMenu = ( ) => {
303
+ const c = state . WeatherMod . calendar ;
304
+ const months = CalendarConfig . months . map ( ( m , i ) =>
305
+ `<a style="${ btnStyle } " href="!weather setgm month ${ i } ">${ m . name } </a>`
306
+ ) . join ( " " ) ;
307
+ const html = `<div style="${ chatStyle } ">`
308
+ + ` <div style="${ styleTitle } ">${ t ( 'date' ) } </div>${ hr } `
309
+ + ` ${ btnGroup ( `<a style="${ btnStyle } " href="!weather setgm day ?{${ t ( 'setDay' ) } |${ c . day } }">${ t ( 'setDay' ) } </a> <a style="${ btnStyle } " href="!weather setgm year ?{${ t ( 'setYear' ) } |${ c . year } }">${ t ( 'setYear' ) } </a>` ) } `
310
+ + ` ${ hr } ${ btnGroup ( months ) } ${ hr } `
311
+ + ` ${ btnGroup ( `<a style="${ btnStyle } " href="!weather menu">⬅️ ${ t ( 'back' ) } </a>` ) } `
312
+ + ` </div>`;
313
+ sendChat ( "WeatherMod" , `/w gm ${ html } ` ) ;
314
+ } ;
315
315
316
- const showManualWeatherMenu = ( ) => {
317
- const manual = state . WeatherMod . settings . manualWeather ;
318
- const weatherTypes = [ 'clear' , 'rain' , 'snow' , 'thunderstorm' ] . map ( type =>
319
- `<a style="${ btnStyle } " href="!weather setgm weathertype ${ type } ">${ skyIcons [ type ] } ${ t ( type ) } </a>`
320
- ) . join ( " " ) ;
321
- const windDirs = [ 'north' , 'east' , 'south' , 'west' ] . map ( dir =>
322
- `<a style="${ btnStyle } " href="!weather setgm winddir ${ dir } ">${ tWindDir ( dir ) } </a>`
323
- ) . join ( " " ) ;
324
-
325
- const html = `<div style="${ chatStyle } ">
326
- <div style="${ styleTitle } ">${ t ( 'manual' ) } </div>${ hr }
327
- <div style="${ styleSection } ">${ t ( 'manualMode' ) } :</div> <a style="${ btnStyle } " href="!weather setgm manual ${ state . WeatherMod . settings . useManualWeather ? "off" : "on" } ">${ state . WeatherMod . settings . useManualWeather ? "🟢" : "🔴" } ${ state . WeatherMod . settings . useManualWeather ? t ( 'yes' ) : t ( 'no' ) } </a><br><br>
328
- <div style="${ styleSection } ">${ t ( 'precipitation' ) } :</div>${ btnGroup ( weatherTypes ) } <br>
329
- <div><b>${ t ( 'temperature' ) } :</b> <a style="${ btnStyle } " href="!weather setgm temp ?{${ t ( 'temperature' ) } |${ manual . temperature } }">${ manual . temperature } °C</a></div>
330
- <div><b>${ t ( 'windSpeed' ) } :</b> <a style="${ btnStyle } " href="!weather setgm windspeed ?{${ t ( 'wind' ) } |${ manual . windSpeed } }">${ manual . windSpeed } km/h</a></div>
331
- <div><b>${ t ( 'windFrom' ) } :</b> ${ btnGroup ( windDirs ) } </div>
332
- <div><b>${ t ( 'humidityShort' ) } :</b> <a style="${ btnStyle } " href="!weather setgm humidity ?{${ t ( 'humidity' ) } |${ manual . humidity !== undefined ? manual . humidity : 50 } }">${ manual . humidity !== undefined ? manual . humidity : 50 } %</a></div>
333
- ${ hr } ${ btnGroup ( `<a style="${ btnStyle } " href="!weather menu">⬅️ ${ t ( 'back' ) } </a>` ) }
334
- </div>` ;
335
- sendChat ( "WeatherMod" , `/w gm ${ html } ` ) ;
336
- } ;
316
+ const showManualWeatherMenu = ( ) => {
317
+ const manual = state . WeatherMod . settings . manualWeather ;
318
+ const weatherTypes = [ 'clear' , 'rain' , 'snow' , 'thunderstorm' ] . map ( type =>
319
+ `<a style="${ btnStyle } " href="!weather setgm weathertype ${ type } ">${ skyIcons [ type ] } ${ t ( type ) } </a>`
320
+ ) . join ( " " ) ;
321
+ const windDirs = [ 'north' , 'east' , 'south' , 'west' ] . map ( dir =>
322
+ `<a style="${ btnStyle } " href="!weather setgm winddir ${ dir } ">${ tWindDir ( dir ) } </a>`
323
+ ) . join ( " " ) ;
324
+
325
+ const html = `<div style="${ chatStyle } ">`
326
+ + ` <div style="${ styleTitle } ">${ t ( 'manual' ) } </div>${ hr } `
327
+ + ` <div style="${ styleSection } ">${ t ( 'manualMode' ) } :</div> <a style="${ btnStyle } " href="!weather setgm manual ${ state . WeatherMod . settings . useManualWeather ? "off" : "on" } ">${ state . WeatherMod . settings . useManualWeather ? "🟢" : "🔴" } ${ state . WeatherMod . settings . useManualWeather ? t ( 'yes' ) : t ( 'no' ) } </a><br><br>`
328
+ + ` <div style="${ styleSection } ">${ t ( 'precipitation' ) } :</div>${ btnGroup ( weatherTypes ) } <br>`
329
+ + ` <div><b>${ t ( 'temperature' ) } :</b> <a style="${ btnStyle } " href="!weather setgm temp ?{${ t ( 'temperature' ) } |${ manual . temperature } }">${ manual . temperature } °C</a></div>`
330
+ + ` <div><b>${ t ( 'windSpeed' ) } :</b> <a style="${ btnStyle } " href="!weather setgm windspeed ?{${ t ( 'wind' ) } |${ manual . windSpeed } }">${ manual . windSpeed } km/h</a></div>`
331
+ + ` <div><b>${ t ( 'windFrom' ) } :</b> ${ btnGroup ( windDirs ) } </div>`
332
+ + ` <div><b>${ t ( 'humidityShort' ) } :</b> <a style="${ btnStyle } " href="!weather setgm humidity ?{${ t ( 'humidity' ) } |${ manual . humidity !== undefined ? manual . humidity : 50 } }">${ manual . humidity !== undefined ? manual . humidity : 50 } %</a></div>`
333
+ + ` ${ hr } ${ btnGroup ( `<a style="${ btnStyle } " href="!weather menu">⬅️ ${ t ( 'back' ) } </a>` ) } `
334
+ + ` </div>`;
335
+ sendChat ( "WeatherMod" , `/w gm ${ html } ` ) ;
336
+ } ;
337
337
338
- const showProfilesMenu = ( ) => {
339
- const html = `<div style="${ chatStyle } ">
340
- <div style="${ styleTitle } ">${ t ( 'profiles' ) } </div>${ hr }
341
- ${ btnGroup ( `
342
- <a style="${ btnStyle } " href="!weather save ?{Profile name}">${ t ( 'saveProfile' ) } </a><br>
343
- <a style="${ btnStyle } " href="!weather load ?{Profile name}">${ t ( 'loadProfile' ) } </a><br>
344
- <a style="${ btnStyle } " href="!weather export ?{Profile name}">${ t ( 'exportProfile' ) } </a><br>
345
- <a style="${ btnStyle } " href="!weather import ?{Profile name}">${ t ( 'importProfile' ) } </a><br>` ) }
346
- ${ hr } ${ btnGroup ( `<a style="${ btnStyle } " href="!weather menu">⬅️ ${ t ( 'back' ) } </a>` ) }
347
- </div>` ;
348
- sendChat ( "WeatherMod" , `/w gm ${ html } ` ) ;
349
- } ;
338
+ const showProfilesMenu = ( ) => {
339
+ const html = `<div style="${ chatStyle } ">`
340
+ + `<div style="${ styleTitle } ">${ t ( 'profiles' ) } </div>${ hr } `
341
+ + `${ btnGroup ( `<a style="${ btnStyle } " href="!weather save ?{Profile name}">${ t ( 'saveProfile' ) } </a><br>`
342
+ + `<a style="${ btnStyle } " href="!weather load ?{Profile name}">${ t ( 'loadProfile' ) } </a><br>`
343
+ + `<a style="${ btnStyle } " href="!weather export ?{Profile name}">${ t ( 'exportProfile' ) } </a><br>`
344
+ + `<a style="${ btnStyle } " href="!weather import ?{Profile name}">${ t ( 'importProfile' ) } </a><br>` ) } `;
345
+ + `${ hr } ${ btnGroup ( `<a style="${ btnStyle } " href="!weather menu">⬅️ ${ t ( 'back' ) } </a>` ) } `
346
+ + `</div>` ;
347
+ sendChat ( "WeatherMod" , `/w gm ${ html } ` ) ;
348
+ } ;
350
349
351
350
// Weather profiles
352
351
const saveWeatherProfile = ( name ) => {
@@ -579,3 +578,4 @@ on('ready', () => {
579
578
}
580
579
} ) ;
581
580
} ) ;
581
+
0 commit comments