예제 #1
0
            public override void Init(SimArrestSituationEx parent)
            {
                IPoliceStation[] objects = Sims3.Gameplay.Queries.GetObjects <IPoliceStation>();
                if (objects.Length == 0x0)
                {
                    Exit();
                }
                else
                {
                    IPoliceStation randomObjectFromList = RandomUtil.GetRandomObjectFromList <IPoliceStation>(objects);
                    parent.Station = randomObjectFromList;
                }

                SimDescription description = CreateNewCopFromPool();

                if (description == null)
                {
                    Exit();
                }
                else
                {
                    if (description.CreatedSim != null)
                    {
                        parent.Cop = description.CreatedSim;
                        SwitchOutfits.SwitchNoSpin(parent.Cop, new CASParts.Key(OutfitCategories.Career, 0));
                    }
                    else
                    {
                        parent.Cop = Instantiation.PerformOffLot(description, parent.Lot, description.GetOutfit(OutfitCategories.Career, 0x0), null);
                    }
                    parent.CopCar = CarNpcManager.Singleton.CreateServiceCar(ServiceType.Police);
                    ForceSituationSpecificInteraction(parent.Cop, parent.Cop, new GoToCulpritsLocation.Definition(Parent), null, OnCompletion, OnFailure, new InteractionPriority(InteractionPriorityLevel.High));
                }
            }
예제 #2
0
        public override void Init(ArrestSuspectSituation parent)
        {
            IPoliceStation objects = (IPoliceStation)RabbitHole.GetRandomRabbitHoleOfType(RabbitHoleType.PoliceStation);

            if (objects == null)
            {
                base.Exit();
            }
            else
            {
                IPoliceStation randomObjectFromList = RandomUtil.GetRandomObjectFromList <IPoliceStation>(objects);
                parent.Station = randomObjectFromList;
            }
            SimDescription description = parent.CreateNewCopFromPool();

            if (description == null)
            {
                base.Exit();
            }
            else
            {
                if (description.CreatedSim != null)
                {
                    parent.Cop = description.CreatedSim;
                    parent.Cop.SwitchToOutfitWithoutSpin(OutfitCategories.Career);
                }
                else
                {
                    SimOutfit outfit = description.GetOutfit(OutfitCategories.Career, 0);
                    parent.Cop = description.Instantiate(Vector3.OutOfWorld, outfit.Key);
                }
                parent.CopCar = CarNpcManager.Singleton.CreateServiceCar(ServiceType.Police);
                base.ForceSituationSpecificInteraction(parent.Cop, parent.Cop, new ArrestSuspectSituation.GoToCulpritsLocation.Definition(base.Parent), null, new Callback(this.OnCompletion), new Callback(this.OnFailure), new InteractionPriority(InteractionPriorityLevel.High));
            }
        }
        public bool Remove(PoliceStationDto thePoliceStation)
        {
            IPoliceStation thePoliceStationToDelete = mPoliceStationRepository.GetById(thePoliceStation.Id);

            if (thePoliceStationToDelete != null)
            {
                mPoliceStationRepository.Delete(thePoliceStationToDelete);
                return(true);
            }

            return(false);
        }
예제 #4
0
            public override void Init(ArrestSuspectSituation parent)
            {
                Sim                 simToArrest = parent.SimToArrest;
                Sim                 cop         = parent.Cop;
                CarService          copCar      = parent.CopCar;
                IPoliceStation      target      = parent.Station;
                InteractionInstance entry       = target.GetGoToJailDefinition().CreateInstance(target, simToArrest, new InteractionPriority((InteractionPriorityLevel)99), false, false);

                simToArrest.AddExitReason(ExitReason.CanceledByScript);
                simToArrest.InteractionQueue.AddNext(entry);
                copCar.GetOut(cop);
                InteractionDefinition i = new RabbitHole.ArrestSimInRabbitHole.Definition();//.Definition(SimArrestSituation.Create(parent.Lot, parent.SimToArrest, parent.SimsLocation), false);

                // InteractionDefinition i = new RabbitHole.ArrestSimInRabbitHole.Definition(parent, false);
                base.ForceSituationSpecificInteraction(target, cop, i, null, new Callback(this.OnCompletion), new Callback(this.OnFailure), new InteractionPriority((InteractionPriorityLevel)99));
            }
        public bool Modify(PoliceStationDto thePoliceStation)
        {
            IPoliceStation thePoliceStationToModify = mPoliceStationRepository.GetById(thePoliceStation.Id);

            if (thePoliceStationToModify != null)
            {
                thePoliceStationToModify.Name    = thePoliceStation.Name;
                thePoliceStationToModify.Workers = thePoliceStation.Workers;
                thePoliceStationToModify.Address = thePoliceStation.Address;
                thePoliceStationToModify.Chief   = thePoliceStation.Chief;

                mPoliceStationRepository.Update(thePoliceStationToModify);
                return(true);
            }

            return(false);
        }
        public PoliceStationDto Add(string name, string address, uint workers, string chief)
        {
            IPoliceStation newPoliceStation = PoliceStation.CreatePoliceStation(name, address, workers, chief);

            mPoliceStationRepository.Add(newPoliceStation);

            PoliceStationDto newPoliceStationDto = new PoliceStationDto
            {
                Name    = newPoliceStation.Name,
                Id      = newPoliceStation.Id,
                Workers = newPoliceStation.Workers,
                Chief   = newPoliceStation.Chief,
                Address = newPoliceStation.Address
            };

            return(newPoliceStationDto);
        }
        public PoliceStationDto FindById(int Id)
        {
            IPoliceStation thePoliceStation = mPoliceStationRepository.GetById(Id);

            if (thePoliceStation != null)
            {
                PoliceStationDto thePoliceStationDto = new PoliceStationDto
                {
                    Name    = thePoliceStation.Name,
                    Id      = thePoliceStation.Id,
                    Workers = thePoliceStation.Workers,
                    Chief   = thePoliceStation.Chief,
                    Address = thePoliceStation.Address
                };

                return(thePoliceStationDto);
            }

            return(null);
        }