@PixelBitez/

hackNet

C#

Contracts are taken by hackers for pay on hackNet. One hacker soon finds that his recent contract may be too much to handle.

fork
loading
Files
  • main.cs
  • Game
  • main.exe
main.cs
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
using System;
using System.Collections.Generic;

class MainClass {
  public bool devMode = false;
  public static void Main (string[] args) {
    Console.Clear();
    MainClass game = new MainClass();
    game.printText("Loading...", ConsoleColor.Red);
    New.Player Player = new New.Player();
    game.createContracts(Player);
    game.printText("Loaded.", ConsoleColor.Red);
    Console.Clear();
    game.setupPlayer(Player);
    while (true){
      string playerInput = game.getTextResponse();
      Console.WriteLine(playerInput);
      switch (playerInput){
        case "help":
          game.printText("help- Prints all the commands.", ConsoleColor.White);
          game.printText("confirm- Confirms an action.", ConsoleColor.White);
          game.printText("cancel- Cancels an action.", ConsoleColor.White);
          game.printText("probe- Gets the encoded access code from a hackNet ID.", ConsoleColor.White);
          game.printText("sendterminfo- Sends hackNet account info from a decoded probe key.", ConsoleColor.White);
          game.printText("decode- Decodes the probed hackNet account key.", ConsoleColor.White);
          game.printText("extract- Extracts the bitcoin from an decoded account key.", ConsoleColor.White);
          game.printText("player- Prints your current players status.", ConsoleColor.White);
          game.printText("menu- Opens the numerical selection menu.", ConsoleColor.White);
          break;
        case "player":
          game.printText("Name: " + Player.pName, ConsoleColor.White);
          game.printText("Alias: " + Player.pAlias, ConsoleColor.White);
          game.printText("Bitcoin: " + Player.bitcoin, ConsoleColor.Yellow);
          game.printText("Level: " + Player.pLevel, ConsoleColor.Blue);
          game.printText("Upgrade Points: " + Player.upgradePoints, ConsoleColor.Red);
          game.printText("Intelligence: " + Player.pIntelligence, ConsoleColor.Green);
          game.printText("Speed: " + Player.pSpeed, ConsoleColor.Green);
          game.printText("Storage: " + Player.pStorage, ConsoleColor.Green);
          break;
        case "menu":
          Console.Clear();
          game.printText("1. Contracts", ConsoleColor.White);
          game.printText("2. Upgrade Menu", ConsoleColor.White);
          game.printText("3. Exit", ConsoleColor.White);
          string playerInput1 = game.getTextResponse();
          switch (playerInput1){
            case "1":
              Console.Clear();
              foreach (contractSystem.Contract scanContract in Player.activeContracts){
                game.printText(Player.activeContracts.IndexOf(scanContract) + ". {Intelligence Requirement: " + scanContract.minInt + "} " + scanContract.Name + " // Contract Giver: " + scanContract.contractGiver, ConsoleColor.Blue);
              }
              string playerInput2 = game.getTextResponse();
              int inputInt;
              if (int.TryParse(playerInput2, out inputInt)){
                if (Player.activeContracts[inputInt] != null){
                  if (Player.pIntelligence >= Player.activeContracts[inputInt].minInt){
                    game.printText(Player.activeContracts[inputInt].Name + " accepted. Opening contract now.", ConsoleColor.Red);
                    Player.activeContracts[inputInt].acceptContract(Player, Player.activeContracts[inputInt]);
                  }
                }
              }
              break;
            case "2":
              bool isUpgrading = true;
              while (isUpgrading){
                Console.Clear();
                game.printText("Name: " + Player.pName, ConsoleColor.White);
                game.printText("Alias: " + Player.pAlias, ConsoleColor.White);
                game.printText("Bitcoin: " + Player.bitcoin, ConsoleColor.Yellow);
                game.printText("Level: " + Player.pLevel, ConsoleColor.Blue);
                game.printText("Upgrade Points: " + Player.upgradePoints, ConsoleColor.Red);
                game.printText("Intelligence: " + Player.pIntelligence, ConsoleColor.Green);
                game.printText("Speed: " + Player.pSpeed, ConsoleColor.Green);
                game.printText("Storage: " + Player.pStorage, ConsoleColor.Green);
                game.printText("---Options---", ConsoleColor.White);
                game.printText("1. Upgrade Intelligence", ConsoleColor.Green);
                game.printText("2. Upgrade Speed", ConsoleColor.Green);
                game.printText("3. Upgrade Storage", ConsoleColor.Green);
                game.printText("4. Exit", ConsoleColor.Red);
                string playerInput3 = game.getTextResponse();
                int inputInt1;
                if (int.TryParse(playerInput3, out inputInt1)){
                  switch (inputInt1){
                    case 1:
                      if (Player.upgradePoints > 0){
                        Player.upgradePoints--;
                        Player.pIntelligence++;
                      }
                      Console.Clear();
                      break;
                    case 2:
                      if (Player.upgradePoints > 0){
                        if (Player.pSpeed < 10){
                          Player.upgradePoints--;
                          Player.pSpeed++;
                        }
                      }
                      Console.Clear();
                      break;
                    case 3:
                      if (Player.upgradePoints > 0){
                        Player.upgradePoints--;
                        Player.pStorage++;
                      }
                      Console.Clear();
                      break;
                    case 4:
                      Console.Clear();
                      isUpgrading = false;
                      break;
                  }
                }
              }
              break;
            case "3":
              Console.Clear();
              break;
          }
          break;
      }
    }
  }
  void setupPlayer(New.Player playerProfile){
    printText("-New Message-", ConsoleColor.Blue);
    printText("Messages/Unknown:> \"Hello.\"", ConsoleColor.Red);
    printText("Messages/Unknown:> \"We know who you are.\"", ConsoleColor.Red);
    printText("Messages/Unknown:> \"We could use someone like you, someone who has your skills.\"", ConsoleColor.Red);
    printText("Messages/Unknown:> \"We have a contract for you. First you need to sign up for a hackNet account.\"", ConsoleColor.Red);
    printText("Messages/Unknown:> \"When you have made your account contact us.\"", ConsoleColor.Red);
    printText("Messages/Unknown:> \"See you soon.\"", ConsoleColor.Red);
    Console.Clear();
    printText("hackNet:> Welcome to hackNet. Here are some basic commands in our terminal before you get started.", ConsoleColor.White);
    printText("Type 'help' for all the commands.", ConsoleColor.White);
    printText("Type 'confirm' to confirm an action.", ConsoleColor.White);
    printText("Type 'cancel' to cancel an action.", ConsoleColor.White);
    printText("Type 'player' to get your current player status.", ConsoleColor.White);
    printText("Type 'menu' to open the menu.", ConsoleColor.White);
    printText("When in any menu, you will be given numerical options, type the number corresponding to the option to select it.", ConsoleColor.White);
    printText("Please type in your name.", ConsoleColor.Blue);
    playerProfile.pName = getTextResponse();
    printText("Please type in the alias you would like to go by on hackNet.", ConsoleColor.Blue);
    playerProfile.pAlias = getTextResponse();
    bool unconfirmed = true;
    while (unconfirmed){
      printText("Please confirm that you want your name to be " + playerProfile.pName + " and your alias to be " + playerProfile.pAlias + ".", ConsoleColor.Red);
      string answer = getTextResponse();
      if (answer == "confirm"){
        unconfirmed = false;
        Console.Clear();
      }else{
        printText("Please type in your name.", ConsoleColor.Blue);
        playerProfile.pName = getTextResponse();
        printText("Please type in the alias you would like to go by on hackNet.", ConsoleColor.Blue);
        playerProfile.pAlias = getTextResponse();
      }
    }
    printText("-Note added-", ConsoleColor.White);
    printText("-Opening note-", ConsoleColor.White);
    printText("Notes/CIA:>\n\"Hello " + playerProfile.pName + ",\nWe are aware of your hacking skills and want to bring you into our efforts in stopping Gumanaam. He is a notorious online hacker. His real name is unknown. We know that he is going to try and steal 100 bitcoin from the government, a heavy sum of money. We need you to stop him. Open the menu, then open contracts, and open the file for project Anon. It's up to you to choose if you accept this contract, but know that if you ignore us we will find you.\"", ConsoleColor.White);
    Console.Clear();
    playerProfile.pLevel = 1;
    playerProfile.pXp = 0;
    playerProfile.bitcoin = 0;
    playerProfile.upgradePoints = 1;
    playerProfile.pIntelligence = 2;
    playerProfile.pStorage = 1;
    playerProfile.pSpeed = 1;
  }
  void printText(string text, ConsoleColor textColor){
    Console.ForegroundColor = textColor;
    for (int i = 0; i < text.Length; i++){
      Console.Write(text[i]);
      if (devMode != true){
        System.Threading.Thread.Sleep(50);
      }
    }
    if (devMode != true){
      System.Threading.Thread.Sleep(text.Length * 12);
    }
    lineDown();
  }
  string getTextResponse(){
    Console.ForegroundColor = ConsoleColor.Green;
    Console.Write(">");
    string rLine = Console.ReadLine();
    return rLine;
  }
  void lineDown(){
    Console.WriteLine("");
  }
  void createContracts(New.Player Player){
    contractSystem.Contract Anon = new contractSystem.Contract();
    Player.activeContracts.Add(Anon);
    Anon.Name = "Anon";
    Anon.contractGiver = "Unknown";
    Anon.contractId = 1;
    Anon.minInt = 0;
    Anon.bitcoinReward = 0.1f;
    Anon.xpReward = 1000;

    contractSystem.Contract Anon1 = new contractSystem.Contract();
    Player.activeContracts.Add(Anon1);
    Anon1.Name = "A Helping Hand";
    Anon1.contractGiver = "Samuel Sullivan";
    Anon1.contractId = 4;
    Anon1.minInt = 1;
    Anon1.bitcoinReward = 0.5f;
    Anon1.xpReward = 2000;

    contractSystem.Contract Anon2 = new contractSystem.Contract();
    Player.activeContracts.Add(Anon2);
    Anon2.Name = "Sharp Shooter";
    Anon2.contractGiver = "Cameron Hackenberry";
    Anon2.contractId = 5;
    Anon2.minInt = 1;
    Anon2.bitcoinReward = 0.32f;
    Anon2.xpReward = 2000;

    contractSystem.Contract Anon3 = new contractSystem.Contract();
    Player.activeContracts.Add(Anon3);
    Anon3.Name = "The Heist";
    Anon3.contractGiver = "John Mamesly";
    Anon3.contractId = 6;
    Anon3.minInt = 1;
    Anon3.bitcoinReward = 0.52f;
    Anon3.xpReward = 2000;
  }
}