fire hydrant and banana cowfiles

This commit is contained in:
Michael 2017-08-03 08:49:07 -04:00
parent 19fceb8326
commit bec3c8424f
10 changed files with 124 additions and 26 deletions

View file

@ -92,9 +92,7 @@ namespace ShiftOS.Frontend.Apps
_input.Text = "";
//Let's try the AI stuff... :P
if (!messagecache.Contains(_messages.Last().Message))
messagecache.Add(_messages.Last().Message);
var rmsg = messagecache[rnd.Next(messagecache.Count)];
var rmsg = _messages[rnd.Next(_messages.Count)].Message;
var split = new List<string>(rmsg.Split(' '));
List<string> nmsg = new List<string>();
if (split.Count > 2)
@ -111,10 +109,10 @@ namespace ShiftOS.Frontend.Apps
{
split.RemoveAt(i);
}
split.AddRange(Regex.Split(Regex.Replace(messagecache[rnd.Next(messagecache.Count)], "debugbot", outcomes[rnd.Next(outcomes.Length)], RegexOptions.IgnoreCase), " "));
split.AddRange(Regex.Split(Regex.Replace(_messages[rnd.Next(_messages.Count)].Message, "debugbot", outcomes[rnd.Next(outcomes.Length)], RegexOptions.IgnoreCase), " "));
}
split.RemoveAt(rnd.Next(split.Count));
split.Add(Regex.Replace(messagecache[rnd.Next(messagecache.Count)], "debugbot", outcomes[rnd.Next(outcomes.Length)], RegexOptions.IgnoreCase));
split.Add(Regex.Replace(_messages[rnd.Next(_messages.Count)].Message, "debugbot", outcomes[rnd.Next(outcomes.Length)], RegexOptions.IgnoreCase));
string combinedResult = string.Join(" ", split);
_messages.Add(new ChatMessage
{

View file

@ -66,6 +66,17 @@ namespace ShiftOS.Frontend.Apps
Shiftorium.Buy(_setup.Source, 0);
Engine.Infobox.Show("Upgrade installed.", "The upgrade \"" + _setup.Source + "\" has been installed and is now ready to be used!");
break;
case SetupSource.CowFile:
string cow = _setup.Source;
string[] split = cow.Split('\t');
string fname = split[0] + ".cow";
string ascii = split[1];
string csCowfiles = Paths.GetPath("data") + "/cows";
if (!DirectoryExists(csCowfiles))
CreateDirectory(csCowfiles);
WriteAllText(csCowfiles + "/" + fname, ascii);
Engine.Infobox.Show("Cowsay", "New cowfile installed! Have fun with your talking " + split[0] + "!");
break;
}
}
@ -126,6 +137,7 @@ namespace ShiftOS.Frontend.Apps
public enum SetupSource
{
ShiftoriumUpgrade
ShiftoriumUpgrade,
CowFile
}
}

View file

