Ejemplo n.º 1
0
        public Person(string fName, string lName, bool male, bool isHacker = false, string handle = null)
        {
            this.firstName = fName;
            this.lastName  = lName;
            this.isMale    = male;
            if (handle == null)
            {
                handle = UsernameGenerator.getName();
            }
            if (handle == null)
            {
                throw new InvalidOperationException();
            }
            this.handle     = handle;
            this.isHacker   = isHacker;
            this.birthplace = WorldLocationLoader.getRandomLocation();
            this.vehicles   = new List <VehicleRegistration>();
            this.degrees    = new List <Degree>();
            this.addRandomDegrees();
            this.addRandomVehicles();
            int num1 = 18;
            int num2 = 72;

            if (isHacker)
            {
                num2 = 45;
            }
            this.DateOfBirth   = DateTime.Now - TimeSpan.FromDays((double)(num1 * 365 + (int)(Utils.random.NextDouble() * (double)(num2 - num1) * 365.0)));
            this.medicalRecord = new MedicalRecord(this.birthplace, this.DateOfBirth);
            if (!Settings.EnableDLC || !DLC1SessionUpgrader.HasDLC1Installed || !isHacker && (double)Utils.randm(1f) >= 0.800000011920929)
            {
                return;
            }
            this.NeopalsAccount = NeopalsAccount.GenerateAccount(handle, Utils.flipCoin() && Utils.flipCoin() && isHacker && handle.ToLower() != "bit");
        }
Ejemplo n.º 2
0
 public override void initFiles()
 {
     base.initFiles();
     this.initFilesystem();
     for (int index = 0; index < 10; ++index)
     {
         this.comp.users.Add(new UserDetail(UsernameGenerator.getName()));
     }
     for (int index = 0; index < this.comp.users.Count; ++index)
     {
         UserDetail user = this.comp.users[index];
         if ((int)user.type == 1 || (int)user.type == 0 || (int)user.type == 2)
         {
             Folder folder = new Folder(user.name);
             folder.files.Add(new FileEntry("Username: "******"\nPassword: "******"AccountInfo"));
             Folder f = new Folder("inbox");
             if (this.shouldGenerateJunkEmails && user.name != this.os.defaultUser.name)
             {
                 this.addJunkEmails(f);
             }
             folder.folders.Add(f);
             folder.folders.Add(new Folder("sent"));
             this.accounts.folders.Add(folder);
         }
     }
     if (this.setupComplete == null)
     {
         return;
     }
     this.setupComplete();
 }
Ejemplo n.º 3
0
 public override void initFiles()
 {
     base.initFiles();
     initFilesystem();
     for (var index = 0; index < 10; ++index)
     {
         comp.users.Add(new UserDetail(UsernameGenerator.getName()));
     }
     for (var index = 0; index < comp.users.Count; ++index)
     {
         var userDetail = comp.users[index];
         if (userDetail.type == 1 || userDetail.type == 0 || userDetail.type == 2)
         {
             var folder = new Folder(userDetail.name);
             folder.files.Add(new FileEntry("Username: "******"\nPassword: "******"AccountInfo"));
             var f = new Folder("inbox");
             addJunkEmails(f);
             folder.folders.Add(f);
             folder.folders.Add(new Folder("sent"));
             accounts.folders.Add(folder);
         }
     }
     if (setupComplete == null)
     {
         return;
     }
     setupComplete();
 }
Ejemplo n.º 4
0
        public static void ReInitPeopleForExtension()
        {
            People.all.Clear();
            People.hackers.Clear();
            People.hubAgents.Clear();
            int    num  = 0;
            string path = Path.Combine(Utils.GetFileLoadPrefix(), "People");

            if (Directory.Exists(path))
            {
                foreach (FileSystemInfo file in new DirectoryInfo(path).GetFiles("*.xml"))
                {
                    Person person = People.loadPersonFromFile(LocalizedFileLoader.GetLocalizedFilepath(path + "/" + Path.GetFileName(file.Name)));
                    if (person != null)
                    {
                        People.all.Insert(0, person);
                        ++num;
                    }
                }
            }
            for (int index = num; index < 200; ++index)
            {
                bool   male    = Utils.flipCoin();
                string fName   = male ? People.maleNames[Utils.random.Next(People.maleNames.Length)] : People.femaleNames[Utils.random.Next(People.femaleNames.Length)];
                string surname = People.surnames[Utils.random.Next(People.surnames.Length)];
                People.all.Add(new Person(fName, surname, male, false, UsernameGenerator.getName()));
            }
            People.hackers = new List <Person>();
            People.generatePeopleForList(People.hackers, 10, true);
            People.hubAgents = new List <Person>();
            People.generatePeopleForList(People.hubAgents, 22, true);
        }
