private static void SetPauseInFacility(ProductionFacility facility, bool isPaused)
        {
            var productionEvent = isPaused ? ProductionEvent.GotPaused : ProductionEvent.GotResumed;

            using (var scope = Db.CreateTransaction())
            {
                try
                {
                    var productions = facility.ProductionProcessor.RunningProductions.Where(p => p.facilityEID == facility.Eid).ToArray();

                    foreach (var productionInProgressGroup in productions.GroupBy(p => p.character))
                    {
                        var currentCharacter = productionInProgressGroup.Key;

                        foreach (var productionInProgress in productionInProgressGroup)
                        {
                            productionInProgress.SetPause(isPaused);
                        }

                        NotifyClient(currentCharacter, productionInProgressGroup.ToList(), productionEvent);
                    }

                    Logger.Info(productions.Length + " productions set to isPaused:" + isPaused + " in facility: " + facility);
                    scope.Complete();
                }
                catch (Exception ex)
                {
                    Logger.Exception(ex);
                }
            }
        }
        public static void OnPBSStopFacility(this ProductionFacility facility)
        {
            if (!facility.IsOpen)
            {
                return;
            }

            Logger.Info("    production facility received a STOP. " + facility);
            SetPauseInFacility(facility, true);
        }
        public static void OnPBSStartFacility(this ProductionFacility facility)
        {
            if (facility.IsOpen)
            {
                return;
            }

            Logger.Info("    production facility received a START. " + facility);
            SetPauseInFacility(facility, false);
        }
예제 #4
0
        private int GetFacilityBonus()
        {
            int modifier    = 0;
            var dockingbase = GetDockingBase();

            if (dockingbase is Outpost)
            {
                ProductionFacility facility = (dockingbase as Outpost).GetProductionFacilities().Where(x => x.Eid == this.Eid).First();
                modifier = Outpost.GetFacilityLevelFromStack(facility.Eid) * 25;
            }
            return(modifier);
        }
        private int GetFacilityBonus()
        {
            int modifier    = 0;
            var dockingbase = GetDockingBase();

            if (dockingbase is Outpost)
            {
                ProductionFacility facility = (dockingbase as Outpost).GetProductionFacilities().Where(x => x.Eid == this.Eid).First();
                int extrapts = facility.DynamicProperties.GetOrDefault <int>(k.extrapoints);  //Entity-property for unique facility base-proficiencies
                modifier = (Outpost.GetFacilityLevelFromStack(facility.Eid) + extrapts) * 25; //bonus per facility level
            }
            return(modifier);
        }