public void GivenILoadTestSessionDataForTheFeature(Table table)
        {
            if (CustomerDataLoad.DataSetupExecuted)
            {
                return;
            }
            DataLoadHelper <LoadSession> dataLoadHelper = new DataLoadHelper <LoadSession>();
            var list = dataLoadHelper.ProcessDataTable(table, LoaderData, "sessions/api/Customers/CustomerId/Interactions/InteractionId/sessions/", "InteractionId", "SessionId");

            LoaderData.AddRange(list);
        }
        public void GivenILoadOutcomeDataForTheFeature(Table table)
        {
            if (CustomerDataLoad.DataSetupExecuted)
            {
                return;
            }

            DataLoadHelper <LoadOutcome> dataLoadHelper = new DataLoadHelper <LoadOutcome>();
            var list = dataLoadHelper.ProcessDataTable(table, LoaderData, "outcomes/api/Customers/CustomerId/Interactions/InteractionId/ActionPlans/ActionPlanId/outcomes/", "ActionPlanId", "OutcomeId");

            LoaderData.AddRange(list);
        }
        public void GivenILoadTestContactDataForThisFeature(Table table)
        {
            if (CustomerDataLoad.DataSetupExecuted)
            {
                return;
            }

            DataLoadHelper <LoadContact> dataLoadHelper = new DataLoadHelper <LoadContact>();
            var list = dataLoadHelper.ProcessDataTable(table, LoaderData, "contactdetails/api/Customers/CustomerId/contactdetails/", "CustomerId", "ContactId");

            LoaderData.AddRange(list);
        }
        public void GivenILoadTestAddressDataForThisFeature(Table table)
        {
            if (CustomerDataLoad.DataSetupExecuted)
            {
                return;
            }

            DataLoadHelper <LoadAddress> dataLoadHelper = new DataLoadHelper <LoadAddress>();
            var list = dataLoadHelper.ProcessDataTable(table, LoaderData, "addresses/api/Customers/CustomerId/addresses/", "CustomerId", "AddressId");

            LoaderData.AddRange(list);
        }
        public void GivenILoadTestCustomerDataForThisFeature(Table table)
        {
            if (CustomerDataLoad.DataSetupExecuted)
            {
                return;
            }
            DataLoadHelper <LoadCustomer> dataLoadHelper = new DataLoadHelper <LoadCustomer>();
            Table processedTable = DataLoadHelper <LoadCustomer> .ReplaceTokensInTable(table);

            var list = dataLoadHelper.ProcessDataTable(processedTable, LoaderData, "/customers/api/customers/", "", "CustomerId");

            LoaderData.AddRange(list);
        }
        public void GivenILoadActionPlanDataForTheFeature(Table table)
        {
            if (CustomerDataLoad.DataSetupExecuted)
            {
                return;
            }
            DataLoadHelper <LoadActionPlan> dataLoadHelper = new DataLoadHelper <LoadActionPlan>();
            var list = dataLoadHelper.ProcessDataTable(table, LoaderData, "actionplans/api/Customers/CustomerId/Interactions/InteractionId/ActionPlans/", "InteractionId", "ActionPlanId");

            LoaderData.AddRange(list);

            /*
             *           DataLoadHelper<LoadActionPlan> dataLoadHelper = new DataLoadHelper<LoadActionPlan>();
             * var list = dataLoadHelper.ProcessDataTable(table, LoaderData, "actionplans/api/Customers/CustomerId/Interactions/InteractionId/Sessions/SessionId/ActionPlans/", "SessionId", "ActionPlanId");
             * LoaderData.AddRange(list);
             */
        }
Пример #7
0
        static void Postfix(CombatGameState __instance)
        {
            Mod.Log.Trace?.Write("CGS:OCGD - entered.");

            // Remove any trap turrets for salvage

            try
            {
                DataLoadHelper.UnloadAmbushResources(__instance);
            }
            catch (Exception e)
            {
                Mod.Log.Error?.Write(e, "Failed to unload ambush resources due to exception!");
                ModState.IsUrbanBiome = false;
            }

            ModState.Reset();
        }
