aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS.Frontend/HackerTestCommands.cs
blob: 675356a997a7d881f5cba956ef33b0cb103c8c14 (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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using ShiftOS.Engine;

#if DEBUG
namespace ShiftOS.Frontend
{
    public static class HackerTestCommands
    {
        [Command("lshackables")]
        public static void ListAllHackables()
        {
            foreach(var hackable in Hacking.AvailableToHack)
            {
                Console.WriteLine(hackable.ID + ": " + hackable.FriendlyName);
            }
        }

        [Command("describebackable")]
        [RequiresArgument("id")]
        public static void DescribeHackable(Dictionary<string, object> args)
        {
            string id = args["id"].ToString();
            var hackable = Hacking.AvailableToHack.FirstOrDefault(x => x.ID == id);
            if(hackable == null)
            {
                Console.WriteLine("Hackable not found.");
                return;
            }
            Console.WriteLine(hackable.FriendlyName);
            Console.WriteLine("------------------------");
            Console.WriteLine();
            Console.WriteLine("System name: " + hackable.SystemName);
            Console.WriteLine("Loot rarity: " + hackable.LootRarity);
            Console.WriteLine("Loot amount: " + hackable.LootAmount);
            Console.WriteLine("Connection timeout level: " + hackable.ConnectionTimeoutLevel);
            Console.WriteLine();
            Console.WriteLine(hackable.WelcomeMessage);
        }

        [Command("inithack")]
        [RequiresArgument("id")]
        public static void InitHack(Dictionary<string, object> args)
        {
            string id = args["id"].ToString();
            var hackable = Hacking.AvailableToHack.FirstOrDefault(x => x.ID == id);
            if (hackable == null)
            {
                Console.WriteLine("Hackable not found.");
                return;
            }
            Hacking.InitHack(hackable);
        }
    }
}
#endif