public override void InitCrew()
 {
     Crew.Add(new Person("Driver", DateTime.Now, null));
     Crew.Add(new Person("Gunner", DateTime.Now, null));
     Crew.Add(new Person("Mechanic", DateTime.Now, null));
     Crew.Add(new Person("Officer", DateTime.Now, null));
 }
Exemple #2
0
 public override void SetTypeCrew()
 {
     Crew.Add(new CrewMember()
     {
         Name = "M" + 0, Position = "Пилот"
     });
 }
Exemple #3
0
        public CrewMember AddCrewMember(Library.Race race, string name)
        {
            var member = new CrewMember(race, this, name);

            Crew.Add(member);
            return(member);
        }
Exemple #4
0
 public override void InitCrew()
 {
     Crew.Add(new Person("Captain", DateTime.Now, null));
     Crew.Add(new Person("Gunner", DateTime.Now, null));
     Crew.Add(new Person("Gunner2", DateTime.Now, null));
     Crew.Add(new Person("1stOfficer", DateTime.Now, null));
 }
        private void AddCannon(Direction d, CannonPower type, int xOffset, int yOffset, int zOffset, bool oper = true)
        {
            MannedCannon cannon;
            BaseCreature mob = null;

            if (oper)
            {
                mob = new PirateCrew
                {
                    CantWalk = true
                };

                Crew.Add(mob);
            }

            switch (type)
            {
            default:
            case CannonPower.Light:
                cannon = new MannedCulverin(mob, d); break;

            case CannonPower.Heavy:
                cannon = new MannedCarronade(mob, d); break;

            case CannonPower.Massive:
                cannon = new MannedBlundercannon(mob, d); break;
            }

            if (mob == null)
            {
                cannon.CanFireUnmanned = true;
            }

            cannon.MoveToWorld(new Point3D(X + xOffset, Y + yOffset, Z + zOffset), Map);
            Cannons.Add(cannon);

            if (mob != null)
            {
                Point3D offset;

                switch (d)
                {
                default:
                case Direction.South:
                    offset = new Point3D(0, -1, 0); break;

                case Direction.North:
                    offset = new Point3D(0, 1, 0); break;

                case Direction.West:
                    offset = new Point3D(1, 0, 0); break;

                case Direction.East:
                    offset = new Point3D(-1, 0, 0); break;
                }

                mob.MoveToWorld(new Point3D(cannon.X + offset.X, cannon.Y + offset.Y, cannon.Z + offset.Z), Map);
            }
        }
Exemple #6
0
 public void FillShip()
 {
     Captain = new Pirate();
     for (int i = 0; i < new Random().Next(1, 21); i++)
     {
         Crew.Add(new Pirate());
     }
     CountAlivePirates();
 }
Exemple #7
0
        public virtual MachineryOnShift AddEmployee(Employee empl)
        {
            if (Crew.Count < 10)
            {
                Crew.Add(empl);
            }

            return(this);
        }
        public static void Postfix(Il2CppReferenceArray <GameData.PlayerInfo> JPGEIBIBJPJ)
        {
            List <Role> assignedRoles = AssignedSpecialRoles.Values.ToList();

            foreach (Role r in assignedRoles)
            {
                r.ClearSettings();
            }
            ResetValues();

            WriteImmediately(RPC.ResetVariables);

            List <PlayerControl> crewmates = PlayerControl.AllPlayerControls.ToArray().ToList();

            crewmates.RemoveAll(x => x.Data.IsImpostor);

            Doctor.SetRole(crewmates);
            Detective.SetRole(crewmates);
            Engineer.SetRole(crewmates);
            Maniac.SetRole(crewmates);
            Seer.SetRole(crewmates);
            Tracker.SetRole(crewmates);
            Nocturnal.SetRole(crewmates);
            Pathfinder.SetRole(crewmates);

            List <PlayerControl> impostors = PlayerControl.AllPlayerControls.ToArray().ToList();

            impostors.RemoveAll(x => !x.Data.IsImpostor);

            Ninja.SetRole(impostors);

            Crew.Clear();
            localPlayer = PlayerControl.LocalPlayer;

            bool   maniacExists   = SpecialRoleIsAssigned <Maniac>(out var maniacKvp);
            Maniac maniacInstance = maniacKvp.Value;

            foreach (PlayerControl player in PlayerControl.AllPlayerControls)
            {
                if (player.Data.IsImpostor)
                {
                    continue;
                }
                if (maniacExists && maniacInstance.player.PlayerId == player.PlayerId)
                {
                    continue;
                }

                Crew.Add(player);
            }

            MessageWriter writer = GetWriter(RPC.SetLocalPlayers);

            writer.WriteBytesAndSize(Crew.Select(player => player.PlayerId).ToArray());
            CloseWriter(writer);
        }
