mirror of
https://git.alee14.me/shiftos-archive/ShiftOS_TheReturn.git
synced 2025-01-22 18:02:16 +00:00
Moved Stuff into files and made things look better
This commit is contained in:
parent
65449eda4c
commit
6393f91ad1
13 changed files with 193 additions and 145 deletions
|
@ -24,7 +24,7 @@
|
|||
|
||||
namespace ShiftOS.MFSProfiler
|
||||
{
|
||||
partial class Form1
|
||||
partial class Main
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
|
@ -39,9 +39,9 @@ using System.Threading;
|
|||
|
||||
namespace ShiftOS.MFSProfiler
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
public partial class Main : Form
|
||||
{
|
||||
public Form1()
|
||||
public Main()
|
||||
{
|
||||
InitializeComponent();
|
||||
SetupTree();
|
|
@ -40,7 +40,7 @@ namespace ShiftOS.MFSProfiler
|
|||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(false);
|
||||
Application.Run(new Form1());
|
||||
Application.Run(new Main());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -46,16 +46,16 @@
|
|||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Form1.cs">
|
||||
<Compile Include="Main.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Form1.Designer.cs">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
<Compile Include="Main.Designer.cs">
|
||||
<DependentUpon>Main.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<EmbeddedResource Include="Form1.resx">
|
||||
<DependentUpon>Form1.cs</DependentUpon>
|
||||
<EmbeddedResource Include="Main.resx">
|
||||
<DependentUpon>Main.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
|
|
14
ShiftOS.Objects/ClientSave.cs
Normal file
14
ShiftOS.Objects/ClientSave.cs
Normal file
|
@ -0,0 +1,14 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ShiftOS.Objects
|
||||
{
|
||||
public class ClientSave
|
||||
{
|
||||
public string Username { get; set; }
|
||||
public string Password { get; set; }
|
||||
}
|
||||
}
|
38
ShiftOS.Objects/Exploit.cs
Normal file
38
ShiftOS.Objects/Exploit.cs
Normal file
|
@ -0,0 +1,38 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ShiftOS.Objects
|
||||
{
|
||||
public abstract class Exploit
|
||||
{
|
||||
public void BeginExploit(string remote_user, bool isMud)
|
||||
{
|
||||
var ctx = new ExploitContext();
|
||||
SendToMUD(remote_user, "hack_getcontext");
|
||||
MessageReceived += (u, c, j) =>
|
||||
{
|
||||
|
||||
};
|
||||
ThisContext = ctx;
|
||||
}
|
||||
|
||||
public ExploitContext ThisContext { get; internal set; }
|
||||
|
||||
public virtual void SendToMUD(string target_user, string command, string json = "")
|
||||
{
|
||||
ThisContext.IsMUDHack = false;
|
||||
if (command == "hack_getcontext")
|
||||
{
|
||||
MessageReceived?.Invoke(target_user, "context_info", ExploitContext.CreateRandom());
|
||||
}
|
||||
}
|
||||
|
||||
public event MUDMessageEventHandler MessageReceived;
|
||||
|
||||
|
||||
public abstract void OnRun(ExploitContext ctx);
|
||||
}
|
||||
}
|
38
ShiftOS.Objects/ExploitContext.cs
Normal file
38
ShiftOS.Objects/ExploitContext.cs
Normal file
|
@ -0,0 +1,38 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ShiftOS.Objects
|
||||
{
|
||||
public class ExploitContext
|
||||
{
|
||||
public static string CreateRandom()
|
||||
{
|
||||
//We can't use JSON.NET. We must construct the JSON ourselves.
|
||||
StringBuilder jBuilder = new StringBuilder();
|
||||
jBuilder.AppendLine("{");
|
||||
jBuilder.Append("\tIsMUDHack: \"false\",");
|
||||
|
||||
jBuilder.AppendLine("}");
|
||||
return jBuilder.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether or not this exploit context belongs to a MUD hack session.
|
||||
/// </summary>
|
||||
public bool IsMUDHack { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the target username for this exploit context. Used for talking with the MUD about it.
|
||||
/// </summary>
|
||||
public string TargetUsername { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the target's locks.
|
||||
/// </summary>
|
||||
public List<Lock> TargetLocks { get; set; }
|
||||
|
||||
}
|
||||
}
|
|
@ -30,67 +30,11 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace ShiftOS.Objects
|
||||
{
|
||||
public abstract class Exploit
|
||||
{
|
||||
public void BeginExploit(string remote_user, bool isMud)
|
||||
{
|
||||
var ctx = new ExploitContext();
|
||||
SendToMUD(remote_user, "hack_getcontext");
|
||||
MessageReceived += (u, c, j) =>
|
||||
{
|
||||
|
||||
};
|
||||
ThisContext = ctx;
|
||||
}
|
||||
|
||||
public ExploitContext ThisContext { get; internal set; }
|
||||
|
||||
public virtual void SendToMUD(string target_user, string command, string json = "")
|
||||
{
|
||||
ThisContext.IsMUDHack = false;
|
||||
if (command == "hack_getcontext")
|
||||
{
|
||||
MessageReceived?.Invoke(target_user, "context_info", ExploitContext.CreateRandom());
|
||||
}
|
||||
}
|
||||
|
||||
public event MUDMessageEventHandler MessageReceived;
|
||||
|
||||
|
||||
public abstract void OnRun(ExploitContext ctx);
|
||||
}
|
||||
|
||||
|
||||
public delegate void MUDMessageEventHandler(string target_user, string command, string json);
|
||||
|
||||
public class ExploitContext
|
||||
{
|
||||
public static string CreateRandom()
|
||||
{
|
||||
//We can't use JSON.NET. We must construct the JSON ourselves.
|
||||
StringBuilder jBuilder = new StringBuilder();
|
||||
jBuilder.AppendLine("{");
|
||||
jBuilder.Append("\tIsMUDHack: \"false\",");
|
||||
|
||||
jBuilder.AppendLine("}");
|
||||
return jBuilder.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets whether or not this exploit context belongs to a MUD hack session.
|
||||
/// </summary>
|
||||
public bool IsMUDHack { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the target username for this exploit context. Used for talking with the MUD about it.
|
||||
/// </summary>
|
||||
public string TargetUsername { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the target's locks.
|
||||
/// </summary>
|
||||
public List<Lock> TargetLocks { get; set; }
|
||||
|
||||
}
|
||||
|
||||
|
||||
public abstract class Lock
|
||||
{
|
||||
|
|
39
ShiftOS.Objects/Legion.cs
Normal file
39
ShiftOS.Objects/Legion.cs
Normal file
|
@ -0,0 +1,39 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ShiftOS.Objects
|
||||
{
|
||||
public enum LegionRole
|
||||
{
|
||||
Admin,
|
||||
Manager,
|
||||
Committed,
|
||||
Trainee,
|
||||
AwaitingInvite
|
||||
}
|
||||
|
||||
public enum LegionPublicity
|
||||
{
|
||||
Public, //Will display on the 'Join Legion' page, anyone can join
|
||||
PublicInviteOnly, //Will display on the 'Join Legion' page but you must be invited
|
||||
Unlisted, //Won't display on 'Join Legion', but anyone can join
|
||||
UnlistedInviteOnly //Won't display in 'Join Legion', and admin/manager invitation is required.
|
||||
}
|
||||
|
||||
public class Legion
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public LegionPublicity Publicity { get; set; }
|
||||
public ConsoleColor BannerColor { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string ShortName { get; set; }
|
||||
|
||||
public Dictionary<string, LegionRole> Roles { get; set; }
|
||||
public Dictionary<LegionRole, string> RoleNames { get; set; }
|
||||
|
||||
|
||||
}
|
||||
}
|
|
@ -30,37 +30,6 @@ using System.Threading.Tasks;
|
|||
|
||||
namespace ShiftOS.Objects
|
||||
{
|
||||
public enum LegionRole
|
||||
{
|
||||
Admin,
|
||||
Manager,
|
||||
Committed,
|
||||
Trainee,
|
||||
AwaitingInvite
|
||||
}
|
||||
|
||||
public enum LegionPublicity
|
||||
{
|
||||
Public, //Will display on the 'Join Legion' page, anyone can join
|
||||
PublicInviteOnly, //Will display on the 'Join Legion' page but you must be invited
|
||||
Unlisted, //Won't display on 'Join Legion', but anyone can join
|
||||
UnlistedInviteOnly //Won't display in 'Join Legion', and admin/manager invitation is required.
|
||||
}
|
||||
|
||||
public class Legion
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public LegionPublicity Publicity { get; set; }
|
||||
public ConsoleColor BannerColor { get; set; }
|
||||
public string Description { get; set; }
|
||||
public string ShortName { get; set; }
|
||||
|
||||
public Dictionary<string, LegionRole> Roles { get; set; }
|
||||
public Dictionary<LegionRole, string> RoleNames { get; set; }
|
||||
|
||||
|
||||
}
|
||||
|
||||
public class MUDMemo
|
||||
{
|
||||
public string UserFrom { get; set; }
|
||||
|
@ -70,12 +39,6 @@ namespace ShiftOS.Objects
|
|||
public string Subject { get; set; }
|
||||
}
|
||||
|
||||
public class ClientSave
|
||||
{
|
||||
public string Username { get; set; }
|
||||
public string Password { get; set; }
|
||||
}
|
||||
|
||||
public enum MemoType
|
||||
{
|
||||
Regular,
|
||||
|
@ -121,45 +84,4 @@ namespace ShiftOS.Objects
|
|||
public string Contents { get; set; }
|
||||
public string GUID { get; set; }
|
||||
}
|
||||
|
||||
//Better to store this stuff server-side so we can do some neat stuff with hacking...
|
||||
public class Save
|
||||
{
|
||||
public string Username { get; set; }
|
||||
public int Codepoints { get; set; }
|
||||
public Dictionary<string, bool> Upgrades { get; set; }
|
||||
public int StoryPosition { get; set; }
|
||||
public string Language { get; set; }
|
||||
|
||||
public List<string> CurrentLegions { get; set; }
|
||||
|
||||
public int MajorVersion { get; set; }
|
||||
public int MinorVersion { get; set; }
|
||||
public int Revision { get; set; }
|
||||
|
||||
public string Password { get; set; }
|
||||
public string SystemName { get; set; }
|
||||
|
||||
public string DiscourseName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If the user has entered their Discourse account into ShiftOS, this is the password they gave.
|
||||
///
|
||||
/// ANY developer caught abusing this property will have their dev status revoked and their account PERMANENTLY SUSPENDED. - Michael
|
||||
/// </summary>
|
||||
public string DiscoursePass { get; set; }
|
||||
|
||||
|
||||
public int CountUpgrades()
|
||||
{
|
||||
int count = 0;
|
||||
foreach (var upg in Upgrades)
|
||||
{
|
||||
if (upg.Value == true)
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
48
ShiftOS.Objects/Save.cs
Normal file
48
ShiftOS.Objects/Save.cs
Normal file
|
@ -0,0 +1,48 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace ShiftOS.Objects
|
||||
{
|
||||
//Better to store this stuff server-side so we can do some neat stuff with hacking...
|
||||
public class Save
|
||||
{
|
||||
public string Username { get; set; }
|
||||
public int Codepoints { get; set; }
|
||||
public Dictionary<string, bool> Upgrades { get; set; }
|
||||
public int StoryPosition { get; set; }
|
||||
public string Language { get; set; }
|
||||
|
||||
public List<string> CurrentLegions { get; set; }
|
||||
|
||||
public int MajorVersion { get; set; }
|
||||
public int MinorVersion { get; set; }
|
||||
public int Revision { get; set; }
|
||||
|
||||
public string Password { get; set; }
|
||||
public string SystemName { get; set; }
|
||||
|
||||
public string DiscourseName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If the user has entered their Discourse account into ShiftOS, this is the password they gave.
|
||||
///
|
||||
/// ANY developer caught abusing this property will have their dev status revoked and their account PERMANENTLY SUSPENDED. - Michael
|
||||
/// </summary>
|
||||
public string DiscoursePass { get; set; }
|
||||
|
||||
|
||||
public int CountUpgrades()
|
||||
{
|
||||
int count = 0;
|
||||
foreach (var upg in Upgrades)
|
||||
{
|
||||
if (upg.Value == true)
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -54,10 +54,15 @@
|
|||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ClientSave.cs" />
|
||||
<Compile Include="DiscourseUser.cs" />
|
||||
<Compile Include="Exploit.cs" />
|
||||
<Compile Include="ExploitContext.cs" />
|
||||
<Compile Include="Hack.cs" />
|
||||
<Compile Include="Legion.cs" />
|
||||
<Compile Include="Objects.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Save.cs" />
|
||||
<Compile Include="ShiftFS.cs" />
|
||||
<Compile Include="ShiftOSMenuRenderer.cs" />
|
||||
</ItemGroup>
|
||||
|
|
Loading…
Reference in a new issue