Exemplo n.º 1
0
        public BreakImmunityByKillingMobsInCloseProximity(Dictionary <string, string> args)
            : base(args)
        {
            QBCLog.BehaviorLoggingContext = this;

            try
            {
                // QuestRequirement* attributes are explained here...
                //    http://www.thebuddyforum.com/mediawiki/index.php?title=Honorbuddy_Programming_Cookbook:_QuestId_for_Custom_Behaviors
                // ...and also used for IsDone processing.
                // Primary attributes...
                MobIds = GetNumberedAttributesAsArray <int>("MobId", 0, ConstrainAs.MobId, new[] { "NpcId" });
                if (MobIds != null && !MobIds.Any())
                {
                    MobIds = GetAttributeAsArray <int>("MobIds", true, ConstrainAs.MobId, new[] { "NpcIds" }, null);
                }

                ImmunityBreakingMobIds = GetNumberedAttributesAsArray <int>(
                    "ImmunityBreakingMobId",
                    0,
                    ConstrainAs.MobId,
                    new[] { "ImmunityBreakingNpcId" });
                if (ImmunityBreakingMobIds != null && !ImmunityBreakingMobIds.Any())
                {
                    ImmunityBreakingMobIds = GetAttributeAsArray <int>(
                        "ImmunityBreakingMobIds",
                        true,
                        ConstrainAs.MobId,
                        new[] { "ImmunityBreakingNpcIds" },
                        null);
                }

                SearchLocation = GetAttributeAsNullable <Vector3>("", false, ConstrainAs.Vector3NonEmpty, null) ?? Me.Location;

                ImmunityAuraId = GetAttributeAsNullable <int>("ImmunityAuraId", true, ConstrainAs.AuraId, null) ?? 0;
                MaxRange       = GetAttributeAsNullable <double>("MaxRange", false, new ConstrainTo.Domain <double>(0, 40), null) ?? 8;
            }

            catch (Exception except)
            {
                // Maintenance problems occur for a number of reasons.  The primary two are...
                // * Changes were made to the behavior, and boundary conditions weren't properly tested.
                // * The Honorbuddy core was changed, and the behavior wasn't adjusted for the new changes.
                // In any case, we pinpoint the source of the problem area here, and hopefully it
                // can be quickly resolved.
                QBCLog.Exception(except);
                IsAttributeProblem = true;
            }
        }
Exemplo n.º 2
0
        public CannonControl(Dictionary <string, string> args)
            : base(args)
        {
            QBCLog.BehaviorLoggingContext = this;
            try
            {
                // QuestRequirement* attributes are explained here...
                //    http://www.thebuddyforum.com/mediawiki/index.php?title=Honorbuddy_Programming_Cookbook:_QuestId_for_Custom_Behaviors
                // ...and also used for IsDone processing.
                // Primary attributes...
                MobIds = GetNumberedAttributesAsArray <int>("MobId", 0, ConstrainAs.MobId, new[] { "NpcId" });
                if (MobIds != null && !MobIds.Any())
                {
                    MobIds = GetAttributeAsArray <int>("MobIds", false, ConstrainAs.MobId, new[] { "NpcIds" }, null);
                }
                Buttons               = GetAttributeAsArray <int>("Buttons", true, new ConstrainTo.Domain <int>(1, 12), null, null);
                ExitButton            = GetAttributeAsNullable <int>("ExitButton", false, ConstrainAs.HotbarButton, null) ?? 0;
                MaxAngle              = GetAttributeAsNullable <double>("MaxAngle", false, new ConstrainTo.Domain <double>(-1.5, 1.5), null) ?? 1.5;
                MinAngle              = GetAttributeAsNullable <double>("MinAngle", false, new ConstrainTo.Domain <double>(-1.5, 1.5), null) ?? -1.5;
                Velocity              = GetAttributeAsNullable <double>("Velocity", false, new ConstrainTo.Domain <double>(2.0, 1000), null) ?? 70;
                Gravity               = GetAttributeAsNullable <double>("Gravity", false, new ConstrainTo.Domain <double>(0.01, 80), null) ?? 30;
                VehicleId             = GetAttributeAsNullable <int>("VehicleId", false, ConstrainAs.VehicleId, null) ?? 0;
                VehicleSearchLocation = GetAttributeAsNullable <Vector3>("", false, ConstrainAs.Vector3NonEmpty, null) ?? Me.Location;
                WeaponArticulation    = new WeaponArticulation(MinAngle, MaxAngle);
                Weapons               = Buttons.Select(b => new VehicleWeapon(b, WeaponArticulation, Velocity, Gravity)).ToArray();
            }

            catch (Exception except)
            {
                // Maintenance problems occur for a number of reasons.  The primary two are...
                // * Changes were made to the behavior, and boundary conditions weren't properly tested.
                // * The Honorbuddy core was changed, and the behavior wasn't adjusted for the new changes.
                // In any case, we pinpoint the source of the problem area here, and hopefully it
                // can be quickly resolved.
                QBCLog.Exception(except);
                IsAttributeProblem = true;
            }
        }