forked from nikita/muzika-gromche
Add support for lyrics randomization
This commit is contained in:
parent
ca977625db
commit
9e066372c5
|
@ -9,6 +9,8 @@ using LethalConfig.ConfigItems.Options;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Net.NetworkInformation;
|
||||||
|
using System.Net.Sockets;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Networking;
|
using UnityEngine.Networking;
|
||||||
|
@ -22,6 +24,16 @@ namespace MuzikaGromche
|
||||||
{
|
{
|
||||||
internal new static Config Config { get; private set; } = null;
|
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 = [
|
public static Track[] Tracks = [
|
||||||
new Track
|
new Track
|
||||||
{
|
{
|
||||||
|
@ -384,14 +396,14 @@ namespace MuzikaGromche
|
||||||
(-152, "Russian hackers got access to sensitive"),
|
(-152, "Russian hackers got access to sensitive"),
|
||||||
(-142, "parts of the White House email system..."),
|
(-142, "parts of the White House email system..."),
|
||||||
(-134, "[They began to recognize...]"),
|
(-134, "[They began to recognize...]"),
|
||||||
(-126, "<>Russian hackers</>"),
|
(-126, "<Russian hackers/>"),
|
||||||
(-118, "<>Russian hackers</>\nO_o"),
|
(-118, "<Russian hackers/>\n X__X"),
|
||||||
(-110, "Gonna crack your"),
|
(-110, "Gonna crack your"),
|
||||||
(-102, "Gonna crack your\nStrongest pa$$words"),
|
(-102, "Gonna crack your\nStrongest pa$$words%123"),
|
||||||
(-94, "You popped online"),
|
(-94, "You popped online"),
|
||||||
(-86, "You popped online\nTo look for sneakers"),
|
(-86, "You popped online\nTo look for sneakers"),
|
||||||
(-78, "My hand just popped"),
|
(-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"),
|
(-62, "Keystrokes like Uzi"),
|
||||||
(-54, "Keystrokes like Uzi\nWill make you go all goosey"),
|
(-54, "Keystrokes like Uzi\nWill make you go all goosey"),
|
||||||
(-46, "Kicking down your backdoor"),
|
(-46, "Kicking down your backdoor"),
|
||||||
|
@ -401,25 +413,28 @@ namespace MuzikaGromche
|
||||||
(-14, "Kicking down your backdoor"),
|
(-14, "Kicking down your backdoor"),
|
||||||
(-6, "Kicking down your backdoor\nCount down before you lose it"),
|
(-6, "Kicking down your backdoor\nCount down before you lose it"),
|
||||||
(0, "C:\\> $Ru55ian hack3rs"),
|
(0, "C:\\> $Ru55ian hack3rs"),
|
||||||
(4, "C:\\> $Ru55ian hack3rs\nO_o"),
|
(4, "C:\\> $Ru55ian hack3rs\n O__o"),
|
||||||
(8, "Infamous White House attackers"),
|
(8, "Infamous White House attackers"),
|
||||||
(16, "Stealing your cookies\nto this beat"),
|
(16, "Stealing your cookies\nto this beat"),
|
||||||
(24, "Counting crypto to\nembarrass Wall Street"),
|
(24, "Counting crypto to\nembarrass Wall Street"),
|
||||||
(32, "Яushan h@ckers###"),
|
(32, "Russi?n ^hackers\tЯushan h@ckers###"),
|
||||||
(36, "Яushan h@ckers###\nO_o"),
|
(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"),
|
(40, "Infamous White House attackers"),
|
||||||
(48, "Stealing your cookies\nto this beat"),
|
(48, "Stealing your cookies\nto this beat"),
|
||||||
(56, "Counting crypto to\nembarrass Wall Street"),
|
(56, "Counting crypto to\nembarrass Wall Street"),
|
||||||
(80, "Instling min3r.exe"),
|
(80, $"Instling min3r.exe\t\t\tresolving ur private IP\n/"),
|
||||||
(82, "Instling min3r.exe\n00% [=> ]"),
|
(82, $"Instling min3r.exe\n00% [8=D ]\tHenllo ${{username = \"{Environment.UserName}\"}}\t\tresolving ur private IP\n-{PwnLyricsVariants[^3]}"),
|
||||||
(84, "Instling min3r.exe\n33% [====> ]"),
|
(84, $"Instling min3r.exe\n33% [8====D ]\t\t\tresolving ur private IP\n\\{PwnLyricsVariants[^3]}"),
|
||||||
(86, "Instling min3r.exe\n66% [=========> ]"),
|
(86, $"Instling min3r.exe\n66% [8=========D ]\t\t\tresolving ur private IP\n|{PwnLyricsVariants[^2]}"),
|
||||||
(88, "Instling min3r.exe\n95% [============> ]"),
|
(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% [=============>]"),
|
(90, $"Instling min3r.exe\n99% [8=============D]\t\t\tresolving ur private IP\n-{PwnLyricsVariants[^2]}"),
|
||||||
(92, "Encrpt1ng f!les..\n99% [=============>]"),
|
(92, $"Encrpt1ng f!les.. \n99% [8=============D]\t\t\tresolving ur private IP\n\\{PwnLyricsVariants[^1]}"),
|
||||||
(94, "Encrpt1ng f!les...\n100% enj0y \\o/"),
|
(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
|
new Track
|
||||||
{
|
{
|
||||||
|
@ -709,6 +724,10 @@ namespace MuzikaGromche
|
||||||
private set => _LyricsTimeSeries = value;
|
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 string[] LyricsLines { get; private set; }
|
||||||
public (float, string)[] Lyrics
|
public (float, string)[] Lyrics
|
||||||
{
|
{
|
||||||
|
@ -953,8 +972,17 @@ namespace MuzikaGromche
|
||||||
|
|
||||||
private float loopOffsetBeat = float.NegativeInfinity;
|
private float loopOffsetBeat = float.NegativeInfinity;
|
||||||
|
|
||||||
|
private static System.Random lyricsRandom = null;
|
||||||
|
|
||||||
|
private int lyricsRandomPerLoop;
|
||||||
|
|
||||||
public BeatTimeState(Track track)
|
public BeatTimeState(Track track)
|
||||||
{
|
{
|
||||||
|
if (lyricsRandom == null)
|
||||||
|
{
|
||||||
|
lyricsRandom = new System.Random(RoundManager.Instance.playersManager.randomMapSeed + 1337);
|
||||||
|
lyricsRandomPerLoop = lyricsRandom.Next();
|
||||||
|
}
|
||||||
this.track = track;
|
this.track = track;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -969,10 +997,17 @@ namespace MuzikaGromche
|
||||||
// Do not go back in time
|
// Do not go back in time
|
||||||
if (!loopOffsetSpan.IsEmpty())
|
if (!loopOffsetSpan.IsEmpty())
|
||||||
{
|
{
|
||||||
|
if (loopOffsetSpan.BeatFromExclusive > loopOffsetSpan.BeatToInclusive)
|
||||||
|
{
|
||||||
|
lyricsRandomPerLoop = lyricsRandom.Next();
|
||||||
|
}
|
||||||
|
|
||||||
var windUpOffsetTimestamp = UpdateStateForWindUpOffset(start, loop);
|
var windUpOffsetTimestamp = UpdateStateForWindUpOffset(start, loop);
|
||||||
loopOffsetBeat = loopTimestamp.Beat;
|
loopOffsetBeat = loopTimestamp.Beat;
|
||||||
var events = GetEvents(loopOffsetSpan, windUpOffsetTimestamp);
|
var events = GetEvents(loopOffsetSpan, windUpOffsetTimestamp);
|
||||||
|
#if DEBUG
|
||||||
Debug.Log($"MuzikaGromche looping(loop)={loopOffsetIsLooping} looping(windUp)={windUpOffsetIsLooping} Loop={loopOffsetSpan} WindUp={windUpOffsetTimestamp} events={string.Join(",", events)}");
|
Debug.Log($"MuzikaGromche looping(loop)={loopOffsetIsLooping} looping(windUp)={windUpOffsetIsLooping} Loop={loopOffsetSpan} WindUp={windUpOffsetTimestamp} events={string.Join(",", events)}");
|
||||||
|
#endif
|
||||||
return events;
|
return events;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1067,8 +1102,14 @@ namespace MuzikaGromche
|
||||||
var index = loopOffsetSpan.GetLastIndex(track.LyricsTimeSeries);
|
var index = loopOffsetSpan.GetLastIndex(track.LyricsTimeSeries);
|
||||||
if (index is int i && i < track.LyricsLines.Length)
|
if (index is int i && i < track.LyricsLines.Length)
|
||||||
{
|
{
|
||||||
var text = track.LyricsLines[i];
|
var line = track.LyricsLines[i];
|
||||||
events.Add(new LyricsEvent(text));
|
var alternatives = line.Split('\t');
|
||||||
|
var randomIndex = lyricsRandomPerLoop % alternatives.Length;
|
||||||
|
var alternative = alternatives[randomIndex];
|
||||||
|
if (alternative != "")
|
||||||
|
{
|
||||||
|
events.Add(new LyricsEvent(alternative));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue