public void ExecuteOnUnit(WoWUnit unit)
 {
     Print("Casting {0} on {1}", SpellName, unit.Name);
     Manager.LocalPlayer.LookAt(unit.Location);
     Spell.Cast(unit);
     Sleep(1000);
 }
Esempio n. 2
0
        public void Cast(WoWUnit target)
        {
            if (!IsValid)
                return;

            if (target == null || !target.IsValid)
                return;

            //target.Select();
            //WoWScript.ExecuteNoResults("CastSpellByID(" + Id + ")");
            SpellCollection.CastSpell(Id, guid: target.Guid);
        }
Esempio n. 3
0
        public override void OnTick()
        {
            if (!Manager.ObjectManager.IsInGame)
                return;

            Vendor = Manager.ObjectManager.Objects
                .Where(x => x.IsValid && x.IsUnit)
                .OfType<WoWUnit>()
                .Where(x => x.IsVendor)
                .OrderBy(x => x.Distance)
                .FirstOrDefault();

            if (Vendor == null || !Vendor.IsValid)
            {
                Print("Found no vendors");
                Stop();
                return;
            }

            if (Vendor.Distance > 6)
            {
                if (Manager.Movement.Destination == Vendor.Location)
                    Sleep(100);
                Manager.Movement.PathTo(Vendor.Location);
                Sleep(100);
            }

            if (!API.Gossip.IsShown && !API.Merchant.IsShown)
            {
                Vendor.Interact();
                Sleep(1000);
            }

            if (API.Gossip.IsShown)
            {
                GossipOption opt = API.Gossip.Options.FirstOrDefault(x => x.Gossip == GossipType.Vendor);
                if (opt == null) // Vendor doesn't have repairer gossip?
                    Stop();
                opt.Select();
                Sleep(1000);
            }

            if (API.Merchant.IsShown)
            {
                API.Merchant.SellAll(ItemQuality.Poor); // Sell all gray
                API.Merchant.SellAll(ItemQuality.Common);
                if (Vendor.IsRepairer)
                    API.Merchant.RepairAll(); // ... and repair if it's a repairer
                Stop();
            }
        }
        protected void CheckForAndApplyBuff(WoWUnit target, string name, bool sleep = true)
        {
            var buff = target.Auras[name];
            if (buff != null && buff.IsValid)
                return;

            var spell = Manager.Spellbook[name];
            if (spell == null || !spell.IsValid)
                return;

            Print("Buffing {0} with {1}", target.Name, name);
            spell.Cast(target);
            if (sleep)
                Sleep(1000);
        }
Esempio n. 5
0
        public override void OnTick()
        {
            if (!Manager.ObjectManager.IsInGame)
                return;

            if ((DateTime.Now - SleepTimer).TotalMilliseconds < 200)
                return;
            SleepTimer = DateTime.Now;

            switch (CurrentState)
            {
                case FishingState.Lure:
                    //if (!HasBait)
                    //{
                    //    // Implement applying lure
                    //}
                    ProfessionInfo fish = API.Profession.Fishing;
                    if (fish != null)
                    {
                        if (fish.Level >= (fish.MaxLevel - 25) && fish.MaxLevel < 450)
                        {
                            CurrentState = FishingState.Training;
                            return;
                        }
                    }
                    CurrentState = FishingState.Cast;
                    break;

                case FishingState.Cast:
                    Print("Casting Fishing Pole");
                    Fishing.Cast();
                    CurrentState = FishingState.Fishing;
                    break;

                case FishingState.Fishing:
                    if (IsFishing)
                    {
                        if (IsBobbing)
                            CurrentState = FishingState.Loot;
                    }
                    else
                        CurrentState = FishingState.Lure;
                    break;

                case FishingState.Loot:
                    Print("Getting Fishing Bobber");
                    Bobber.Interact();
                    LootTimer = DateTime.Now;
                    CurrentState = FishingState.Looting;
                    break;

                case FishingState.Looting:
                    TimeSpan span = DateTime.Now - LootTimer;
                    if (span.TotalSeconds > 3)
                    {
                        Print("No loot? Back to fishing then!");
                        CurrentState = FishingState.Lure;
                    }
                    break;

                    // TODO: Clean up, add dynamic fishing trainer locator.
                case FishingState.Training:
                    if (Trainer == null || !Trainer.IsValid)
                    {
                        // Marcia Chase, Dalaran - Neutral.
                        Trainer =
                            Manager.ObjectManager.Objects.Where(x => x.IsValid && x.IsUnit)
                                .OfType<WoWUnit>()
                                .FirstOrDefault(u => u.Entry == 28742);
                        return;
                    }

                    if (Trainer.Distance > 6f)
                    {
                        if (Manager.Movement.Destination == Trainer.Location)
                            Sleep(100);
                        Manager.Movement.PathTo(Trainer.Location);
                        return;
                    }

                    if (!API.Gossip.IsShown && !API.Trainer.IsShown)
                    {
                        Trainer.Interact();
                        return;
                    }

                    if (API.Gossip.IsShown)
                    {
                        GossipOption opt = API.Gossip.Options.FirstOrDefault(g => g.Gossip == GossipType.Trainer);
                        if (opt != null)
                            opt.Select();
                        return;
                    }

                    if (API.Trainer.IsShown)
                    {
                        API.Trainer.BuyAllAvailable();
                        Fishing = null;
                        Manager.Spellbook.Update = true;
                        CurrentState = FishingState.Lure;
                        return;
                    }

                    CurrentState = FishingState.Lure;

                    break;
            }
        }
Esempio n. 6
0
 public int ComboPointsOnTarget(WoWUnit u)
 {
     return((u?.Guid == ComboPointsTargetGuid) ? ComboPoints : 0);
 }
Esempio n. 7
0
 public void SetTarget(WoWUnit unit)
 {
     SetTarget(unit.Guid);
 }