aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS_TheReturn
diff options
context:
space:
mode:
authorwilliam341 <[email protected]>2017-06-29 13:13:45 -0700
committerwilliam341 <[email protected]>2017-06-29 13:13:45 -0700
commitad387c41e7d6cc547431e88695d4723ea2dba913 (patch)
treea68282dda40c4f0b28883241c7adcf9010f4550e /ShiftOS_TheReturn
parentb4b19e7a4d203b58537f5b98214296ab52c49b2d (diff)
parent5bebd4411bc6266cbee482a429ba794eefa8f9b6 (diff)
downloadshiftos_thereturn-ad387c41e7d6cc547431e88695d4723ea2dba913.tar.gz
shiftos_thereturn-ad387c41e7d6cc547431e88695d4723ea2dba913.tar.bz2
shiftos_thereturn-ad387c41e7d6cc547431e88695d4723ea2dba913.zip
Merge remote-tracking branch 'refs/remotes/shiftos-game/master'
Diffstat (limited to 'ShiftOS_TheReturn')
-rw-r--r--ShiftOS_TheReturn/AudioManager.cs54
-rw-r--r--ShiftOS_TheReturn/MissionAttribute.cs24
-rw-r--r--ShiftOS_TheReturn/SaveSystem.cs84
-rw-r--r--ShiftOS_TheReturn/ServerManager.cs3
-rw-r--r--ShiftOS_TheReturn/ShiftOS.Engine.csproj1
-rw-r--r--ShiftOS_TheReturn/Skinning.cs149
-rw-r--r--ShiftOS_TheReturn/Story.cs16
7 files changed, 232 insertions, 99 deletions
diff --git a/ShiftOS_TheReturn/AudioManager.cs b/ShiftOS_TheReturn/AudioManager.cs
index 0950b55..a9101b7 100644
--- a/ShiftOS_TheReturn/AudioManager.cs
+++ b/ShiftOS_TheReturn/AudioManager.cs
@@ -83,28 +83,15 @@ namespace ShiftOS.Engine
/// <param name="file">The file to play.</param>
public static void Play(string file)
{
- bool play = true;
- float volume = 1f;
- if (SaveSystem.CurrentSave != null)
+ try
{
- play = (SaveSystem.CurrentSave.SoundEnabled);
- volume = (float)SaveSystem.CurrentSave.MusicVolume / 100f;
+ var bytes = File.ReadAllBytes(file);
+ var str = new MemoryStream(bytes);
+ PlayStream(str);
}
- if (play)
+ catch
{
- try
- {
- _reader = new AudioFileReader(file);
- _out = new WaveOut();
- _out.Init(_reader);
- _out.Volume = volume;
- _out.Play();
- _out.PlaybackStopped += (o, a) => { PlayCompleted?.Invoke(); };
- }
- catch (Exception ex)
- {
- Console.WriteLine("Audio error: " + ex.Message);
- }
+
}
}
@@ -114,31 +101,14 @@ namespace ShiftOS.Engine
/// <param name="str">The stream to read from.</param>
public static void PlayStream(Stream str)
{
- try
+ bool play = true;
+ if (SaveSystem.CurrentSave != null)
+ play = SaveSystem.CurrentSave.SoundEnabled;
+ if (play)
{
- bool play = true;
- float volume = 1f;
- if (SaveSystem.CurrentSave != null)
- {
- play = (SaveSystem.CurrentSave.SoundEnabled);
- volume = (float)SaveSystem.CurrentSave.MusicVolume / 100f;
- }
- if (play)
- {
- while(_out.PlaybackState == PlaybackState.Playing)
- {
- Thread.Sleep(10);
- }
- ShiftOS.Engine.AudioManager.Stop();
- _out = new WaveOut();
- var mp3 = new WaveFileReader(str);
- _out.Init(mp3);
- _out.Volume = volume;
- _out.Play();
- _out.PlaybackStopped += (o, a) => { PlayCompleted?.Invoke(); };
- }
+ var splayer = new System.Media.SoundPlayer(str);
+ splayer.Play();
}
- catch { }
}
public static event Action PlayCompleted;
diff --git a/ShiftOS_TheReturn/MissionAttribute.cs b/ShiftOS_TheReturn/MissionAttribute.cs
new file mode 100644
index 0000000..4a0750c
--- /dev/null
+++ b/ShiftOS_TheReturn/MissionAttribute.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace ShiftOS.Engine
+{
+ [AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
+ public class MissionAttribute : StoryAttribute
+ {
+ public MissionAttribute(string id, string friendlyName, string friendlyDesc, ulong codepointAward, string assigner) : base(id)
+ {
+ Name = friendlyName;
+ Description = friendlyDesc;
+ CodepointAward = codepointAward;
+ Assigner = assigner;
+ }
+
+ public string Name { get; private set; }
+ public string Description { get; private set; }
+ public string Assigner { get; set; }
+ }
+}
diff --git a/ShiftOS_TheReturn/SaveSystem.cs b/ShiftOS_TheReturn/SaveSystem.cs
index 8cfea4a..b767605 100644
--- a/ShiftOS_TheReturn/SaveSystem.cs
+++ b/ShiftOS_TheReturn/SaveSystem.cs
@@ -66,7 +66,7 @@ namespace ShiftOS.Engine
/// <summary>
/// Boolean representing whether the save system is ready to be used.
/// </summary>
- public static bool Ready = false;
+ public static AutoResetEvent Ready = new AutoResetEvent(false);
public static bool IsSandbox = false;
/// <summary>
@@ -154,25 +154,17 @@ namespace ShiftOS.Engine
{
Console.WriteLine("{MISC_CONNECTINGTONETWORK}");
- Ready = false;
+ Ready.Reset();
if (PreDigitalSocietyConnection != null)
{
PreDigitalSocietyConnection?.Invoke();
-
- while (!Ready)
- {
- Thread.Sleep(10);
- }
+ Ready.WaitOne();
}
-
-
- bool guidReceived = false;
ServerManager.GUIDReceived += (str) =>
{
//Connection successful! Stop waiting!
- guidReceived = true;
Console.WriteLine("{MISC_CONNECTIONSUCCESSFUL}");
Thread.Sleep(100);
Console.WriteLine("{LOADINGMSG2_" + loadingJoke2 + "}");
@@ -184,37 +176,25 @@ namespace ShiftOS.Engine
if (ServerManager.ServerOnline)
{
ServerManager.Initiate(UserConfig.Get().DigitalSocietyAddress, UserConfig.Get().DigitalSocietyPort);
- //This haults the client until the connection is successful.
- while (ServerManager.thisGuid == new Guid())
- {
- Thread.Sleep(10);
- }
+ // This halts the client until the connection is successful.
+ ServerManager.guidReceiveARE.WaitOne();
Console.WriteLine("{MISC_DHCPHANDSHAKEFINISHED}");
- FinishBootstrap();
}
else
{
Console.WriteLine("{MISC_NONETWORK}");
Console.WriteLine("{LOADINGMSG2_" + loadingJoke2 + "}");
- FinishBootstrap();
}
+ FinishBootstrap();
}
catch (Exception ex)
{
- //No errors, this never gets called.
+ // "No errors, this never gets called."
Console.WriteLine("[inetd] SEVERE: " + ex.Message);
+ string dest = "Startup Exception " + DateTime.Now.ToString() + ".txt";
+ System.IO.File.WriteAllText(dest, ex.ToString());
+ Console.WriteLine("[inetd] Full exception details have been saved to: " + dest);
Thread.Sleep(3000);
- Console.WriteLine("[sys] SEVERE: Cannot connect to server. Shutting down in 5...");
- Thread.Sleep(1000);
- Console.WriteLine("[sys] 4...");
- Thread.Sleep(1000);
- Console.WriteLine("[sys] 3...");
- Thread.Sleep(1000);
- Console.WriteLine("[sys] 2...");
- Thread.Sleep(1000);
- Console.WriteLine("[sys] 1...");
- Thread.Sleep(1000);
- Console.WriteLine("[sys] Bye bye.");
System.Diagnostics.Process.GetCurrentProcess().Kill();
}
@@ -571,8 +551,6 @@ namespace ShiftOS.Engine
/// <param name="amount">The amount of Codepoints to deduct.</param>
public static void TransferCodepointsToVoid(ulong amount)
{
- if (amount < 0)
- throw new ArgumentOutOfRangeException("We see what you did there. Trying to pull Codepoints from the void? That won't work.");
CurrentSave.Codepoints -= amount;
NotificationDaemon.AddNotification(NotificationType.CodepointsSent, amount);
}
@@ -591,36 +569,35 @@ namespace ShiftOS.Engine
/// </summary>
public static void ReadSave()
{
+ string path;
+
+ path = "C:\\ShiftOS2\\";
//Migrate old saves.
- if (System.IO.Directory.Exists("C:\\ShiftOS2"))
+ if (System.IO.Directory.Exists(path) && !System.IO.File.Exists(path + "havemigrated"))
{
Console.WriteLine("Old save detected. Migrating filesystem to MFS...");
- foreach (string file in System.IO.Directory.EnumerateDirectories("C:\\ShiftOS2")
-.Select(d => new DirectoryInfo(d).FullName))
+ foreach (string file in System.IO.Directory.EnumerateFileSystemEntries(path))
{
- if (!Utils.DirectoryExists(file.Replace("C:\\ShiftOS2\\", "0:/").Replace("\\", "/")))
- Utils.CreateDirectory(file.Replace("C:\\ShiftOS2\\", "0:/").Replace("\\", "/"));
- }
- foreach (string file in System.IO.Directory.EnumerateFiles("C:\\ShiftOS2"))
- {
-
- string rfile = Path.GetFileName(file);
- Utils.WriteAllBytes(file.Replace("C:\\ShiftOS2\\", "0:/").Replace("\\", "/"), System.IO.File.ReadAllBytes(file));
- Console.WriteLine("Exported file " + file);
+ string dest = file.Replace(path, "0:/").Replace("\\", "/");
+ if (System.IO.File.GetAttributes(file).HasFlag(FileAttributes.Directory))
+ if (!Utils.DirectoryExists(dest))
+ Utils.CreateDirectory(dest);
+ else
+ {
+ string rfile = Path.GetFileName(file);
+ Utils.WriteAllBytes(dest, System.IO.File.ReadAllBytes(file));
+ Console.WriteLine("Exported file " + file);
+ }
}
-
+ System.IO.File.WriteAllText(path + "havemigrated", "1.0 BETA");
}
- string path = Path.Combine(Paths.SaveDirectory, "autosave.save");
+ path = Path.Combine(Paths.SaveDirectory, "autosave.save");
- if (System.IO.File.Exists(Path.Combine(Paths.SaveDirectory, "autosave.save")))
- {
+ if (System.IO.File.Exists(path))
CurrentSave = JsonConvert.DeserializeObject<Save>(System.IO.File.ReadAllText(path));
- }
else
- {
NewSave();
- }
}
@@ -667,11 +644,8 @@ namespace ShiftOS.Engine
})
{ IsBackground = false }.Start();
if (!System.IO.Directory.Exists(Paths.SaveDirectory))
- {
System.IO.Directory.CreateDirectory(Paths.SaveDirectory);
- }
-
System.IO.File.WriteAllText(Path.Combine(Paths.SaveDirectory, "autosave.save"), serialisedSaveFile);
}
if (!Shiftorium.Silent)
@@ -688,8 +662,6 @@ namespace ShiftOS.Engine
/// <param name="amount">The amount of Codepoints.</param>
public static void TransferCodepointsFrom(string who, ulong amount)
{
- if (amount < 0)
- throw new ArgumentOutOfRangeException("We see what you did there... You can't just give a fake character Codepoints like that. It's better if you transfer them to the void.");
NotificationDaemon.AddNotification(NotificationType.CodepointsReceived, amount);
CurrentSave.Codepoints += amount;
}
diff --git a/ShiftOS_TheReturn/ServerManager.cs b/ShiftOS_TheReturn/ServerManager.cs
index df3e463..66a0d37 100644
--- a/ShiftOS_TheReturn/ServerManager.cs
+++ b/ShiftOS_TheReturn/ServerManager.cs
@@ -89,6 +89,8 @@ Ping: {ServerManager.DigitalSocietyPing} ms
/// </summary>
public static Guid thisGuid { get; private set; }
+ public static AutoResetEvent guidReceiveARE = new AutoResetEvent(false);
+
/// <summary>
/// Gets the underlying NetSockets client for this connection.
/// </summary>
@@ -241,6 +243,7 @@ Ping: {ServerManager.DigitalSocietyPing} ms
{
thisGuid = new Guid(msg.Contents);
GUIDReceived?.Invoke(msg.Contents);
+ guidReceiveARE.Set();
TerminalBackend.PrefixEnabled = true;
TerminalBackend.PrintPrompt();
}
diff --git a/ShiftOS_TheReturn/ShiftOS.Engine.csproj b/ShiftOS_TheReturn/ShiftOS.Engine.csproj
index 66d2747..4bb930e 100644
--- a/ShiftOS_TheReturn/ShiftOS.Engine.csproj
+++ b/ShiftOS_TheReturn/ShiftOS.Engine.csproj
@@ -139,6 +139,7 @@
<Compile Include="Localization.cs" />
<Compile Include="LoginManager.cs" />
<Compile Include="Lunix.cs" />
+ <Compile Include="MissionAttribute.cs" />
<Compile Include="NotificationDaemon.cs" />
<Compile Include="OutOfBoxExperience.cs" />
<Compile Include="Paths.cs" />
diff --git a/ShiftOS_TheReturn/Skinning.cs b/ShiftOS_TheReturn/Skinning.cs
index e00a2ef..e7ebbc7 100644
--- a/ShiftOS_TheReturn/Skinning.cs
+++ b/ShiftOS_TheReturn/Skinning.cs
@@ -575,6 +575,15 @@ namespace ShiftOS.Engine
public Color TitleBackgroundColor = TitleBG;
[ShifterMeta("Windows")]
+ [ShifterCategory("Titlebar")]
+ [ShifterName("Title Inactive Background Color")]
+ [RequiresUpgrade("shift_titlebar;shift_states")]
+ [ShifterDescription("The color of the titlebar's background when the window isn't active.")]
+ public Color TitleInactiveBackgroundColor = Skin.DefaultBackground;
+
+
+
+ [ShifterMeta("Windows")]
[ShifterCategory("Window border")]
[ShifterName("Left Border Background")]
[RequiresUpgrade("shift_window_borders")]
@@ -583,11 +592,27 @@ namespace ShiftOS.Engine
[ShifterMeta("Windows")]
[ShifterCategory("Window border")]
+ [ShifterName("Left Border Inactive Background")]
+ [RequiresUpgrade("shift_window_borders;shift_states")]
+ [ShifterDescription("The background color for the left border when the window is inactive.")]
+ public Color BorderInactiveLeftBackground = DefaultBackground;
+
+
+ [ShifterMeta("Windows")]
+ [ShifterCategory("Window border")]
[ShifterName("Right Border Background")]
[RequiresUpgrade("shift_window_borders")]
[ShifterDescription("The background color for the right border.")]
public Color BorderRightBackground = TitleBG;
+ [ShifterMeta("Windows")]
+ [ShifterCategory("Window border")]
+ [ShifterName("Right Border Inactive Background")]
+ [RequiresUpgrade("shift_window_borders;shift_states")]
+ [ShifterDescription("The background color for the right border when the window is inactive.")]
+ public Color BorderInactiveRightBackground = DefaultBackground;
+
+
[ShifterMeta("Desktop")]
[ShifterCategory("Panel buttons")]
[RequiresUpgrade("shift_panel_buttons")]
@@ -602,6 +627,21 @@ namespace ShiftOS.Engine
[ShifterDescription("The background color for the bottom border.")]
public Color BorderBottomBackground = TitleBG;
+ [ShifterMeta("Windows")]
+ [ShifterCategory("Window border")]
+ [ShifterName("Bottom Border Inactive Background")]
+ [RequiresUpgrade("shift_window_borders;shift_states")]
+ [ShifterDescription("The background color for the bottom border when the window is inactive.")]
+ public Color BorderInactiveBottomBackground = DefaultBackground;
+
+ [ShifterMeta("Windows")]
+ [ShifterCategory("Window border")]
+ [ShifterName("Use Inactive Border Assets?")]
+ [RequiresUpgrade("shift_window_borders;shift_states")]
+ [ShifterDescription("Do you want to use separate colors and images for inactive Window Borders?")]
+ public bool RenderInactiveBorders = false;
+
+
[ShifterMeta("Desktop")]
[ShifterCategory("Panel buttons")]
[ShifterName("Panel button holder from left")]
@@ -611,11 +651,20 @@ namespace ShiftOS.Engine
[ShifterMeta("Windows")]
[ShifterCategory("Window border")]
+ [ShifterName("Bottom Left Border Inactive Background")]
+ [RequiresUpgrade("shift_window_borders;shift_states")]
+ [ShifterDescription("The background color for the bottom left border when the window is inactive.")]
+ public Color BorderInactiveBottomLeftBackground = DefaultBackground;
+
+
+ [ShifterMeta("Windows")]
+ [ShifterCategory("Window border")]
[ShifterName("Bottom Left Border Background")]
[RequiresUpgrade("shift_window_borders")]
[ShifterDescription("The background color for the bottom left border.")]
public Color BorderBottomLeftBackground = TitleBG;
+
[ShifterMeta("Windows")]
[ShifterCategory("Window border")]
[ShifterName("Bottom Right Border Background")]
@@ -624,6 +673,14 @@ namespace ShiftOS.Engine
public Color BorderBottomRightBackground = TitleBG;
[ShifterMeta("Windows")]
+ [ShifterCategory("Window border")]
+ [ShifterName("Bottom Right Border Inactive Background")]
+ [RequiresUpgrade("shift_window_borders;shift_states")]
+ [ShifterDescription("The background color for the bottom right border when the window is inactive.")]
+ public Color BorderInactiveBottomRightBackground = DefaultBackground;
+
+
+ [ShifterMeta("Windows")]
[ShifterCategory("Title Buttons")]
[ShifterName("Close Button Color")]
[RequiresUpgrade("shift_title_buttons")]
@@ -1135,6 +1192,14 @@ namespace ShiftOS.Engine
[ShifterMeta("Windows")]
[ShifterCategory("Titlebar")]
+ [ShifterName("Titlebar inactive background image")]
+ [Image("titlebarinactive")]
+ [RequiresUpgrade("skinning;shift_titlebar;shift_states")]
+ public byte[] TitleBarInactiveBackground = null;
+
+
+ [ShifterMeta("Windows")]
+ [ShifterCategory("Titlebar")]
[RequiresUpgrade("shift_titlebar")]
[ShifterName("Show title corners?")]
[ShifterDescription("If checked, a left and a right section will appear on the titlebar which is useful for rounded corners, padding, or other useful properties.")]
@@ -1150,6 +1215,15 @@ namespace ShiftOS.Engine
[ShifterMeta("Windows")]
[ShifterCategory("Titlebar")]
+ [RequiresUpgrade("shift_titlebar;shift_states")]
+ [ShifterFlag("ShowTitleCorners", true)]
+ [ShifterName("Title left inactive background color")]
+ [ShifterDescription("What color should be used for the left title corner when the window is inactive?")]
+ public Color TitleInactiveLeftCornerBackground = DefaultBackground;
+
+
+ [ShifterMeta("Windows")]
+ [ShifterCategory("Titlebar")]
[RequiresUpgrade("shift_titlebar")]
[ShifterFlag("ShowTitleCorners", true)]
[ShifterName("Title right background color")]
@@ -1158,6 +1232,15 @@ namespace ShiftOS.Engine
[ShifterMeta("Windows")]
[ShifterCategory("Titlebar")]
+ [RequiresUpgrade("shift_titlebar;shift_states")]
+ [ShifterFlag("ShowTitleCorners", true)]
+ [ShifterName("Title right inactive background color")]
+ [ShifterDescription("What color should be used for the right title corner when the window is inactive?")]
+ public Color TitleInactiveRightCornerBackground = DefaultBackground;
+
+
+ [ShifterMeta("Windows")]
+ [ShifterCategory("Titlebar")]
[RequiresUpgrade("shift_titlebar")]
[ShifterFlag("ShowTitleCorners", true)]
[ShifterName("Title left corner width")]
@@ -1183,6 +1266,16 @@ namespace ShiftOS.Engine
[ShifterMeta("Windows")]
[ShifterCategory("Titlebar")]
+ [RequiresUpgrade("skinning;shift_titlebar;shift_states")]
+ [ShifterFlag("ShowTitleCorners", true)]
+ [ShifterName("Title left corner inactive background image")]
+ [ShifterDescription("Select an image to appear as the background texture for the left titlebar corner when the window is inactive.")]
+ [Image("titleleftinactive")]
+ public byte[] TitleLeftInactiveBG = null;
+
+
+ [ShifterMeta("Windows")]
+ [ShifterCategory("Titlebar")]
[RequiresUpgrade("skinning;shift_titlebar")]
[ShifterFlag("ShowTitleCorners", true)]
[ShifterName("Title right corner background image")]
@@ -1190,6 +1283,15 @@ namespace ShiftOS.Engine
[Image("titleright")]
public byte[] TitleRightBG = null;
+ [ShifterMeta("Windows")]
+ [ShifterCategory("Titlebar")]
+ [RequiresUpgrade("skinning;shift_titlebar;shift_states")]
+ [ShifterFlag("ShowTitleCorners", true)]
+ [ShifterName("Title right corner inactive background image")]
+ [ShifterDescription("Select an image to appear as the background texture for the right titlebar corner when the window is inactive.")]
+ [Image("titlerightinactive")]
+ public byte[] TitleRightInactiveBG = null;
+
[ShifterMeta("System")]
[ShifterCategory("General")]
@@ -1207,6 +1309,15 @@ namespace ShiftOS.Engine
[ShifterMeta("Windows")]
[ShifterCategory("Window border")]
+ [RequiresUpgrade("skinning;shift_window_borders;shift_states")]
+ [Image("bottomborderinactive")]
+ [ShifterName("Bottom Border Inactive Image")]
+ [ShifterDescription("Select an image to appear on the bottom border when the window is inactive. ")]
+ public byte[] BottomBorderInactiveBG = null;
+
+
+ [ShifterMeta("Windows")]
+ [ShifterCategory("Window border")]
[RequiresUpgrade("skinning;shift_window_borders")]
[Image("bottomrborder")]
[ShifterName("Bottom Right Border Image")]
@@ -1221,6 +1332,25 @@ namespace ShiftOS.Engine
[ShifterDescription("Select an image to appear on the bottom left border.")]
public byte[] BottomLBorderBG = null;
+
+ [ShifterMeta("Windows")]
+ [ShifterCategory("Window border")]
+ [RequiresUpgrade("skinning;shift_window_borders;shift_states")]
+ [Image("bottomrborderinactive")]
+ [ShifterName("Bottom Right Border Inactive Image")]
+ [ShifterDescription("Select an image to appear on the bottom right border when the window is inactive.")]
+ public byte[] BottomRBorderInactiveBG = null;
+
+ [ShifterMeta("Windows")]
+ [ShifterCategory("Window border")]
+ [RequiresUpgrade("skinning;shift_window_borders;shift_states")]
+ [Image("bottomlborderinactive")]
+ [ShifterName("Bottom Left Border Inactive Image")]
+ [ShifterDescription("Select an image to appear on the bottom left border when the window is inactive.")]
+ public byte[] BottomLBorderInactiveBG = null;
+
+
+
[ShifterMeta("Windows")]
[ShifterCategory("Window border")]
[RequiresUpgrade("skinning;shift_window_borders")]
@@ -1237,6 +1367,25 @@ namespace ShiftOS.Engine
[ShifterDescription("Select an image to appear on the right border.")]
public byte[] RightBorderBG = null;
+
+ [ShifterMeta("Windows")]
+ [ShifterCategory("Window border")]
+ [RequiresUpgrade("skinning;shift_window_borders;shift_states")]
+ [Image("leftborderinactive")]
+ [ShifterName("Left Border Inactive Image")]
+ [ShifterDescription("Select an image to appear on the left border when the window is inactive.")]
+ public byte[] LeftBorderInactiveBG = null;
+
+ [ShifterMeta("Windows")]
+ [ShifterCategory("Window border")]
+ [RequiresUpgrade("skinning;shift_window_borders;shift_states")]
+ [Image("rightborderinactive")]
+ [ShifterName("Right Border Inactive Image")]
+ [ShifterDescription("Select an image to appear on the right border when the window is inactive.")]
+ public byte[] RightBorderInactiveBG = null;
+
+
+
[ShifterMeta("Windows")]
[ShifterCategory("Window border")]
[RequiresUpgrade("shift_window_borders")]
diff --git a/ShiftOS_TheReturn/Story.cs b/ShiftOS_TheReturn/Story.cs
index 2b00686..bf727d8 100644
--- a/ShiftOS_TheReturn/Story.cs
+++ b/ShiftOS_TheReturn/Story.cs
@@ -141,7 +141,7 @@ namespace ShiftOS.Engine
{
foreach (var mth in type.GetMethods(BindingFlags.Public | BindingFlags.Static))
{
- foreach (var attrib in Array.FindAll(mth.GetCustomAttributes(false), a => a is StoryAttribute))
+ foreach (var attrib in Array.FindAll(mth.GetCustomAttributes(false), a => a is StoryAttribute || a is MissionAttribute))
{
var story = attrib as StoryAttribute;
if (story.StoryID == stid)
@@ -157,6 +157,19 @@ namespace ShiftOS.Engine
SaveSystem.CurrentSave.PickupPoint = Context.Id;
Context.OnComplete += () =>
{
+ if(story is MissionAttribute)
+ {
+ var mission = story as MissionAttribute;
+ ConsoleEx.ForegroundColor = ConsoleColor.Yellow;
+ ConsoleEx.Bold = true;
+ Console.WriteLine(" - mission complete - ");
+ ConsoleEx.Bold = false;
+ ConsoleEx.ForegroundColor = ConsoleColor.White;
+ Console.WriteLine($"{mission.Name} successfully finished. You have earned {mission.CodepointAward} Codepoints for your efforts.");
+ SaveSystem.CurrentSave.Codepoints += mission.CodepointAward;
+ TerminalBackend.PrintPrompt();
+ TerminalBackend.PrefixEnabled = true;
+ }
StoryComplete?.Invoke(stid);
SaveSystem.CurrentSave.PickupPoint = null;
};
@@ -209,5 +222,6 @@ namespace ShiftOS.Engine
/// </summary>
public string StoryID { get; private set; }
+ public ulong CodepointAward { get; protected set; }
}
}