blob: 375c4903f52c779f9df10f94a8e35f1f1458d6c7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ShiftOS.Engine;
namespace ShiftOS.WinForms
{
[RequiresUpgrade("hacker101_breakingbonds_3")]
public static class MissionCommands
{
public static List<MissionAttribute> GetMissionsList()
{
var missions = new List<MissionAttribute>();
foreach (var type in ReflectMan.Types)
{
foreach (var method in type.GetMethods(System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Static))
{
var attrib = method.GetCustomAttributes(false).FirstOrDefault(x => x is MissionAttribute) as MissionAttribute;
if (attrib != null)
{
if (!Shiftorium.UpgradeInstalled(attrib.StoryID))
{
missions.Add(attrib);
}
}
}
}
return missions;
}
[Command("missions", description = "Lists all available missions.")]
public static void ShowAll()
{
ConsoleEx.ForegroundColor = ConsoleColor.Yellow;
ConsoleEx.Bold = true;
Console.WriteLine(" - Missions - ");
var missions = GetMissionsList();
ConsoleEx.ForegroundColor = ConsoleColor.White;
ConsoleEx.Bold = false;
if(missions.Count == 0)
{
Console.WriteLine("No missions available. Check back later!");
}
else
{
foreach(var mission in missions)
{
Console.WriteLine();
Console.WriteLine(mission.Name);
Console.WriteLine("--------------------------");
Console.WriteLine();
Console.WriteLine(mission.Description);
Console.WriteLine();
Console.WriteLine("assigner: " + mission.Assigner);
Console.WriteLine("reward: " + mission.CodepointAward + " Codepoints");
Console.WriteLine("To start this mission, run:");
ConsoleEx.Bold = true;
Console.WriteLine("startmission --id " + missions.IndexOf(mission));
}
}
}
[Command("startmission", description = "Starts the specified mission.")]
[RequiresArgument("id")]
public static void StartMission(Dictionary<string, object> args)
{
var id = Convert.ToInt32(args["id"].ToString());
var missions = GetMissionsList();
if (id < 0 || id >= missions.Count)
Console.WriteLine("Error: Mission ID not found.");
else
{
var mission = missions[id];
Story.Start(mission.StoryID);
}
}
}
}
|