public void Initialise(DataConfig dataConfig, AddonReader addonReader, RequirementFactory requirementFactory, ILogger logger, string?overridePathProfileFile)
        {
            SpiritPathFilename = string.Empty;

            Interact.Key            = InteractKey;
            Interact.Name           = "Interact";
            Interact.WaitForGCD     = false;
            Interact.DelayAfterCast = 0;
            Interact.PressDuration  = 30;
            Interact.Initialise(addonReader, requirementFactory, logger);

            Approach.Key            = InteractKey;
            Approach.Name           = "Approach";
            Approach.WaitForGCD     = false;
            Approach.DelayAfterCast = 0;
            Approach.PressDuration  = 10;
            Approach.Cooldown       = 150;
            Approach.Initialise(addonReader, requirementFactory, logger);

            AutoAttack.Key            = InteractKey;
            AutoAttack.Name           = "AutoAttack";
            AutoAttack.WaitForGCD     = false;
            AutoAttack.DelayAfterCast = 0;
            AutoAttack.Initialise(addonReader, requirementFactory, logger);

            StopAttack.PressDuration = 10;

            InitializeKeyActions(Pull, Interact, Approach, AutoAttack);
            InitializeKeyActions(Combat, Interact, Approach, AutoAttack);

            logger.LogInformation("[Form] Initialise KeyActions.");
            Form.ForEach(i => i.InitialiseForm(addonReader, requirementFactory, logger));

            Pull.Initialise("Pull", addonReader, requirementFactory, logger);
            Combat.Initialise("Combat", addonReader, requirementFactory, logger);
            Adhoc.Initialise("Adhoc", addonReader, requirementFactory, logger);
            NPC.Initialise("AdhocNpc", addonReader, requirementFactory, logger);
            Parallel.Initialise("Parallel", addonReader, requirementFactory, logger);

            Jump.Key = JumpKey;
            Jump.Initialise(addonReader, requirementFactory, logger);

            TargetLastTarget.Key = TargetLastTargetKey;
            TargetLastTarget.Initialise(addonReader, requirementFactory, logger);

            StandUp.Key = StandUpKey;
            StandUp.Initialise(addonReader, requirementFactory, logger);

            ClearTarget.Key = ClearTargetKey;
            ClearTarget.Initialise(addonReader, requirementFactory, logger);

            StopAttack.Key = StopAttackKey;
            StopAttack.Initialise(addonReader, requirementFactory, logger);

            TargetNearestTarget.Key = TargetNearestTargetKey;
            TargetNearestTarget.Initialise(addonReader, requirementFactory, logger);

            TargetPet.Key = TargetPetKey;
            TargetPet.Initialise(addonReader, requirementFactory, logger);

            TargetTargetOfTarget.Key = TargetTargetOfTargetKey;
            TargetTargetOfTarget.Initialise(addonReader, requirementFactory, logger);

            PetAttack.Key           = PetAttackKey;
            PetAttack.PressDuration = 10;
            PetAttack.Initialise(addonReader, requirementFactory, logger);

            Mount.Key = MountKey;
            Mount.Initialise(addonReader, requirementFactory, logger);

            GatherFindKeys.ForEach(key =>
            {
                GatherFindKeyConfig.Add(new KeyAction {
                    Key = key
                });
                GatherFindKeyConfig.Last().Initialise(addonReader, requirementFactory, logger);
            });

            OverridePathFilename = overridePathProfileFile;
            if (!string.IsNullOrEmpty(OverridePathFilename))
            {
                PathFilename = OverridePathFilename;
            }

            if (!File.Exists(Path.Join(dataConfig.Path, PathFilename)))
            {
                if (!string.IsNullOrEmpty(OverridePathFilename))
                {
                    throw new Exception($"The `{OverridePathFilename}` path file does not exists!");
                }
                else
                {
                    throw new Exception($"The loaded class config contains not existing `{PathFilename}` path file!");
                }
            }

            CheckConfigConsistency(logger);
        }
Example #2
0
        public void Initialise(DataConfig dataConfig, PlayerReader playerReader, RequirementFactory requirementFactory, ILogger logger, string?overridePathProfileFile)
        {
            SpiritPathFilename = string.Empty;

            Interact.Key  = InteractKey;
            Interact.Name = "Interact";
            Interact.Initialise(playerReader, requirementFactory, logger);

            Approach.Key  = InteractKey;
            Approach.Name = "Approach";
            Approach.Initialise(playerReader, requirementFactory, logger);

            AutoAttack.Key            = InteractKey;
            AutoAttack.Name           = "AutoAttack";
            AutoAttack.DelayAfterCast = 0;
            AutoAttack.Initialise(playerReader, requirementFactory, logger);

            InitializeKeyActions(Pull, Interact, Approach, AutoAttack);
            InitializeKeyActions(Combat, Interact, Approach, AutoAttack);

            Pull.Initialise(playerReader, requirementFactory, logger);
            Combat.Initialise(playerReader, requirementFactory, logger);
            Adhoc.Initialise(playerReader, requirementFactory, logger);
            NPC.Initialise(playerReader, requirementFactory, logger);
            Parallel.Initialise(playerReader, requirementFactory, logger);
            ShapeshiftForm.ForEach(i => i.Initialise(playerReader, requirementFactory, logger));

            Jump.Key = JumpKey;
            Jump.Initialise(playerReader, requirementFactory, logger);

            TargetLastTarget.Key = TargetLastTargetKey;
            TargetLastTarget.Initialise(playerReader, requirementFactory, logger);

            StandUp.Key = StandUpKey;
            StandUp.Initialise(playerReader, requirementFactory, logger);

            ClearTarget.Key = ClearTargetKey;
            ClearTarget.Initialise(playerReader, requirementFactory, logger);

            StopAttack.Key = StopAttackKey;
            StopAttack.Initialise(playerReader, requirementFactory, logger);

            TargetNearestTarget.Key = TargetNearestTargetKey;
            TargetNearestTarget.Initialise(playerReader, requirementFactory, logger);

            TargetPet.Key = TargetPetKey;
            TargetPet.Initialise(playerReader, requirementFactory, logger);

            TargetTargetOfTarget.Key = TargetTargetOfTargetKey;
            TargetTargetOfTarget.Initialise(playerReader, requirementFactory, logger);

            PetAttack.Key = PetAttackKey;
            PetAttack.Initialise(playerReader, requirementFactory, logger);

            GatherFindKeys.ForEach(key =>
            {
                GatherFindKeyConfig.Add(new KeyAction {
                    Key = key
                });
                GatherFindKeyConfig.Last().Initialise(playerReader, requirementFactory, logger);
            });

            OverridePathFilename = overridePathProfileFile;
            if (!string.IsNullOrEmpty(OverridePathFilename))
            {
                PathFilename = OverridePathFilename;
            }

            if (!File.Exists(Path.Join(dataConfig.Path, PathFilename)))
            {
                if (!string.IsNullOrEmpty(OverridePathFilename))
                {
                    throw new Exception($"The `{OverridePathFilename}` path file does not exists!");
                }
                else
                {
                    throw new Exception($"The loaded class config contains not existing `{PathFilename}` path file!");
                }
            }
        }