@ -52,6 +52,7 @@ namespace ShiftOS.Frontend
{
var builder = new List<string>();
int speechlen = (args.ContainsKey("width")) ? Convert.ToInt32(args["width"].ToString()) : 50;
string cowfile = (args.ContainsKey("file")) ? args["file"].ToString() : null;
string speech = args["id"].ToString();
AnimalMode _mode = AnimalMode.Normal;
if (args.ContainsKey("mode"))
@ -72,7 +73,7 @@ namespace ShiftOS.Frontend
}
DrawSpeechBubble(ref builder, speechlen, speech);
DrawCow(ref builder, _mode);
DrawCow(ref builder, _mode, cowfile);
Console.WriteLine(string.Join(Environment.NewLine, builder.ToArray()));
}
@ -150,7 +151,7 @@ namespace ShiftOS.Frontend
Youthful
}
private static void DrawCow(ref List<string> Builder, AnimalMode AnimalMode)
private static void DrawCow(ref List<string> Builder, AnimalMode AnimalMode, string cowfile)
{
var startingLinePadding = Builder.First().Length / 4;
@ -194,12 +195,23 @@ namespace ShiftOS.Frontend
break;
}
Builder.Add($"{' '.RepeatChar(startingLinePadding)}\\ ^__^");
Builder.Add($"{' '.RepeatChar(startingLinePadding)} \\ ({eyeChar.RepeatChar(2)})\\_______");
Builder.Add($"{' '.RepeatChar(startingLinePadding)} (__)\\ )\\/\\");
Builder.Add($"{' '.RepeatChar(startingLinePadding)} {tongueChar.RepeatChar(1)} ||----w |");
Builder.Add($"{' '.RepeatChar(startingLinePadding)} || ||");
string cowpath = Paths.GetPath("data") + "/cows/" + cowfile + ".cow";
if (string.IsNullOrWhiteSpace(cowfile) || !Utils.FileExists(cowpath))
{
Builder.Add($"{' '.RepeatChar(startingLinePadding)}\\ ^__^");
Builder.Add($"{' '.RepeatChar(startingLinePadding)} \\ ({eyeChar.RepeatChar(2)})\\_______");
Builder.Add($"{' '.RepeatChar(startingLinePadding)} (__)\\ )\\/\\");
Builder.Add($"{' '.RepeatChar(startingLinePadding)} {tongueChar.RepeatChar(1)} ||----w |");
Builder.Add($"{' '.RepeatChar(startingLinePadding)} || ||");
}
else
{
string[] lines = Utils.ReadAllText(cowpath).Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
foreach(var line in lines)
{
Builder.Add($"{' '.RepeatChar(startingLinePadding)}{line.Replace("#", eyeChar.ToString())}");
}
}
}
}

View file

