From f42492cf778deec228f5a87ec32ac158bf1a2b5f Mon Sep 17 00:00:00 2001 From: Talic Date: Sat, 12 Mar 2022 19:04:54 +0200 Subject: [PATCH] introduced meter overlay, relics spawn in their locations after being given to the player, remove some buggy enemies --- README.md | 8 ++- SotnRandoTools/src/Constants/Khaos.cs | 6 +-- SotnRandoTools/src/Khaos/KhaosController.cs | 54 +++++++++++-------- SotnRandoTools/src/RandoTracker/Tracker.cs | 44 +++++++++++++++ SotnRandoTools/src/Services/Autosplitter.cs | 8 +-- .../Interfaces/INotificationService.cs | 2 +- .../Interfaces/IOverlaySocketServer.cs | 1 + .../src/Services/NotificationService.cs | 42 ++------------- .../src/Services/OverlaySocketServer.cs | 13 +++++ SotnRandoTools/src/SotnRandoTools.csproj | 2 +- 10 files changed, 111 insertions(+), 69 deletions(-) diff --git a/README.md b/README.md index 77a9b97..50dddeb 100644 --- a/README.md +++ b/README.md @@ -19,6 +19,7 @@ This tool and the accompanying library and app are open source. The idea is to i - [Usage](#usage) - [Updating](#updating) - [Autotracker](#autotracker) + - [Autosplitter](#autosplitter) - [Co-Op](#co-op) - [Khaos-Setup](#Khaos-Setup) - [Useful links](#useful-links) @@ -55,14 +56,17 @@ On lunching the tool it will check for a new release and inform the user. If the The new tracker has been re-written from the ground up for better performance and usability. Can be manually rescaled. Saves size and location. Locations are drawn on the game map. Supports OBS html widget overlay located in ```BizHawk\ExternalTools\SotnRandoTools\TrackerOverlay\autotracker.html``` and seed info text in ```BizHawk\ExternalTools\SotnRandoTools\TrackerOverlay\SeedInfo.txt``` +## Autosplitter +The autotracker will also automatically start, restart and split when Dracula dies if you have LiveSplit running. + ## Co-Op Coop requires the host to have the port they want to use forwarded. Hosting automatically copies your address(ip:port) to the clipboard. The other player uses that address to connect. Please be careful to not leak your IP! Bindings over at: [https://taliczealot.github.io/coop/](https://taliczealot.github.io/coop/) ## Khaos-Setup -Inside the folder ```BizHawk\ExternalTools\SotnRandoTools\Khaos\Overlay\``` you will find ```action-queue.html``` and ```timers.html``` which you can add in OBS as web sources. +Inside the folder ```BizHawk\ExternalTools\SotnRandoTools\Khaos\Overlay\``` you will find ```meter.html```, ```action-queue.html``` and ```timers.html``` which you can add in OBS as web sources. After starting Khaos you will be able to connect to Twitch and start Auto Khaos. -* Clickign "Connect to Twitch" will take you to a website to confirm that you allow SotN Rando Tools to manage Channel Points and see your subscribers. After accepting it will create custom Channel Point rewards for every action and listen for redemptions. When you disconnect or close Khaos the Custom Rewards should get deleted. Please wait for about 20 seconds for all the rewards to get deleted by the API. Redemptions get automatically fulfilled after about a minute and a half, before that the streamer can see them in the redemptions panel in the Khaos window and have the option to refund it. +* Clicking "Connect to Twitch" will take you to a website to confirm that you allow SotN Rando Tools to manage Channel Points and see your subscribers. After accepting it will create custom Channel Point rewards for every action and listen for redemptions. When you disconnect or close Khaos the Custom Rewards should get deleted. Please wait for about 20 seconds for all the rewards to get deleted by the API. Redemptions get automatically fulfilled after about a minute and a half, before that the streamer can see them in the redemptions panel in the Khaos window and have the option to refund it. * Auto Khaos automatically activates random actions periodically, adhering to the cooldowns. Action frequency is dependant on difficulty setting. ## Useful links diff --git a/SotnRandoTools/src/Constants/Khaos.cs b/SotnRandoTools/src/Constants/Khaos.cs index 178ce6b..90f4a3b 100644 --- a/SotnRandoTools/src/Constants/Khaos.cs +++ b/SotnRandoTools/src/Constants/Khaos.cs @@ -179,7 +179,7 @@ public static class Khaos new SearchableActor { Name="Blade Soldier", Hp = 16, Damage = 15, Sprite = 18404 }, new SearchableActor {Hp = 24, Damage = 12, Sprite = 20436 }, new SearchableActor { Name="Bloody Zombie Olrox's Quarters", Hp = 24, Damage = 10, Sprite = 15440 }, - new SearchableActor { Name="Olrox Bat", Hp = 13, Damage = 21, Sprite = 64244 }, + //new SearchableActor { Name="Olrox Bat", Hp = 13, Damage = 21, Sprite = 64244 }, new SearchableActor { Name="Olrox Skull", Hp = 15, Damage = 23, Sprite = 62980 }, new SearchableActor { Name="Spear Guard Caverns", Hp = 20, Damage = 12, Sprite = 49068 }, new SearchableActor { Name="Bat Caverns", Hp = 1, Damage = 16, Sprite = 36428 }, @@ -202,7 +202,7 @@ public static class Khaos new SearchableActor { Name="Gold Medusa Head Death Wing's Lair", Hp = 12, Damage = 7, Sprite = 45800 }, new SearchableActor { Name="Ghost Dancer", Hp = 30, Damage = 56, Sprite = 43916 }, new SearchableActor { Name="Werewolf Inverted Colosseum", Hp = 280, Damage = 40, Sprite = 29328 }, - new SearchableActor { Name="Zombie Trevor", Hp = 180, Damage = 40, Sprite = 37884 }, + //new SearchableActor { Name="Zombie Trevor", Hp = 180, Damage = 40, Sprite = 37884 }, new SearchableActor {Hp = 10, Damage = 66, Sprite = 14076 }, new SearchableActor {Hp = 43, Damage = 10, Sprite = 2536 }, new SearchableActor {Hp = 12, Damage = 7, Sprite = 9876 }, @@ -409,7 +409,7 @@ public static class Khaos public static uint WhiteTigerBallSpeedRight = 0x0000; public static string WhiteTigerBallSpeedName = "WhiteTigerBallSpeed"; - public static List FireballActorBytes = new List { 0x00, 0xC0, 0xB2, 0x00, 0x00, 0x00, 0xB3, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0xA2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x96, 0x00, 0x1A, 0x00, 0xDC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x08, 0x00, 0x00, 0x03, 0x00, 0x02, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x80, 0x00, 0x00, 0x04, 0x04, 0x00, 0x14, 0x00, 0x00, 0x98, 0x07, 0x0B, 0x80, 0x04, 0x00, 0x01, 0x00, 0x09, 0x00, 0x05, 0x00, 0x08 }; + public static List FireballActorBytes = new List { 0x00, 0xC0, 0xB2, 0x00, 0x00, 0x00, 0xB3, 0x00, 0x00, 0x80, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x96, 0x00, 0x1A, 0x00, 0xDC, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x08, 0x00, 0x00, 0x03, 0x00, 0x02, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x80, 0x00, 0x00, 0x04, 0x04, 0x00, 0x14, 0x00, 0x00, 0x98, 0x07, 0x0B, 0x80, 0x04, 0x00, 0x01, 0x00, 0x09, 0x00, 0x05, 0x00, 0x08 }; public static List DarkFireballActorBytes = new List { 0xE0, 0xBE, 0x7D, 0x00, 0x00, 0x00, 0xAF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x96, 0x00, 0x1B, 0x00, 0x40, 0x78, 0x12, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x08, 0x00, 0x00, 0x03, 0x00, 0x02, 0x00, 0x00, 0x00, 0x21, 0x00, 0x00, 0x80, 0x00, 0x00, 0x08, 0x08, 0x00, 0x04, 0x00, 0x00, 0xC8, 0x07, 0x0B, 0x80, 0x17, 0x00, 0x01, 0x00, 0x09, 0x00, 0x09, 0x00, 0x08 }; public static string[] AcceptedMusicTrackTitles = diff --git a/SotnRandoTools/src/Khaos/KhaosController.cs b/SotnRandoTools/src/Khaos/KhaosController.cs index 50a72d7..65a2114 100644 --- a/SotnRandoTools/src/Khaos/KhaosController.cs +++ b/SotnRandoTools/src/Khaos/KhaosController.cs @@ -85,7 +85,9 @@ public class KhaosController : IKhaosController private Cheat music; #endregion + private int khaosMeter = 0; private int totalMeterGained = 0; + private int pandoraProgress = 0; private bool pandoraUsed = false; private uint alucardMapX = 0; private uint alucardMapY = 0; @@ -383,7 +385,7 @@ public void Gamble(string user = "Khaos") } public void KhaoticBurst(string user = "Khaos") { - notificationService.KhaosMeter += 100; + GainKhaosMeter(100); notificationService.AddMessage($"{user} used Khaotic Burst"); Alert(toolConfig.Khaos.Actions[(int) Enums.Action.KhaoticBurst]); } @@ -493,7 +495,7 @@ public void SubweaponsOnly(string user = "Khaos") } sotnApi.AlucardApi.Subweapon = (Subweapon) roll; sotnApi.AlucardApi.ActivatePotion(Potion.SmartPotion); - sotnApi.AlucardApi.GrantRelic(Relic.CubeOfZoe); + sotnApi.AlucardApi.GrantRelic(Relic.CubeOfZoe, true); if (sotnApi.AlucardApi.HasRelic(Relic.GasCloud)) { sotnApi.AlucardApi.TakeRelic(Relic.GasCloud); @@ -831,7 +833,7 @@ void GiveRewards(string user, string item, int relic, int roll) case 2: Console.WriteLine($"Heavy help rolled: {Constants.Khaos.ProgressionRelics[relic]}"); SetRelicLocationDisplay(Constants.Khaos.ProgressionRelics[relic], false); - sotnApi.AlucardApi.GrantRelic(Constants.Khaos.ProgressionRelics[relic]); + sotnApi.AlucardApi.GrantRelic(Constants.Khaos.ProgressionRelics[relic], true); notificationService.AddMessage($"{user} gave you {Constants.Khaos.ProgressionRelics[relic]}"); break; default: @@ -874,16 +876,16 @@ public void Magician(string user = "Khaos") SpendKhaosMeter(); SetRelicLocationDisplay(Relic.SoulOfBat, false); SetRelicLocationDisplay(Relic.FormOfMist, false); - sotnApi.AlucardApi.GrantRelic(Relic.SoulOfBat); - sotnApi.AlucardApi.GrantRelic(Relic.FireOfBat); - sotnApi.AlucardApi.GrantRelic(Relic.EchoOfBat); - sotnApi.AlucardApi.GrantRelic(Relic.ForceOfEcho); - sotnApi.AlucardApi.GrantRelic(Relic.SoulOfWolf); - sotnApi.AlucardApi.GrantRelic(Relic.PowerOfWolf); - sotnApi.AlucardApi.GrantRelic(Relic.SkillOfWolf); - sotnApi.AlucardApi.GrantRelic(Relic.FormOfMist); - sotnApi.AlucardApi.GrantRelic(Relic.PowerOfMist); - sotnApi.AlucardApi.GrantRelic(Relic.GasCloud); + sotnApi.AlucardApi.GrantRelic(Relic.SoulOfBat, true); + sotnApi.AlucardApi.GrantRelic(Relic.FireOfBat, true); + sotnApi.AlucardApi.GrantRelic(Relic.EchoOfBat, true); + sotnApi.AlucardApi.GrantRelic(Relic.ForceOfEcho, true); + sotnApi.AlucardApi.GrantRelic(Relic.SoulOfWolf, true); + sotnApi.AlucardApi.GrantRelic(Relic.PowerOfWolf, true); + sotnApi.AlucardApi.GrantRelic(Relic.SkillOfWolf, true); + sotnApi.AlucardApi.GrantRelic(Relic.FormOfMist, true); + sotnApi.AlucardApi.GrantRelic(Relic.PowerOfMist, true); + sotnApi.AlucardApi.GrantRelic(Relic.GasCloud, true); } sotnApi.AlucardApi.GrantItemByName("Wizard hat"); @@ -929,7 +931,7 @@ public void MeltyBlood(string user = "Khaos") hitbox2Width.Enable(); hitbox2Height.Enable(); SetRelicLocationDisplay(Relic.LeapStone, false); - sotnApi.AlucardApi.GrantRelic(Relic.LeapStone); + sotnApi.AlucardApi.GrantRelic(Relic.LeapStone, true); meltyTimer.Start(); string message = meterFull ? $"{user} activated GUILTY GEAR" : $"{user} activated Melty Blood"; notificationService.AddMessage(message); @@ -1876,7 +1878,7 @@ private void RandomizeRelicsActivate(bool randomizeVladRelics = true) if ((int) relic < 25) { SetRelicLocationDisplay((Relic) relic, false); - sotnApi.AlucardApi.GrantRelic((Relic) relic); + sotnApi.AlucardApi.GrantRelic((Relic) relic, true); } } else @@ -1899,14 +1901,14 @@ private void RandomizeRelicsActivate(bool randomizeVladRelics = true) foreach (Relic relic in Constants.Khaos.FlightRelics[roll]) { SetRelicLocationDisplay((Relic) relic, false); - sotnApi.AlucardApi.GrantRelic((Relic) relic); + sotnApi.AlucardApi.GrantRelic((Relic) relic, true); } } if (IsInRoomList(Constants.Khaos.SwitchRoom)) { SetRelicLocationDisplay(Relic.JewelOfOpen, false); - sotnApi.AlucardApi.GrantRelic(Relic.JewelOfOpen); + sotnApi.AlucardApi.GrantRelic(Relic.JewelOfOpen, true); } } private void RandomizeEquipmentSlots() @@ -2141,7 +2143,7 @@ private void SubweaponsOnlyOff(object sender, EventArgs e) hearts.Disable(); if (gasCloudTaken) { - sotnApi.AlucardApi.GrantRelic(Relic.GasCloud); + sotnApi.AlucardApi.GrantRelic(Relic.GasCloud, true); gasCloudTaken = false; } subweaponsOnlyTimer.Stop(); @@ -3228,16 +3230,26 @@ private void CheckDashInput() } private bool KhaosMeterFull() { - return notificationService.KhaosMeter >= 100; + return khaosMeter >= 100; } private void GainKhaosMeter(short meter) { - notificationService.KhaosMeter += meter; + khaosMeter += meter; totalMeterGained += meter; + + notificationService.UpdateOverlayMeter(khaosMeter); + + if (!pandoraUsed && pandoraProgress < 6 && totalMeterGained >= (toolConfig.Khaos.PandoraTrigger / 7) * (pandoraProgress + 1)) + { + string label = "PANDORA"; + notificationService.AddMessage(label.Substring(0, pandoraProgress + 1)); + pandoraProgress++; + } } private void SpendKhaosMeter() { - notificationService.KhaosMeter -= 100; + khaosMeter -= 100; + notificationService.UpdateOverlayMeter(khaosMeter); } private void Alert(Configuration.Models.Action action) { diff --git a/SotnRandoTools/src/RandoTracker/Tracker.cs b/SotnRandoTools/src/RandoTracker/Tracker.cs index 9b813b7..4d6e2cf 100644 --- a/SotnRandoTools/src/RandoTracker/Tracker.cs +++ b/SotnRandoTools/src/RandoTracker/Tracker.cs @@ -650,66 +650,110 @@ private void UpdateRelics() { VladRelicLocationDisplay.HeartOfVladLocation = location is not null ? location.Name : ""; } + else + { + VladRelicLocationDisplay.HeartOfVladLocation = String.Empty; + } break; case "ToothOfVlad": if (VladRelicLocationDisplay.ToothOfVladLocation == String.Empty) { VladRelicLocationDisplay.ToothOfVladLocation = location is not null ? location.Name : ""; } + else + { + VladRelicLocationDisplay.ToothOfVladLocation = String.Empty; + } break; case "RibOfVlad": if (VladRelicLocationDisplay.RibOfVladLocation == String.Empty) { VladRelicLocationDisplay.RibOfVladLocation = location is not null ? location.Name : ""; } + else + { + VladRelicLocationDisplay.RibOfVladLocation = String.Empty; + } break; case "RingOfVlad": if (VladRelicLocationDisplay.RingOfVladLocation == String.Empty) { VladRelicLocationDisplay.RingOfVladLocation = location is not null ? location.Name : ""; } + else + { + VladRelicLocationDisplay.RingOfVladLocation = String.Empty; + } break; case "EyeOfVlad": if (VladRelicLocationDisplay.EyeOfVladLocation == String.Empty) { VladRelicLocationDisplay.EyeOfVladLocation = location is not null ? location.Name : ""; } + else + { + VladRelicLocationDisplay.EyeOfVladLocation = String.Empty; + } break; case "SoulOfBat": if (VladRelicLocationDisplay.BatLocation == String.Empty) { VladRelicLocationDisplay.BatLocation = location is not null ? location.Name : ""; } + else + { + VladRelicLocationDisplay.BatLocation = String.Empty; + } break; case "FormOfMist": if (VladRelicLocationDisplay.MistLocation == String.Empty) { VladRelicLocationDisplay.MistLocation = location is not null ? location.Name : ""; } + else + { + VladRelicLocationDisplay.MistLocation = String.Empty; + } break; case "JewelOfOpen": if (VladRelicLocationDisplay.JewelOfOpenLocation == String.Empty) { VladRelicLocationDisplay.JewelOfOpenLocation = location is not null ? location.Name : ""; } + else + { + VladRelicLocationDisplay.JewelOfOpenLocation = String.Empty; + } break; case "GravityBoots": if (VladRelicLocationDisplay.GravityBootsLocation == String.Empty) { VladRelicLocationDisplay.GravityBootsLocation = location is not null ? location.Name : ""; } + else + { + VladRelicLocationDisplay.GravityBootsLocation = String.Empty; + } break; case "LeapStone": if (VladRelicLocationDisplay.LepastoneLocation == String.Empty) { VladRelicLocationDisplay.LepastoneLocation = location is not null ? location.Name : ""; } + else + { + VladRelicLocationDisplay.LepastoneLocation = String.Empty; + } break; case "MermanStatue": if (VladRelicLocationDisplay.MermanLocation == String.Empty) { VladRelicLocationDisplay.MermanLocation = location is not null ? location.Name : ""; } + else + { + VladRelicLocationDisplay.MermanLocation = String.Empty; + } break; default: break; diff --git a/SotnRandoTools/src/Services/Autosplitter.cs b/SotnRandoTools/src/Services/Autosplitter.cs index 29da2e3..cb87633 100644 --- a/SotnRandoTools/src/Services/Autosplitter.cs +++ b/SotnRandoTools/src/Services/Autosplitter.cs @@ -22,10 +22,11 @@ public bool AtemptConnect() { try { - pipeClient.Connect(10); + pipeClient.Connect(5); } - catch + catch (Exception e) { + Console.WriteLine("Could not connect. " + e.Message); } return false; } @@ -36,7 +37,6 @@ public bool AtemptConnect() } } - public void StartTImer() { SendString("starttimer"); @@ -96,7 +96,7 @@ private void SendString(string data) } catch (Exception e) { - Console.WriteLine(e.Message); + Console.WriteLine("Pipe Error:" + e.Message); } } } diff --git a/SotnRandoTools/src/Services/Interfaces/INotificationService.cs b/SotnRandoTools/src/Services/Interfaces/INotificationService.cs index 40e28eb..acd0a00 100644 --- a/SotnRandoTools/src/Services/Interfaces/INotificationService.cs +++ b/SotnRandoTools/src/Services/Interfaces/INotificationService.cs @@ -6,12 +6,12 @@ namespace SotnRandoTools.Services public interface INotificationService { double Volume { set; } - short KhaosMeter { get; set; } void AddMessage(string message); void PlayAlert(string uri); void StartOverlayServer(); void StopOverlayServer(); + void UpdateOverlayMeter(int meter); void AddOverlayTimer(string name, int duration); void UpdateOverlayQueue(List actionQueue); void UpdateTrackerOverlay(int relics, int items); diff --git a/SotnRandoTools/src/Services/Interfaces/IOverlaySocketServer.cs b/SotnRandoTools/src/Services/Interfaces/IOverlaySocketServer.cs index 5b1bb47..ee1183d 100644 --- a/SotnRandoTools/src/Services/Interfaces/IOverlaySocketServer.cs +++ b/SotnRandoTools/src/Services/Interfaces/IOverlaySocketServer.cs @@ -7,6 +7,7 @@ public interface IOverlaySocketServer { void StartServer(); void StopServer(); + void UpdateMeter(int meter); void AddTimer(string name, int duration); void UpdateQueue(List actionQueue); void UpdateTracker(int relics, int items); diff --git a/SotnRandoTools/src/Services/NotificationService.cs b/SotnRandoTools/src/Services/NotificationService.cs index 43b36ce..e34cd44 100644 --- a/SotnRandoTools/src/Services/NotificationService.cs +++ b/SotnRandoTools/src/Services/NotificationService.cs @@ -29,10 +29,6 @@ public class NotificationService : INotificationService private Image scaledTextbox; private System.Windows.Media.MediaPlayer audioPlayer = new(); private List messageQueue = new(); - private Color meterForegroundColor = Color.FromArgb(96, 101, 168); - private Color meterBackgroundColor = Color.FromArgb(40, 40, 40); - private Color meterBorderColor = Color.FromArgb(180, 180, 180); - private short khaosMeter = 0; public NotificationService(IToolConfig toolConfig, IGuiApi guiApi, IEmuClientApi clientAPI) { @@ -55,7 +51,6 @@ public NotificationService(IToolConfig toolConfig, IGuiApi guiApi, IEmuClientApi scale = GetScale(); ResizeImages(); audioPlayer.Volume = (double) toolConfig.Khaos.Volume / 10F; - this.KhaosMeter = 0; } public double Volume @@ -66,22 +61,6 @@ public double Volume } } - public short KhaosMeter - { - get - { - return khaosMeter; - } - set - { - khaosMeter = value; - if (!countdownTimer.Enabled) - { - countdownTimer.Start(); - } - } - } - public void PlayAlert(string url) { if (String.IsNullOrEmpty(url)) throw new ArgumentException(nameof(url)); @@ -149,6 +128,11 @@ public void UpdateOverlayQueue(List actionQueue) overlaySocketServer.UpdateQueue(actionQueue); } + public void UpdateOverlayMeter(int meter) + { + overlaySocketServer.UpdateMeter(meter); + } + public void UpdateTrackerOverlay(int relics, int items) { overlaySocketServer.UpdateTracker(relics, items); @@ -182,13 +166,6 @@ private void DrawUI() } DrawMessage(messageQueue[0], scale, scaledTextbox, xpos, ypos, fontSize); } - - if (KhaosMeter > 0) - { - xpos = (int) (screenWidth * 0.15); - ypos = (int) (screenHeight * 0.18); - DrawMeter(scale, xpos, ypos); - } }); } @@ -214,15 +191,6 @@ private void DrawMessage(string message, int scale, Image scaledTextbox, int xpo guiApi.DrawString(xpos + (int) (scaledTextbox.Width / 2), ypos + (11 * scale), message, Color.White, null, fontSize, "Arial", "bold", "center", "center"); } - private void DrawMeter(int scale, int xpos, int ypos) - { - short adjustedMeter = KhaosMeter > 100 ? (short) 100 : KhaosMeter; - guiApi.DrawBox(xpos - (1 * scale), ypos - (1 * scale), xpos + (MeterSize * scale) + (1 * scale), ypos + (5 * scale) + (1 * scale), meterBorderColor, meterBorderColor); - guiApi.DrawBox(xpos, ypos, xpos + (MeterSize * scale), ypos + (5 * scale), meterBackgroundColor, meterBackgroundColor); - guiApi.DrawBox(xpos, ypos, xpos + ((int) ((adjustedMeter / 100f) * MeterSize) * scale), ypos + (5 * scale), meterForegroundColor, meterForegroundColor); - guiApi.DrawString(xpos + (int) (0.38 * (MeterSize * scale)), ypos, "KHAOS", Color.White, null, 4 * scale, "Arial", "bold"); - } - private void DequeueMessage(Object sender, EventArgs e) { if (messageQueue.Count > 0) diff --git a/SotnRandoTools/src/Services/OverlaySocketServer.cs b/SotnRandoTools/src/Services/OverlaySocketServer.cs index 99692fa..3604ddc 100644 --- a/SotnRandoTools/src/Services/OverlaySocketServer.cs +++ b/SotnRandoTools/src/Services/OverlaySocketServer.cs @@ -43,6 +43,19 @@ public void StopServer() } } + public void UpdateMeter(int meter) + { + JObject data = JObject.FromObject(new + { + meter = meter, + type = "meter" + }); + + foreach (var client in socketServer.ListClients()) + { + socketServer.SendAsync(client, data.ToString()); + } + } public void AddTimer(string name, int duration) { JObject data = JObject.FromObject(new diff --git a/SotnRandoTools/src/SotnRandoTools.csproj b/SotnRandoTools/src/SotnRandoTools.csproj index 7c14050..695f116 100644 --- a/SotnRandoTools/src/SotnRandoTools.csproj +++ b/SotnRandoTools/src/SotnRandoTools.csproj @@ -11,7 +11,7 @@ Library false 5.0 - 1.2.8 + 1.2.9 A collection of tools to enhance the experience of playign the SotN randomizer. https://taliczealot.github.io/