Exemple #9
0
        // METHODS
        public void FillShip()
        {
            var randomCrew = new Random().Next(5, 26);

            for (int i = 0; i < randomCrew; i++)
            {
                Crew.Add(new Pirate($"Pirate-{i}"));
            }
            var captain = new Pirate("Captain");

            captain.IsCaptain = true;
            Crew.Add(captain);
        }
Exemple #10
0
        public override void SetTypeCrew()
        {
            int i = 0;

            Crew.Add(new CrewMember()
            {
                Name = "M" + i++, Position = "Пилот"
            });
            Crew.Add(new CrewMember()
            {
                Name = "M" + i++, Position = "Второй Пилот"
            });
        }
        public override void SetTypeCrew()
        {
            int i = 0;

            Crew.Add(new CrewMember()
            {
                Name = "M" + i++, Position = "Пилот"
            });
            Crew.Add(new CrewMember()
            {
                Name = "M" + i++, Position = "Второй Пилот"
            });

            CrewMember crewMember = new CrewMember()
            {
                Name = "M" + i++, Position = "Стюардесса"
            };

            Crew.AddRange(new CrewMember[] { crewMember, crewMember.Clone() as CrewMember, crewMember.Clone() as CrewMember });
        }
Exemple #12
0
        public Ship(XElement ship)
            : base(ship)
        {
            this._crew              = new ObservableCollection <CMember>();
            this._tradeQueue        = new ObservableCollection <XElement>();
            this._constructionWares = new ObservableCollection <XElement>();
            this._drones            = new ObservableCollection <XElement>();

            if (ship.Attribute("name") == null)
            {
                EntityValueConverter conv = new EntityValueConverter();
                XAttribute           name = new XAttribute("name", conv.Convert(ship.Attribute("macro").Value, null, null, null));
                ship.Add(name);
            }

            IEnumerable <XElement> crewquery =
                from crew in this.Data.Descendants().Elements("component")
                where (string)crew.Attribute("class") == "npc"
                select crew;

            foreach (XElement person in crewquery)
            {
                Crew.Add(new CMember(person));
            }

            foreach (XElement trade in this.Data.Elements("trade").Elements("shopping").Elements("trade"))
            {
                TradeQueue.Add(trade);
            }

            IEnumerable <XElement> buildmodulesQuery =
                from buildmodules in this.Data.Descendants().Elements("connection")
                where (string)buildmodules.Attribute("macro") == "connection_buildmodule01"
                select buildmodules;

            IEnumerable <XElement> constructionWaresQuery =
                from wares in buildmodulesQuery.Descendants <XElement>().Elements("resources").Elements("ware")
                select wares;

            foreach (XElement ware in constructionWaresQuery)
            {
                ConstructionWares.Add(ware);
            }

            foreach (XElement drone in this.Data.Elements("ammunition").Elements("available").Elements("item"))
            {
                Drones.Add(drone);
            }


            IEnumerable <XElement> cargoList =
                from cargo in this.Data.Descendants().Elements("component")
                where (string)cargo.Attribute("class") == "storage" & (string)cargo.Attribute("macro") != "unit_player_ship_storage_macro"
                select cargo;

            foreach (XElement cargoType in cargoList)
            {
                string cargoTypeName = cargoType.Attribute("macro").Value;
                switch (cargoTypeName)
                {
                case "storage_ship_l_bulk_01_macro":
                case "storage_ship_m_bulk_01_macro":
                case "storage_ship_l_bulk_02_macro":
                case "storage_ship_l_bulk_03_macro":
                case "storage_ship_l_bulk_04_macro":
                case "storage_ship_xl_bulk_01_macro":
                    BulkCargo = cargoType;
                    break;

                case "storage_ship_l_container_01_macro":
                case "storage_ship_l_container_02_macro":
                case "storage_ship_m_container_01_macro":
                case "storage_ship_xl_container_01_macro":
                    ContainerCargo = cargoType;
                    break;

                case "storage_ship_l_energy_01_macro":
                case "storage_ship_l_energy_02_macro":
                case "storage_ship_xl_energy_01_macro":
                case "storage_ship_m_energy_01_macro":
                    EnergyCargo = cargoType;
                    break;

                case "storage_ship_l_fuel_01_macro":
                case "storage_ship_xl_fuel_01_macro":
                    FuelCargo = cargoType;
                    break;

                case "storage_ship_l_liquid_01_macro":
                case "storage_ship_l_liquid_02_macro":
                case "storage_ship_l_liquid_03_macro":
                case "storage_ship_xl_liquid_01_macro":
                case "storage_ship_m_liquid_01_macro":
                    LiquidCargo = cargoType;
                    break;

                case "storage_ship_xl_universal_01_macro":
                case "storage_ship_xs_universal_01_macro":
                case "storage_temp_huge_macro":
                    UniversalCargo = cargoType;
                    break;
                }
            }

            Gravidar = this.Data.Element("gravidar");

            LoadDetails();
        }