@ -60,6 +60,20 @@ namespace ShiftOS.Frontend.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to {
/// Name: &quot;Cowsay Banana Cowfile&quot;,
/// Description: &quot;It&apos;s fun to play with food. Especially in the form of a cowfile. This install file adds a Banana to Cowsay&apos;s cowfile list. To use it, simply do \&quot;cowsay --id Hello --file banana\&quot;.&quot;,
/// SourceType: &quot;CowFile&quot;,
/// Source: &quot;banana\t\&quot;-..___ __.=&apos;&gt;\r\n`. \&quot;\&quot;\&quot;\&quot;\&quot; ,&apos;\r\n \&quot;-..__ _.-\&quot;\r\n \&quot;\&quot;\&quot;&quot;
///}.
/// </summary>
public static string banana_cow_stp {
get {
return ResourceManager.GetString("banana.cow.stp", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@ -97,6 +111,19 @@ namespace ShiftOS.Frontend.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to {
/// Name: &quot;Cowsay Fire Hydrant Cowfile&quot;,
/// Description: &quot;Ever been so thirsty that you wanted to open a fire hydrant and just take a giant drink of water? Well, you can&apos;t do that with this install file, but you can at least get a neat cowfile firehydrant so you can make one talk!&quot;,
/// SourceType: &quot;CowFile&quot;,
/// Source:&quot;fire hydrant\t \\ !\r\n \\ .:::.\r\n ///|\\\\\\\r\n {=-#-#-=}\r\n .-||||/..\\\r\n c[I ||||\\&apos;&apos;/\r\n &apos;-||||||| \r\n |||||||\r\n |||||||\r\n |||||||\r\n [rest of string was truncated]&quot;;.
/// </summary>
public static string fire_hydrant_cow_stp {
get {
return ResourceManager.GetString("fire hydrant.cow.stp", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to /* ShiftOS hackables data file
/// *
@ -152,13 +179,16 @@ namespace ShiftOS.Frontend.Properties {
/// ID: &quot;sploitset_keepalive&quot;
/// },
/// {
/// FriendlyName: &quot;Banana Cow&quot;,
/// LootName: &quot;banana.cow.stp&quot;,
/// Rarity: 1,
/// PointTo: &quot;banana_cow_stp&quot;,
/// },
/// {
/// FriendlyName: &quot;SSHardline&quot;,
/// LootName: &quot;sploitset_sshardline.stp&quot;,
/// Rarity: 1,
/// PointTo: &quot;sploitset_sshardline&quot;,
/// ID: &quot;sploitset_keepalive&quot;
/// }
///].
/// PointTo: &quot;sploitset_ssh [rest of string was truncated]&quot;;.
/// </summary>
public static string LootInfo {
get {
@ -260,6 +290,11 @@ namespace ShiftOS.Frontend.Properties {
/// Cost: 1000000000,
/// Description: &quot;lolyouarentsupposedtobeabletobuythis&quot;,
/// Dependencies: &quot;thisupgradeshouldneverexistever&quot;,
/// },
/// {
/// Name: &quot;Pong&quot;,
/// Cost: 0,
/// Dependencies: &quot;pong&quot;,
/// }
///].
/// </summary>

View file

@ -157,4 +157,10 @@
<data name="sploitset_keepalive" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\sploitset_keepalive.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="banana.cow.stp" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\banana.cow.stp.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
<data name="fire hydrant.cow.stp" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\fire hydrant.cow.stp.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252</value>
</data>
</root>

View file

@ -12,6 +12,18 @@
PointTo: "sploitset_keepalive",
ID: "sploitset_keepalive"
},
{
FriendlyName: "Banana Cow",
LootName: "banana.cow.stp",
Rarity: 1,
PointTo: "banana_cow_stp",
},
{
FriendlyName: "Fire Hydrant Cow",
LootName: "fire hydrant.cow.stp",
Rarity: 1,
PointTo: "fire_hydrant_cow_stp",
},
{
FriendlyName: "SSHardline",
LootName: "sploitset_sshardline.stp",

View file

@ -0,0 +1,6 @@
{
Name: "Cowsay Banana Cowfile",
Description: "It's fun to play with food. Especially in the form of a cowfile. This install file adds a Banana to Cowsay's cowfile list. To use it, simply do \"cowsay --id Hello --file banana\".",
SourceType: "CowFile",
Source: "banana\t\"-..___ __.='>\r\n`. \"\"\"\"\" ,'\r\n \"-..__ _.-\"\r\n \"\"\""
}

View file

@ -0,0 +1,6 @@
{
Name: "Cowsay Fire Hydrant Cowfile",
Description: "Ever been so thirsty that you wanted to open a fire hydrant and just take a giant drink of water? Well, you can't do that with this install file, but you can at least get a neat cowfile firehydrant so you can make one talk!",
SourceType: "CowFile",
Source:"fire hydrant\t \\ !\r\n \\ .:::.\r\n ///|\\\\\\\r\n {=-#-#-=}\r\n .-||||/..\\\r\n c[I ||||\\''/\r\n '-||||||| \r\n |||||||\r\n |||||||\r\n |||||||\r\n [=======]\r\n"
}

View file

@ -107,6 +107,7 @@
<EmbeddedResource Include="Icon.bmp" />
<EmbeddedResource Include="Properties\Resources.resx">
<Generator>PublicResXFileCodeGenerator</Generator>
<SubType>Designer</SubType>
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
@ -196,6 +197,8 @@
</ItemGroup>
<ItemGroup>
<None Include="Resources\pong.txt" />
<None Include="Resources\banana.cow.stp.txt" />
<None Include="Resources\fire hydrant.cow.stp.txt" />
<Content Include="Resources\Ports.txt" />
<Content Include="Resources\Payloads.txt" />
<Content Include="Resources\Exploits.txt" />

View file

@ -121,20 +121,28 @@ namespace ShiftOS.Engine
i = 0;
}
CommandFormat part = parts[i];
string inp = text.Substring(position);
CommandFormat part = parts[i];
string inp = text.Substring(position);
string res = part.CheckValidity(inp);
if(part is CommandFormatText)
{
if(res == "+FALSE+")
if (res == "+FALSE+")
{
if(id_found == false)
#if SUPERMOSQUITO_DIAGNOSIS
if (!inp.Remove(0, 1).Contains(" "))
{
id_found = true;
id_text = inp.Remove(0,1);
res = "";
arguments.Add("id", id_text);
if (id_found == false)
{
id_found = true;
id_text = inp.Remove(0, 1);
res = "";
arguments.Add("id", id_text);
}
}
#endif
}
}