public RVRProgression LockActiveBattleFront(Realms realm, int forceNumberBags = 0)
        {
            var activeRegion = RegionMgrs.Single(x => x.RegionId == ActiveBattleFront.RegionId);

            ProgressionLogger.Info($" Locking battlefront in {activeRegion.RegionName} Zone : {ActiveBattleFront.ZoneId} {ActiveBattleFrontName}");

            LockBattleFrontStatus(ActiveBattleFront.BattleFrontId, realm, activeRegion.Campaign.VictoryPointProgress);

            foreach (var flag in activeRegion.Campaign.Objectives)
            {
                if (ActiveBattleFront.ZoneId == flag.ZoneId)
                {
                    flag.OwningRealm = realm;
                    flag.SetObjectiveLocked();
                }
            }

            foreach (BattleFrontKeep keep in activeRegion.Campaign.Keeps)
            {
                if (ActiveBattleFront.ZoneId == keep.ZoneId)
                {
                    keep.OnLockZone(realm);
                }
            }
            ProgressionLogger.Debug($"Removing any siege from active region");
            // Destroy any active siege in this zone.
            try
            {
                var siegeInRegion = activeRegion?.Objects.Where(x => x is Siege);
                foreach (var siege in siegeInRegion)
                {
                    if (siege is Siege)
                    {
                        ProgressionLogger.Debug($"Calling Destroy on {siege.Name}");
                        siege.Destroy();
                    }
                }
            }
            catch (Exception e)
            {
                ProgressionLogger.Debug($"{e.Message}{e.StackTrace}");
            }

            activeRegion.Campaign.LockBattleFront(realm, forceNumberBags);

            // Use Locking Realm in the BFM, not the BF (BF applies to region)
            return(ActiveBattleFront);
        }
Beispiel #2
0
        public RVRProgression LockActiveBattleFront(Realms realm, int forceNumberBags = 0)
        {
            var activeRegion = RegionMgrs.Single(x => x.RegionId == this.ActiveBattleFront.RegionId);

            ProgressionLogger.Info($" Locking battlefront in {activeRegion.RegionName} Zone : {this.ActiveBattleFront.ZoneId} {this.ActiveBattleFrontName}");

            LockBattleFrontStatus(this.ActiveBattleFront.BattleFrontId, realm, activeRegion.Campaign.VictoryPointProgress);

            foreach (var flag in activeRegion.Campaign.Objectives)
            {
                if (this.ActiveBattleFront.ZoneId == flag.ZoneId)
                {
                    flag.OwningRealm = realm;
                    flag.SetObjectiveLocked();
                }
            }

            activeRegion.Campaign.LockBattleFront(realm);

            // Use Locking Realm in the BFM, not the BF (BF applies to region)
            return(this.ActiveBattleFront);
        }
Beispiel #3
0
        /// <summary>
        /// Open the active battlefront (which has been set in this class [ActiveBattleFront]).
        /// Reset the VPP for the active battlefront.
        /// </summary>
        /// <returns></returns>
        public RVRProgression OpenActiveBattlefront()
        {
            try
            {
                var activeRegion = RegionMgrs.Single(x => x.RegionId == ActiveBattleFront.RegionId);
                ProgressionLogger.Info($"Opening battlefront in {activeRegion.RegionName} Zone : {ActiveBattleFront.ZoneId} {ActiveBattleFrontName}");

                activeRegion.Campaign.VictoryPointProgress.Reset(activeRegion.Campaign);
                ProgressionLogger.Info($"Resetting VP Progress {activeRegion.RegionName} BF Id : {ActiveBattleFront.BattleFrontId} Zone : {ActiveBattleFront.ZoneId} {ActiveBattleFrontName}");


                // Find and update the status of the battlefront status.
                foreach (var apocBattleFrontStatus in BattleFrontStatuses)
                {
                    if (apocBattleFrontStatus.BattleFrontId == ActiveBattleFront.BattleFrontId)
                    {
                        ProgressionLogger.Info($"Resetting BFStatus {activeRegion.RegionName} BF Id : {this.ActiveBattleFront.BattleFrontId} Zone : {this.ActiveBattleFront.ZoneId} {this.ActiveBattleFrontName}");

                        apocBattleFrontStatus.Locked            = false;
                        apocBattleFrontStatus.OpenTimeStamp     = FrameWork.TCPManager.GetTimeStamp();
                        apocBattleFrontStatus.LockingRealm      = Realms.REALMS_REALM_NEUTRAL;
                        apocBattleFrontStatus.FinalVictoryPoint = new VictoryPointProgress();
                        apocBattleFrontStatus.LockTimeStamp     = 0;

                        // Reset the population for the battle front status
                        ProgressionLogger.Info($"InitializePopulationList {activeRegion.RegionName} BF Id : {ActiveBattleFront.BattleFrontId} Zone : {ActiveBattleFront.ZoneId} {ActiveBattleFrontName}");
                        GetActiveCampaign().InitializePopulationList(ActiveBattleFront.BattleFrontId);
                    }
                }

                if (activeRegion.Campaign == null)
                {
                    ProgressionLogger.Info($"activeRegion.Campaign is null");
                    return(ActiveBattleFront);
                }


                if (activeRegion.Campaign.Objectives == null)
                {
                    ProgressionLogger.Warn($"activeRegion.Campaign (objectives) is null");
                    return(this.ActiveBattleFront);
                }

                ProgressionLogger.Info($"Unlocking objectives {activeRegion.RegionName} BF Id : {this.ActiveBattleFront.BattleFrontId} Zone : {this.ActiveBattleFront.ZoneId} {this.ActiveBattleFrontName}");
                foreach (var flag in activeRegion.Campaign.Objectives)
                {
                    if (this.ActiveBattleFront.ZoneId == flag.ZoneId)
                    {
                        flag.SetObjectiveSafe();
                    }
                }

                if (activeRegion.Campaign.Keeps == null)
                {
                    ProgressionLogger.Warn($"activeRegion.Campaign (keeps) is null");
                    return(this.ActiveBattleFront);
                }

                ProgressionLogger.Info($"Unlocking keeps {activeRegion.RegionName} BF Id : {ActiveBattleFront.BattleFrontId} Zone : {ActiveBattleFront.ZoneId} {ActiveBattleFrontName}");
                foreach (var keep in activeRegion.Campaign.Keeps)
                {
                    if (ActiveBattleFront.ZoneId == keep.ZoneId)
                    {
                        ProgressionLogger.Debug($"Notifying Pairing (OpenBattleFront) unlocked Name : {keep.Info.Name} Zone : {keep.ZoneId} ");
                        keep.OpenBattleFront();
                    }
                }

                return(ActiveBattleFront);
            }
            catch (Exception e)
            {
                ProgressionLogger.Error($"Exception. Zone : {ActiveBattleFront.ZoneId} {ActiveBattleFrontName} {e.Message} {e.StackTrace}");
                throw;
            }
        }