Пример #8
0
        public Policy(string policyDetails)
        {
            DataLoadHelper dataLoadHelper = new DataLoadHelper();
            PolicyHelper   policyHelper   = new PolicyHelper();

            var detail = policyDetails.Split(",");

            ValidPolicy = policyHelper.ValidPolicyNumber(detail[0]);
            if (ValidPolicy)
            {
                PolicyNumber       = detail[0];
                PolicyStartDate    = dataLoadHelper.GetDateStarted(detail[1]);
                Premiums           = dataLoadHelper.GetIntValueFromString(detail[2]);
                Membership         = dataLoadHelper.GetMembership(detail[3]);
                DiscretionaryBonus = dataLoadHelper.GetIntValueFromString(detail[4]);
                UpliftPercentage   = dataLoadHelper.GetDecimalFromString(detail[5]);
            }
        }
Пример #9
0
 public MainViewModel()
 {
     #region loading data
     this.Nodes = DataLoadHelper.getNodes("Data/Templates.xml");
     #endregion
 }
Пример #10
0
        public static void Postfix(TurnDirector __instance, MessageCenterMessage message)
        {
            Mod.Log.Trace?.Write("TD:OICC - entered.");

            ModState.IsUrbanBiome = ModState.Combat.ActiveContract.ContractBiome == Biome.BIOMESKIN.urbanHighTech;
            if (!ModState.IsUrbanBiome)
            {
                Mod.Log.Info?.Write($"Contract has non-urban biome ({ModState.Combat.ActiveContract.ContractBiome}). Skipping processing.");
                return;
            }
            Mod.Log.Info?.Write($"Contract has Urban High Tech biome, enabling mod features.");

            // Check contract exclusions
            foreach (string overrrideId in Mod.Config.Ambush.BlacklistedContracts)
            {
                if (overrrideId.Equals(ModState.Combat.ActiveContract.Override.ID, StringComparison.InvariantCultureIgnoreCase))
                {
                    Mod.Log.Info?.Write($"Contract with override ID '{overrrideId}' is excluded, skipping processing.");
                    ModState.IsUrbanBiome = false;
                    return;
                }
            }
            Mod.Log.Info?.Write($"Contract with override ID: {ModState.Combat.ActiveContract.Override.ID} is not blacklisted, enabling ambushes.");

            ModState.ContractDifficulty = ModState.Combat.ActiveContract.Override.finalDifficulty;
            Mod.Log.Info?.Write($"Using contractOverride finalDifficulty of: {ModState.ContractDifficulty}");

            foreach (Team team in ModState.Combat.Teams)
            {
                if (team.GUID == TeamDefinition.TargetsTeamDefinitionGuid)
                {
                    ModState.TargetTeam = team;
                }
                else if (team.GUID == TeamDefinition.TargetsAllyTeamDefinitionGuid)
                {
                    ModState.TargetAllyTeam = team;
                }
                else if (team.GUID == TeamDefinition.HostileToAllTeamDefinitionGuid)
                {
                    ModState.HostileToAllTeam = team;
                }
            }
            Mod.Log.Info?.Write($"" +
                                $"TargetTeam identified as: {ModState.TargetTeam?.DisplayName}  " +
                                $"TargetAllyTeam identified as: {ModState.TargetAllyTeam?.DisplayName}  " +
                                $"HostileToAllTeam identified as: {ModState.HostileToAllTeam?.DisplayName}.");

            // TODO: Make this much more powerful and varied.
            ModState.AmbushTeam = ModState.TargetTeam;
            Mod.Log.Info?.Write($"Using team: {ModState.AmbushTeam.DisplayName} as Ambush team.");

            // Filter the AmbushDefs by contract difficulty. If we don't have ambushes for our contract difficulty,
            //   there's a configuration error - abort! This has to come before data loading as it sets
            //   the AmbushDefs for the current contract
            bool haveAmbushes = FilterAmbushes();

            if (!haveAmbushes)
            {
                ModState.IsUrbanBiome = false;
                Mod.Log.Warn?.Write("Incorrect filter configuration - disabling ambushes!");
                return;
            }

            // Load any resources necessary for our ambush
            try
            {
                DataLoadHelper.LoadAmbushResources(ModState.Combat);
            }
            catch (Exception e)
            {
                Mod.Log.Error?.Write(e, "Failed to load ambush resources due to exception!");
                ModState.IsUrbanBiome = false;
            }

            // Find candidate buildings
            CandidateBuildingsHelper.DoInitialFilter(__instance.Combat);
            Mod.Log.Info?.Write($"Contract initially has: {ModState.CandidateBuildings.Count} candidate buildings");

            // Devestate buildings
            DevestationHelper.DevestateBuildings();

            Mod.Log.Info?.Write($"After devestation, map has {ModState.CandidateBuildings.Count} candidate buildings.");
        }