From d438d02f5d397f326c44c8ca9663db50c73ba01d Mon Sep 17 00:00:00 2001 From: June Rhodes Date: Sat, 6 Jul 2019 21:35:58 -0700 Subject: [PATCH 1/2] Experimental support connecting to Papyrus bot --- PapyrusCs/Options.cs | 3 ++ PapyrusCs/Program.cs | 8 ++-- PapyrusCs/map.thtml | 89 +++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 96 insertions(+), 4 deletions(-) diff --git a/PapyrusCs/Options.cs b/PapyrusCs/Options.cs index d699eb5..df93d96 100644 --- a/PapyrusCs/Options.cs +++ b/PapyrusCs/Options.cs @@ -98,6 +98,9 @@ public class Options [Option("use_leaflet_legacy", Required = false, Default = false, HelpText = "Use the legacy leaflet.js map renderer instead of the new OpenLayers version")] public bool UseLeafletLegacy { get; set; } + [Option("bot_websocket_url", Required = false, Default = "", HelpText = "If you're using Papyrus Bot to monitor chat and player position, provide it's WebSocket URL here")] + public string BotWebsocketUrl { get; set; } + // Derivative options public bool Loaded { get; set; } diff --git a/PapyrusCs/Program.cs b/PapyrusCs/Program.cs index 0cc5bee..31d0073 100644 --- a/PapyrusCs/Program.cs +++ b/PapyrusCs/Program.cs @@ -562,7 +562,7 @@ private static int RunMapCommand(Options options) WriteMapHtml(tileSize, options.OutputPath, options.MapHtml, strat.GetSettings(), strat.IsUpdate, - options.UseLeafletLegacy); + options.UseLeafletLegacy, options.BotWebsocketUrl); strat.Finish(); Console.WriteLine("Total Time {0}", _time.Elapsed); @@ -654,10 +654,11 @@ private class GlobalConfig public double factor; public int globalMinZoom; public int globalMaxZoom; + public string botWebSocketUrl; } private static void WriteMapHtml(int tileSize, string outputPath, string mapHtmlFile, Settings[] settings, - bool isUpdate, bool useLegacyLeaflet) + bool isUpdate, bool useLegacyLeaflet, string botWebSocketUrl) { try { @@ -695,7 +696,8 @@ private static void WriteMapHtml(int tileSize, string outputPath, string mapHtml { factor = (Math.Pow(2, settings.First().MaxZoom - 4)), globalMaxZoom = settings.First(x => x.Dimension == settings.Min(y => y.Dimension)).MaxZoom, - globalMinZoom = settings.First(x => x.Dimension == settings.Min(y => y.Dimension)).MinZoom + globalMinZoom = settings.First(x => x.Dimension == settings.Min(y => y.Dimension)).MinZoom, + botWebSocketUrl = botWebSocketUrl, }; mapHtmlContext = mapHtmlContext.Replace( diff --git a/PapyrusCs/map.thtml b/PapyrusCs/map.thtml index f3ef9d0..35a6661 100644 --- a/PapyrusCs/map.thtml +++ b/PapyrusCs/map.thtml @@ -60,6 +60,7 @@ >
+ From 3c4f7fd585debeb25216eae397cb3bef793cc985 Mon Sep 17 00:00:00 2001 From: June Rhodes Date: Sun, 7 Jul 2019 03:03:53 -0700 Subject: [PATCH 2/2] Fix chat in map template --- PapyrusCs/map.thtml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/PapyrusCs/map.thtml b/PapyrusCs/map.thtml index 35a6661..3cc6d1f 100644 --- a/PapyrusCs/map.thtml +++ b/PapyrusCs/map.thtml @@ -37,6 +37,22 @@ right: 0.5em; width: 150px; } + + #chat { + position: absolute; + width: 25vw; + min-width: 300px; + bottom: 0; + background-color: rgba(0, 0, 0, 0.5); + min-height: 10em; + display: flex; + flex-direction: column-reverse; + padding: 5px; + } + + #chat span { + color: white; + }