diff --git a/MuzikaGromche/Plugin.cs b/MuzikaGromche/Plugin.cs index f044a59..6e8af62 100644 --- a/MuzikaGromche/Plugin.cs +++ b/MuzikaGromche/Plugin.cs @@ -9,6 +9,8 @@ using LethalConfig.ConfigItems.Options; using System; using System.Collections.Generic; using System.Linq; +using System.Net.NetworkInformation; +using System.Net.Sockets; using System.Security.Cryptography; using UnityEngine; using UnityEngine.Networking; @@ -22,6 +24,16 @@ namespace MuzikaGromche { internal new static Config Config { get; private set; } = null; + private static readonly string[] PwnLyricsVariants = [ + "", "", "", // make sure the array has enough items to index it without checking + ..NetworkInterface.GetAllNetworkInterfaces() + .Where(n => n.OperationalStatus == OperationalStatus.Up) + .SelectMany(n => n.GetIPProperties().UnicastAddresses) + .Where(a => a.Address.AddressFamily == AddressFamily.InterNetwork) + .Select(a => a.Address.ToString()) + .Select(a => $" Trying... {a}") + ]; + public static Track[] Tracks = [ new Track { @@ -384,14 +396,14 @@ namespace MuzikaGromche (-152, "Russian hackers got access to sensitive"), (-142, "parts of the White House email system..."), (-134, "[They began to recognize...]"), - (-126, "<>Russian hackers"), - (-118, "<>Russian hackers\nO_o"), + (-126, ""), + (-118, "\n X__X"), (-110, "Gonna crack your"), - (-102, "Gonna crack your\nStrongest pa$$words"), + (-102, "Gonna crack your\nStrongest pa$$words%123"), (-94, "You popped online"), (-86, "You popped online\nTo look for sneakers"), (-78, "My hand just popped"), - (-70, "My hand just popped\nRight in your knickers >_<"), + (-70, "My hand just popped\nRight in your knickers >_< "), (-62, "Keystrokes like Uzi"), (-54, "Keystrokes like Uzi\nWill make you go all goosey"), (-46, "Kicking down your backdoor"), @@ -401,25 +413,28 @@ namespace MuzikaGromche (-14, "Kicking down your backdoor"), (-6, "Kicking down your backdoor\nCount down before you lose it"), (0, "C:\\> $Ru55ian hack3rs"), - (4, "C:\\> $Ru55ian hack3rs\nO_o"), + (4, "C:\\> $Ru55ian hack3rs\n O__o"), (8, "Infamous White House attackers"), (16, "Stealing your cookies\nto this beat"), (24, "Counting crypto to\nembarrass Wall Street"), - (32, "Яushan h@ckers###"), - (36, "Яushan h@ckers###\nO_o"), + (32, "Russi?n ^hackers\tЯushan h@ckers###"), + (34, "\tЯushan h@ckers###\n X_X"), + (36, "Russi?n ^hackers\n--.--\tЯushan h@ckers###\n X___X"), + (38, "\tЯushan h@ckers###\n X_____X"), (40, "Infamous White House attackers"), (48, "Stealing your cookies\nto this beat"), (56, "Counting crypto to\nembarrass Wall Street"), - (80, "Instling min3r.exe"), - (82, "Instling min3r.exe\n00% [=> ]"), - (84, "Instling min3r.exe\n33% [====> ]"), - (86, "Instling min3r.exe\n66% [=========> ]"), - (88, "Instling min3r.exe\n95% [============> ]"), - (90, "Instling min3r.exe\n99% [=============>]"), - (92, "Encrpt1ng f!les..\n99% [=============>]"), - (94, "Encrpt1ng f!les...\n100% enj0y \\o/"), + (80, $"Instling min3r.exe\t\t\tresolving ur private IP\n/"), + (82, $"Instling min3r.exe\n00% [8=D ]\tHenllo ${{username = \"{Environment.UserName}\"}}\t\tresolving ur private IP\n-{PwnLyricsVariants[^3]}"), + (84, $"Instling min3r.exe\n33% [8====D ]\t\t\tresolving ur private IP\n\\{PwnLyricsVariants[^3]}"), + (86, $"Instling min3r.exe\n66% [8=========D ]\t\t\tresolving ur private IP\n|{PwnLyricsVariants[^2]}"), + (88, $"Instling min3r.exe\n95% [8============D ]\t\tWhere did you download\nthis < mod / dll > from?\tresolving ur private IP\n{PwnLyricsVariants[^2]}/"), + (90, $"Instling min3r.exe\n99% [8=============D]\t\t\tresolving ur private IP\n-{PwnLyricsVariants[^2]}"), + (92, $"Encrpt1ng f!les.. \n99% [8=============D]\t\t\tresolving ur private IP\n\\{PwnLyricsVariants[^1]}"), + (94, $"Encrpt1ng f!les...\n100% enj0y \\o/\t\t\tresolving ur private IP\n|{PwnLyricsVariants[^1]}"), + (96, $"\t\t\tresolving ur private IP\n/{PwnLyricsVariants[^1]}"), + (98, $"\t\t\tresolving ur private IP\nP_WNED"), ], - // TODO: More personalized pranks involving Environment.UserName? }, new Track { @@ -709,6 +724,10 @@ namespace MuzikaGromche private set => _LyricsTimeSeries = value; } + // Lyrics line may contain multiple tab-separated alternatives. + // In such case, a random number chosen and updated once per loop + // is used to select an alternative. + // If the chosen alternative is an empty string, lyrics event shall be skipped. public string[] LyricsLines { get; private set; } public (float, string)[] Lyrics { @@ -953,8 +972,17 @@ namespace MuzikaGromche private float loopOffsetBeat = float.NegativeInfinity; + private static System.Random lyricsRandom = null; + + private int lyricsRandomPerLoop; + public BeatTimeState(Track track) { + if (lyricsRandom == null) + { + lyricsRandom = new System.Random(RoundManager.Instance.playersManager.randomMapSeed + 1337); + lyricsRandomPerLoop = lyricsRandom.Next(); + } this.track = track; } @@ -969,10 +997,17 @@ namespace MuzikaGromche // Do not go back in time if (!loopOffsetSpan.IsEmpty()) { + if (loopOffsetSpan.BeatFromExclusive > loopOffsetSpan.BeatToInclusive) + { + lyricsRandomPerLoop = lyricsRandom.Next(); + } + var windUpOffsetTimestamp = UpdateStateForWindUpOffset(start, loop); loopOffsetBeat = loopTimestamp.Beat; var events = GetEvents(loopOffsetSpan, windUpOffsetTimestamp); +#if DEBUG Debug.Log($"MuzikaGromche looping(loop)={loopOffsetIsLooping} looping(windUp)={windUpOffsetIsLooping} Loop={loopOffsetSpan} WindUp={windUpOffsetTimestamp} events={string.Join(",", events)}"); +#endif return events; } } @@ -1067,8 +1102,14 @@ namespace MuzikaGromche var index = loopOffsetSpan.GetLastIndex(track.LyricsTimeSeries); if (index is int i && i < track.LyricsLines.Length) { - var text = track.LyricsLines[i]; - events.Add(new LyricsEvent(text)); + var line = track.LyricsLines[i]; + var alternatives = line.Split('\t'); + var randomIndex = lyricsRandomPerLoop % alternatives.Length; + var alternative = alternatives[randomIndex]; + if (alternative != "") + { + events.Add(new LyricsEvent(alternative)); + } } }