public void Reset()
        {
            Initialized = false;

            PlayerReader.Reset();

            UIMapId.Reset();

            ActionBarCostReader.Reset();
            SpellBookReader.Reset();
            TalentReader.Reset();
            CreatureHistory.Reset();

            Initialized = true;
        }
        public void AddonRefresh()
        {
            Refresh();

            CreatureHistory.Update(PlayerReader.TargetGuid, PlayerReader.TargetHealthPercentage);

            BagReader.Read();
            EquipmentReader.Read();

            ActionBarCostReader.Read();

            GossipReader.Read();

            SpellBookReader.Read();
            TalentReader.Read();

            LevelTracker.Update();

            if ((DateTime.Now - lastFrontendUpdate).TotalMilliseconds >= FrontendUpdateIntervalMs)
            {
                AddonDataChanged?.Invoke(this, EventArgs.Empty);
                lastFrontendUpdate = DateTime.Now;
            }
        }
Exemplo n.º 3
0
        public RequirementFactory(ILogger logger, AddonReader addonReader)
        {
            this.logger          = logger;
            this.addonReader     = addonReader;
            this.playerReader    = addonReader.PlayerReader;
            this.bagReader       = addonReader.BagReader;
            this.equipmentReader = addonReader.EquipmentReader;
            this.spellBookReader = addonReader.SpellBookReader;
            this.talentReader    = addonReader.TalentReader;
            this.creatureDb      = addonReader.CreatureDb;
            this.itemDb          = addonReader.ItemDb;

            keywordDictionary = new Dictionary <string, Func <string, Requirement> >()
            {
                { ">=", GetInclusiveValueBasedRequirement },
                { "<=", GetInclusiveValueBasedRequirement },
                { ">", GetExcusiveValueBasedRequirement },
                { "<", GetExcusiveValueBasedRequirement },
                { "==", GetEqualsValueBasedRequirement },
                { "npcID:", CreateNpcRequirement },
                { "BagItem:", CreateBagItemRequirement },
                { "SpellInRange:", CreateSpellInRangeRequirement },
                { "TargetCastingSpell", CreateTargetCastingSpellRequirement },
                { "Form", CreateFormRequirement },
                { "Race", CreateRaceRequirement },
                { "Spell", CreateSpellRequirement },
                { "Talent", CreateTalentRequirement },
                { "Trigger:", CreateTriggerRequirement }
            };

            booleanDictionary = new Dictionary <string, Func <bool> >
            {
                // Target Based
                { "TargetYieldXP", () => playerReader.TargetYieldXP },

                // Range
                { "InMeleeRange", () => playerReader.IsInMeleeRange },
                { "InDeadZoneRange", () => playerReader.IsInDeadZone },
                { "OutOfCombatRange", () => !playerReader.WithInCombatRange },
                { "InCombatRange", () => playerReader.WithInCombatRange },

                // Pet
                { "Has Pet", () => playerReader.Bits.HasPet },
                { "Pet Happy", () => playerReader.Bits.PetHappy },

                // Auto Spell
                { "AutoAttacking", () => playerReader.Bits.IsAutoRepeatSpellOn_AutoAttack },
                { "Shooting", () => playerReader.Bits.IsAutoRepeatSpellOn_Shoot },
                { "AutoShot", () => playerReader.Bits.IsAutoRepeatSpellOn_AutoShot },

                // Temporary Enchants
                { "HasMainHandEnchant", () => playerReader.Bits.MainHandEnchant_Active },
                { "HasOffHandEnchant", () => playerReader.Bits.OffHandEnchant_Active },

                // Equipment - Bag
                { "Items Broken", () => playerReader.Bits.ItemsAreBroken },
                { "BagFull", () => bagReader.BagsFull },
                { "HasRangedWeapon", () => equipmentReader.HasRanged() },
                { "HasAmmo", () => playerReader.Bits.HasAmmo },

                // General Buff Condition
                { "Eating", () => playerReader.Buffs.Eating },
                { "Drinking", () => playerReader.Buffs.Drinking },
                { "Mana Regeneration", () => playerReader.Buffs.ManaRegeneration },
                { "Well Fed", () => playerReader.Buffs.WellFed },
                { "Clearcasting", () => playerReader.Buffs.Clearcasting },

                // Player Affected
                { "Swimming", () => playerReader.Bits.IsSwimming },
                { "Falling", () => playerReader.Bits.IsFalling },

                //Priest
                { "Fortitude", () => playerReader.Buffs.Fortitude },
                { "InnerFire", () => playerReader.Buffs.InnerFire },
                { "Divine Spirit", () => playerReader.Buffs.DivineSpirit },
                { "Renew", () => playerReader.Buffs.Renew },
                { "Shield", () => playerReader.Buffs.Shield },

                // Druid
                { "Mark of the Wild", () => playerReader.Buffs.MarkOfTheWild },
                { "Thorns", () => playerReader.Buffs.Thorns },
                { "TigersFury", () => playerReader.Buffs.TigersFury },
                { "Prowl", () => playerReader.Buffs.Prowl },
                { "Rejuvenation", () => playerReader.Buffs.Rejuvenation },
                { "Regrowth", () => playerReader.Buffs.Regrowth },

                // Paladin
                { "Seal", () => playerReader.Buffs.Seal },
                { "Aura", () => playerReader.Buffs.Aura },
                { "Devotion Aura", () => playerReader.Buffs.Aura },
                { "Blessing", () => playerReader.Buffs.Blessing },
                { "Blessing of Might", () => playerReader.Buffs.Blessing },

                // Mage
                { "Frost Armor", () => playerReader.Buffs.FrostArmor },
                { "Ice Armor", () => playerReader.Buffs.FrostArmor },
                { "Arcane Intellect", () => playerReader.Buffs.ArcaneIntellect },
                { "Ice Barrier", () => playerReader.Buffs.IceBarrier },
                { "Ward", () => playerReader.Buffs.Ward },
                { "Fire Power", () => playerReader.Buffs.FirePower },
                { "Mana Shield", () => playerReader.Buffs.ManaShield },
                { "Presence of Mind", () => playerReader.Buffs.PresenceOfMind },
                { "Arcane Power", () => playerReader.Buffs.ArcanePower },

                // Rogue
                { "Slice and Dice", () => playerReader.Buffs.SliceAndDice },
                { "Stealth", () => playerReader.Buffs.Stealth },

                // Warrior
                { "Battle Shout", () => playerReader.Buffs.BattleShout },

                // Warlock
                { "Demon Skin", () => playerReader.Buffs.Demon },
                { "Demon Armor", () => playerReader.Buffs.Demon },
                { "Soul Link", () => playerReader.Buffs.SoulLink },
                { "Soulstone Resurrection", () => playerReader.Buffs.SoulstoneResurrection },
                { "Shadow Trance", () => playerReader.Buffs.ShadowTrance },

                // Shaman
                { "Lightning Shield", () => playerReader.Buffs.LightningShield },
                { "Water Shield", () => playerReader.Buffs.WaterShield },
                { "Shamanistic Focus", () => playerReader.Buffs.ShamanisticFocus },
                { "Focused", () => playerReader.Buffs.ShamanisticFocus },
                { "Stoneskin", () => playerReader.Buffs.Stoneskin },

                //Hunter
                { "Aspect of the Cheetah", () => playerReader.Buffs.Aspect },
                { "Aspect of the Pack", () => playerReader.Buffs.Aspect },
                { "Aspect of the Beast", () => playerReader.Buffs.Aspect },
                { "Aspect of the Hawk", () => playerReader.Buffs.Aspect },
                { "Aspect of the Wild", () => playerReader.Buffs.Aspect },
                { "Aspect of the Monkey", () => playerReader.Buffs.Aspect },
                { "Rapid Fire", () => playerReader.Buffs.RapidFire },
                { "Quick Shots", () => playerReader.Buffs.QuickShots },

                // Debuff Section
                // Druid Debuff
                { "Demoralizing Roar", () => playerReader.TargetDebuffs.Roar },
                { "Faerie Fire", () => playerReader.TargetDebuffs.FaerieFire },
                { "Rip", () => playerReader.TargetDebuffs.Rip },
                { "Moonfire", () => playerReader.TargetDebuffs.Moonfire },
                { "Entangling Roots", () => playerReader.TargetDebuffs.EntanglingRoots },
                { "Rake", () => playerReader.TargetDebuffs.Rake },

                // Warrior Debuff
                { "Rend", () => playerReader.TargetDebuffs.Rend },

                // Priest Debuff
                { "Shadow Word: Pain", () => playerReader.TargetDebuffs.ShadowWordPain },

                // Mage Debuff
                { "Frostbite", () => playerReader.TargetDebuffs.Frostbite },
                { "Slow", () => playerReader.TargetDebuffs.Slow },

                // Warlock Debuff
                { "Curse of Weakness", () => playerReader.TargetDebuffs.Curseof },
                { "Curse of Elements", () => playerReader.TargetDebuffs.Curseof },
                { "Curse of Recklessness", () => playerReader.TargetDebuffs.Curseof },
                { "Curse of Shadow", () => playerReader.TargetDebuffs.Curseof },
                { "Curse of Agony", () => playerReader.TargetDebuffs.Curseof },
                { "Curse of", () => playerReader.TargetDebuffs.Curseof },
                { "Corruption", () => playerReader.TargetDebuffs.Corruption },
                { "Immolate", () => playerReader.TargetDebuffs.Immolate },
                { "Siphon Life", () => playerReader.TargetDebuffs.SiphonLife },

                // Hunter Debuff
                { "Serpent Sting", () => playerReader.TargetDebuffs.SerpentSting },
            };

            valueDictionary = new Dictionary <string, Func <int> >
            {
                { "Health%", () => playerReader.HealthPercent },
                { "TargetHealth%", () => playerReader.TargetHealthPercentage },
                { "PetHealth%", () => playerReader.PetHealthPercentage },
                { "Mana%", () => playerReader.ManaPercentage },
                { "BagCount", () => bagReader.BagItems.Count },
                { "MobCount", () => addonReader.CombatCreatureCount },
                { "MinRange", () => playerReader.MinRange },
                { "MaxRange", () => playerReader.MaxRange },
                { "LastAutoShotMs", () => playerReader.AutoShot.ElapsedMs },
                { "LastMainHandMs", () => playerReader.MainHandSwing.ElapsedMs }
            };
        }