Ejemplo n.º 5
0
        public static void init()
        {
            maleNames =
                Utils.readEntireFile("Content/PersonData/MaleNames.txt").Replace("\r", "").Split(Utils.newlineDelim);
            femaleNames =
                Utils.readEntireFile("Content/PersonData/FemaleNames.txt").Replace("\r", "").Split(Utils.newlineDelim);
            surnames =
                Utils.readEntireFile("Content/PersonData/Surnames.txt").Replace("\r", "").Split(Utils.newlineDelim);
            all = new List <Person>(200);
            var num = 0;

            foreach (FileSystemInfo fileSystemInfo in new DirectoryInfo("Content/People").GetFiles("*.xml"))
            {
                var person = loadPersonFromFile("Content/People/" + Path.GetFileName(fileSystemInfo.Name));
                if (person != null)
                {
                    all.Add(person);
                    ++num;
                }
            }
            for (var index = num; index < 200; ++index)
            {
                var male  = Utils.flipCoin();
                var fName = male
                    ? maleNames[Utils.random.Next(maleNames.Length)]
                    : femaleNames[Utils.random.Next(femaleNames.Length)];
                var lName = surnames[Utils.random.Next(surnames.Length)];
                all.Add(new Person(fName, lName, male, false, UsernameGenerator.getName()));
            }
            hackers = new List <Person>();
            generatePeopleForList(hackers, 10, true);
            hubAgents = new List <Person>();
            generatePeopleForList(hubAgents, 22, true);
        }
Ejemplo n.º 6
0
        public static void init()
        {
            People.maleNames   = Utils.readEntireFile("Content/PersonData/MaleNames.txt").Replace("\r", "").Split(Utils.newlineDelim);
            People.femaleNames = Utils.readEntireFile("Content/PersonData/FemaleNames.txt").Replace("\r", "").Split(Utils.newlineDelim);
            People.surnames    = Utils.readEntireFile("Content/PersonData/Surnames.txt").Replace("\r", "").Split(Utils.newlineDelim);
            People.all         = new List <Person>(200);
            int num = 0;

            FileInfo[]    files      = new DirectoryInfo("Content/People").GetFiles("*.xml");
            List <string> stringList = new List <string>();

            for (int index = 0; index < files.Length; ++index)
            {
                stringList.Add("Content/People/" + Path.GetFileName(files[index].Name));
            }
            if (Settings.EnableDLC && DLC1SessionUpgrader.HasDLC1Installed)
            {
                foreach (FileSystemInfo file in new DirectoryInfo("Content/DLC/People").GetFiles("*.xml"))
                {
                    stringList.Add("Content/DLC/People/" + Path.GetFileName(file.Name));
                }
                People.PeopleWereGeneratedWithDLCAdditions = true;
            }
            for (int index = 0; index < stringList.Count; ++index)
            {
                Person person = People.loadPersonFromFile(LocalizedFileLoader.GetLocalizedFilepath(stringList[index]));
                if (person != null)
                {
                    People.all.Add(person);
                    ++num;
                }
                else
                {
                    Console.WriteLine("Person Load Error: " + stringList[index]);
                }
            }
            for (int index = num; index < 200; ++index)
            {
                bool   male    = Utils.flipCoin();
                string fName   = male ? People.maleNames[Utils.random.Next(People.maleNames.Length)] : People.femaleNames[Utils.random.Next(People.femaleNames.Length)];
                string surname = People.surnames[Utils.random.Next(People.surnames.Length)];
                People.all.Add(new Person(fName, surname, male, false, UsernameGenerator.getName()));
            }
            People.hackers = new List <Person>();
            People.generatePeopleForList(People.hackers, 10, true);
            People.hubAgents = new List <Person>();
            People.generatePeopleForList(People.hubAgents, 22, true);
        }
Ejemplo n.º 7
0
 private static void generatePeopleForList(List <Person> list, int numberToGenerate, bool areHackers = false)
 {
     for (int index = 0; index < numberToGenerate; ++index)
     {
         bool male = Utils.flipCoin();
         if (areHackers)
         {
             male = !male || !Utils.flipCoin();
         }
         Person person = new Person(male ? People.maleNames[Utils.random.Next(People.maleNames.Length)] : People.femaleNames[Utils.random.Next(People.femaleNames.Length)], People.surnames[Utils.random.Next(People.surnames.Length)], male, areHackers, UsernameGenerator.getName());
         list.Add(person);
         People.all.Add(person);
     }
 }