Exemplo n.º 1
0
        private static double[,] ScoreRange(MapObject obj, int range)
        {
            Location loc = obj.GetLocation();

            double[,] scores = new double[range * 2 + 1, range * 2 + 1];

            ScoringAction currentAction = (x, s) =>
            {
                if (x.InRange(obj, range))
                {
                    int      nr  = range + (loc.Row - x.Row);
                    int      nc  = range + (loc.Col - x.Col);
                    Location mid = new Location(nr, nc);

                    for (int ra = -Bot.Engine.StickyBombExplosionRange; ra <= Bot.Engine.StickyBombExplosionRange; ra++)
                    {
                        for (int ca = -Bot.Engine.StickyBombExplosionRange;
                             ca <= Bot.Engine.StickyBombExplosionRange;
                             ca++)
                        {
                            if ((nr + ra).IsBetween(0, range * 2) && (nc + ca).IsBetween(0, range * 2) && new Location(nr + ra, nc + ca).InRange(mid, Bot.Engine.StickyBombExplosionRange))
                            {
                                scores[nr + ra, nc + ca] -= s;
                            }
                        }
                    }
                }
            };

            Bot.Engine.MyLivingPirates.ForEach(x => currentAction(x.Location, -1));
            Bot.Engine.EnemyLivingPirates.ForEach(x => currentAction(x.Location, 1));

            return(scores);
        }
        ///<summary>
        /// Returns a scoring activity (aka action) via the mechanics API.
        ///</summary>
        /// <param name="actionName"></param>
        /// <param name="portalid"></param>
        public ScoringAction GetScoringAction(string actionName, int portalid)
        {
            var                     desktopModuleId = DesktopModuleController.GetDesktopModuleByModuleName(Constants.DESKTOPMODULE_NAME, portalid).DesktopModuleID;
            ScoringAction           ret             = null;
            var                     smCtrl          = MechanicsController.Instance;
            ScoringActionDefinition adef            = smCtrl.GetScoringActionDefinition(actionName, desktopModuleId);

            if (adef != null)
            {
                var ctlr = new DotNetNuke.Mechanics.Components.Controllers.Internal.InternalMechanicsController();
                ret = ctlr.GetScoringAction(adef.ScoringActionDefId, portalid);
            }
            return(ret);
        }
Exemplo n.º 3
0
        public static double ScoreLocation(MapObject obj)
        {
            Location loc   = obj.GetLocation();
            double   score = 0;

            ScoringAction currentAction = (x, s) =>
            {
                if (x.InRange(obj, Bot.Engine.StickyBombExplosionRange))
                {
                    score += s;
                }
            };

            Bot.Engine.MyLivingPirates.ForEach(x => currentAction(x.Location, -1));
            Bot.Engine.EnemyLivingPirates.ForEach(x => currentAction(x.Location, 1));

            return(score);
        }
Exemplo n.º 4
0
        static Application InboundLeadType_NewApplicationWorkflow(Lead lead, UtcDateTime now)
        {
            var onOptOutMessage = new SendMessage("OnOptOutMessage"
                                                  , "Noted. We will make sure not to send you any future Smartphone deals. To get Smartphone deals again, SMS APPLY to 39360"
                                                  , isAccepted_: false
                                                  );

            var a2 = new IdNoSurnamePrompt("IdSurnamePrompt", "We want to give you the best deal. We need to see which deals you qualify for. Reply with your Surname and ID number. All info is SECURED. Example: Williams 7404125001087");

            var a3 = new ScoringAction(minAcceptableScore: 0);

            var onRejectScore = new SendMessage("OnRejectScoreMessage"
                                                , "Unfortunately, you have not qualified for a Smartphone. If your circumstances change, please reply with APPLY to 39360"
                                                , isAccepted_: false
                                                );

            var a4 = new LoadRecommendedProductsAction();
            var a5 = new RecommendProductAction();

            var a6 = new BankDetailsPrompt("BankDetailsPrompt", "To apply, reply with your bank name, account no and type. Example: Capitec 100112 Savings. Your info is SECURED");

            var a7 = new VerifyBankAccountAction();
            var onRejectAccountVerification = new SendMessage("OnRejectAccountVerification"
                                                              , "Something went wrong while confirming your bank account details. Please ensure your account details are correct."
                                                              , isAccepted_: false
                                                              );

            var a8 = new FreeTextPrompt("CompanyNamePrompt", "EmployerName", "Thanks. Your banking details are verified, and application approved. For FREE delivery to your work address reply with your Employer's Name. Example: iSmart");

            var a9 = new FreeTextPrompt("CompanyAddressPrompt", "EmployerAddress", "Almost done! Reply with your Employer's Street Address. Example: 15 Vilakazi str, Soweto, Gauteng, 1803");

            var a10 = new YesNoPrompt("AcceptT&CsPrompt", "AcceptT&Cs", $"View your T&Cs here: https://swoosh-mobile-prod.azurewebsites.net/tAndCs/{lead.Id}. Reply YES to agree and complete your application");

            var a11 = new SendMessage("CongratsMessage"
                                      , "Your brand new Smartphone is on its way. The couriers will contact you to arrange for FREE delivery to your work address. Enjoy your day"
                                      , isAccepted_: true
                                      );

            var application = new Application(lead.MobileNo, now, new List <Step> {
                new Step("AskIdNoAndSurnameStep", new List <IAction_> {
                    a2
                }),
                new Step("ScoreCustomerStep", new List <IAction_> {
                    a3
                }, onRejectScore),
                new Step("LoadRecommendedProductsStep", new List <IAction_> {
                    a4
                }, onRejectScore),
                new Step("ChooseProductStep", new List <IAction_> {
                    a5
                }),
                new Step("AskBankDetailsStep", new List <IAction_> {
                    a6
                }),
                new Step("VerifyBankDetailsStep", new List <IAction_> {
                    a7
                }, onRejectAccountVerification, "AskBankDetailsStep", 2),
                new Step("AskCompanyNameStep", new List <IAction_> {
                    a8
                }),
                new Step("AskCompanyAddressStep", new List <IAction_> {
                    a9
                }),
                new Step("AcceptT&CsStep", new List <IAction_> {
                    a10
                }, onOptOutMessage),
                new Step("CongratsStep", new List <IAction_> {
                    a11
                })
            });

            return(application);
        }
Exemplo n.º 5
0
 protected override void HandleActions()
 {
     base.HandleActions();
     damagingAction = new DamageAction(healthService, passedFinishBehavior);
     scoringAction  = new ScoringAction(scoreService, clickedBehaviour);
 }