Exemple #13
0
 public override void InitCrew()
 {
     Crew.Add(new ClassLibrary1.Person("Marine", DateTime.Now, null));
 }
Exemple #14
0
        static void Postfix(byte HKHMBLJFLMC, MessageReader ALMCIJKELCP)
        {
            MessageReader reader = ALMCIJKELCP;
            
            switch (HKHMBLJFLMC /*Packet ID*/)
            {
                // ---------------------- Set special roles ----------------------
                case (byte) RPC.SetRole:
                    byte roleId = reader.ReadByte();
                    byte playerId = reader.ReadByte();
                    foreach (PlayerControl player in PlayerControl.AllPlayerControls)
                        if (player.PlayerId == playerId)
                            switch (roleId)
                            {
                                case var value when value == Detective.RoleID:
                                    AddSpecialRole(new Detective(player));
                                    break;
                                
                                case var value when value == Doctor.RoleID:
                                    AddSpecialRole(new Doctor(player));
                                    break;
                                
                                case var value when value == Engineer.RoleID:
                                    AddSpecialRole(new Engineer(player));
                                    break;
                                
                                case var value when value == Maniac.RoleID:
                                    AddSpecialRole(new Maniac(player));
                                    break;
                                
                                case var value when value == Seer.RoleID:
                                    AddSpecialRole(new Seer(player));
                                    break;

                                case var value when value == Tracker.RoleID:
                                    AddSpecialRole(new Tracker(player));
                                    break;
                                
                                case var value when value == Ninja.RoleID:
                                    AddSpecialRole(new Ninja(player));
                                    break;

                                case var value when value == Nocturnal.RoleID:
                                    AddSpecialRole(new Nocturnal(player));
                                    break;

                                case var value when value == Pathfinder.RoleID:
                                    AddSpecialRole(new Pathfinder(player));
                                    break;
                            }
                    break;
                // -------------- Happenings related to special roles --------------
                
                case (byte)RPC.SetProtected:
                    byte protectedId = reader.ReadByte();
                    foreach (PlayerControl player in PlayerControl.AllPlayerControls)
                        if (player.PlayerId == protectedId)
                            GetSpecialRole<Doctor>().protectedPlayer = player;
                    break;
                case (byte)RPC.ShieldBreak:
                    Doctor doctor = GetSpecialRole<Doctor>();
                    PlayerControl protectedPlayer = doctor.protectedPlayer;
                    if (protectedPlayer != null)
                    {
                        protectedPlayer.myRend.material.SetColor("_VisorColor", Palette.VisorColor);
                        protectedPlayer.myRend.material.SetFloat("_Outline", 0f);
                    }    
                    doctor.protectedPlayer = null;
                    break;
                case (byte) RPC.AttemptShield:
                    Doctor doctorShieldAttempt = GetSpecialRole<Doctor>();
                    if (doctorShieldAttempt.player != null)
                    {
                        doctorShieldAttempt.AttemptKillShielded();
                    }
                    break;
                case (byte) RPC.DetectiveKill:
                    var killerid = reader.ReadByte();
                    var targetid = reader.ReadByte();
                    PlayerControl killer = PlayerTools.GetPlayerById(killerid);
                    PlayerControl target = PlayerTools.GetPlayerById(targetid);
                    killer.MurderPlayer(target);
                    break;
                case (byte)RPC.ManiacWin:
                    Maniac maniac = GetSpecialRole<Maniac>();
                    foreach (PlayerControl player in PlayerControl.AllPlayerControls)
                    {
                        if (player == maniac.player) continue;
                        player.RemoveInfected();
                        player.Die(DeathReason.Exile);
                        player.Data.IsDead = true;
                        player.Data.IsImpostor = false;
                    }

                    maniac.player.Revive();
                    maniac.player.Data.IsDead = false;
                    maniac.player.Data.IsImpostor = true;
                    break;
                case (byte) RPC.NinjaDoubleKill:
                    var ninjaId = reader.ReadByte();
                    var doubleKillId = reader.ReadByte();
                    PlayerControl ninjaDoubleKill = PlayerTools.GetPlayerById(ninjaId);
                    PlayerControl targetDoubleKill = PlayerTools.GetPlayerById(doubleKillId);
                    ninjaDoubleKill.MurderPlayer(targetDoubleKill);
                    break;
                case (byte)RPC.SetTrackerMark:
                    Tracker tracker1 = GetSpecialRole<Tracker>();
                    SystemTypes system = (SystemTypes) reader.ReadInt32();
                    tracker1.markedSystem = system;
                    break;
                case (byte)RPC.TrapSuccessful:
                    if (TryGetSpecialRole(PlayerControl.LocalPlayer.PlayerId, out Tracker tracker2))
                    {
                        byte roomId = reader.ReadByte();
                        tracker2.TrapSuccessful((SystemTypes) roomId);
                    }
                    break;

                // --------------------------- Other ---------------------------

                case (byte)RPC.FixLights:
                    SwitchSystem switchSystem = ShipStatus.Instance.Systems[SystemTypes.Electrical].Cast<SwitchSystem>();
                    switchSystem.ActualSwitches = switchSystem.ExpectedSwitches;
                    break;
                case (byte)RPC.SetLocalPlayers:
                    Crew.Clear();
                    localPlayer = PlayerControl.LocalPlayer;
                    var localPlayerBytes = reader.ReadBytesAndSize();

                    foreach (byte id in localPlayerBytes)
                        foreach (PlayerControl player in PlayerControl.AllPlayerControls)
                            if (player.PlayerId == id)
                                Crew.Add(player);
                    break;
                case (byte) RPC.SetInfected:
                    break;
                case (byte) RPC.ResetVariables:
                    List<Role> assignedRoles = AssignedSpecialRoles.Values.ToList();
                    foreach (Role r in assignedRoles)
                    {
                        r.ClearSettings();
                    }
                    ResetValues();
                    break;
            }
        }
Exemple #15
0
 public void Add(Agent agent)
 {
     Crew.Add(agent);
     agent.Creature.CreatureDie += CreatureDied;
 }